11 Commits
dev ... v1.0.2

Author SHA1 Message Date
morgan
4ff3f7d9d0 working afsk packets 2016-09-24 17:33:00 -07:00
morgan
b9f75e0c11 update AFSK messenger example 2016-09-24 15:32:24 -07:00
Morgan Redfield
f462bc0342 Merge pull request #24 from Temtel/master
Fixed Frequency Display at startup in AX25Receive.ino
2016-09-20 10:10:40 -07:00
Temtel
33962a585d Fixed Frequency Display at startup
Added   Serial.println(radio.getFrequency()); to setup.  May have been
removed accidentaly
2016-09-18 15:12:42 -07:00
Morgan Redfield
d54c5404a8 clarify new library setup 2016-08-27 09:36:01 -07:00
nick6x
6b775130d1 Remove unfinished examples 2016-08-26 15:02:40 -07:00
nick6x
e65893402a Fix typos 2016-08-26 14:40:47 -07:00
nick6x
9096d2ffa2 Update to separated libraries 2016-08-26 11:22:41 -07:00
nick6x
3e76e6e72f Merge branch 'master' of https://github.com/EnhancedRadioDevices/HamShield 2016-08-26 11:15:27 -07:00
Nigel Vander Houwen
164888fd49 Fixed DDS.cpp to reference ADC channel 2 instead of old channel 0. 2016-08-23 20:39:21 -07:00
nick6x
25813b7968 Clairify Parrot example description. 2016-08-18 20:47:35 -07:00
23 changed files with 96 additions and 665 deletions

View File

@@ -1,15 +1,21 @@
# HamShield # HamShield
WARNING: The dev branch is not guaranteed to work. Please use caution if you choose to use that branch.
All of the AFSK, DDS, etc. files have been moved to the in Progress directory. These files collectively use twice as much memory as the essential HamShield functions. The current plan is to make sure these are only included if they're going to be used. We'll also be adapting them to make them more friendly to non-Uno Arduinos. Stay tuned for those changes.
The master branch is intended for use with HamShield hardware -09 and above. The master branch is intended for use with HamShield hardware -09 and above.
HamShield Arduino Library and Example Sketches WARNING: The dev branch is not guaranteed to work. Please use caution if you choose to use that branch.
# HamShield Arduino Library and Example Sketches
This repository is meant to be checked out into your Arduino application's libraries folder. After reloading the application, the library and example sketches should be available for use. This repository is meant to be checked out into your Arduino application's libraries folder. After reloading the application, the library and example sketches should be available for use.
For overview, help, tricks, tips, and more, check out the wiki: For overview, help, tricks, tips, and more, check out the wiki:
https://github.com/EnhancedRadioDevices/HamShield/wiki https://github.com/EnhancedRadioDevices/HamShield/wiki
# KISS and AFSK
We've moved the KISS and AFSK code to a separate library to help keep memory usage in simple sketches down. To use the AFSK examples, please also install these libraries:
- https://github.com/EnhancedRadioDevices/DDS
- https://github.com/EnhancedRadioDevices/HamShield_KISS

View File

@@ -5,7 +5,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, open the Serial Monitor to * this program to your Arduino, open the Serial Monitor to
* monitor the process of the HamShield. Check for output on * monitor the process of the HamShield. Check for output on
* AFSK receiver. * AFSK receiver.

View File

@@ -4,7 +4,7 @@
* seperate AFSK receiver to test the output of this example. * seperate AFSK receiver to test the output of this example.
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. After uploading this program * into the HamShield RF jack. After uploading this program
* to your adruino, open the Serial Monitor to monitor. Type * to your Arduino, open the Serial Monitor to monitor. Type
* a message under 254 characters into the bar at the top of * a message under 254 characters into the bar at the top of
* the monitor. Click the "Send" button. Check for output on * the monitor. Click the "Send" button. Check for output on
* AFSK receiver. * AFSK receiver.
@@ -13,7 +13,6 @@
*/ */
#define DDS_REFCLK_DEFAULT 9600
#include <HamShield.h> #include <HamShield.h>
#include <DDS.h> #include <DDS.h>
@@ -51,84 +50,99 @@ void setup() {
radio.initialize(); radio.initialize();
radio.frequency(145570); radio.frequency(145570);
radio.setRfPower(0); radio.setRfPower(0);
radio.setVolume1(0xFF);
radio.setVolume2(0xFF);
radio.setSQHiThresh(-100);
radio.setSQLoThresh(-100);
radio.setSQOn();
dds.start(); dds.start();
afsk.start(&dds); afsk.start(&dds);
delay(100); delay(100);
radio.setModeReceive();
Serial.println("HELLO"); Serial.println("HELLO");
} }
String temp[1] = "";
void loop() { void loop() {
if(Serial.available()) { if(Serial.available()) {
char temp = (char)Serial.read(); char temp = (char)Serial.read();
if(temp == '`') { if(temp == '`') {
prepMessage(); msgptr = 0; Serial.print("!!"); } //Serial.println(messagebuff);
prepMessage();
msgptr = 0;
Serial.print("!!");
}
else { else {
messagebuff += temp; messagebuff += temp;
msgptr++; msgptr++;
} }
} }
if(msgptr > 254) { messagebuff = ""; Serial.print("X!"); } if(msgptr > 254) { messagebuff = ""; Serial.print("X!"); }
if(afsk.decoder.read() || afsk.rxPacketCount()) {
// A true return means something was put onto the packet FIFO
// If we actually have data packets in the buffer, process them all now
while(afsk.rxPacketCount()) {
AFSK::Packet *packet = afsk.getRXPacket();
Serial.print(F("Packet: "));
if(packet) {
packet->printPacket(&Serial);
AFSK::PacketBuffer::freePacket(packet);
}
}
}
} }
void prepMessage() { void prepMessage() {
radio.setModeTransmit(); radio.setModeTransmit();
delay(500); delay(1000);
origin_call = messagebuff.substring(0,messagebuff.indexOf(',')); // get originating callsign origin_call = messagebuff.substring(0,messagebuff.indexOf(',')); // get originating callsign
destination_call = messagebuff.substring(messagebuff.indexOf(',')+1, destination_call = messagebuff.substring(messagebuff.indexOf(',')+1,messagebuff.indexOf(',',messagebuff.indexOf(',')+1)); // get the destination call
messagebuff.indexOf(',',messagebuff.indexOf(',')+1)); // get the destination call textmessage = messagebuff.substring(messagebuff.indexOf(":")+1);
textmessage = messagebuff.substring(messagebuff.indexOf(":"));
AFSK::Packet *packet = AFSK::PacketBuffer::makePacket(22 + 32); // Serial.print("From: "); Serial.print(origin_call); Serial.print(" To: "); Serial.println(destination_call); Serial.println("Text: "); Serial.println(textmessage);
packet->start(); AFSK::Packet *packet = AFSK::PacketBuffer::makePacket(22 + 32);
packet->appendCallsign(origin_call.c_str(),0);
packet->appendCallsign(destination_call.c_str(),15,true);
packet->appendFCS(0x03);
packet->appendFCS(0xf0);
packet->print(textmessage);
packet->finish();
textmessage = ""; packet->start();
packet->appendCallsign(origin_call.c_str(),0);
packet->appendCallsign(destination_call.c_str(),15,true);
packet->appendFCS(0x03);
packet->appendFCS(0xf0);
packet->print(textmessage);
packet->finish();
bool ret = afsk.putTXPacket(packet); bool ret = afsk.putTXPacket(packet);
if(afsk.txReady()) { if(afsk.txReady()) {
Serial.println(F("txReady")); Serial.println(F("txReady"));
//radio.setModeTransmit(); radio.setModeTransmit();
//delay(100); //delay(100);
if(afsk.txStart()) { if(afsk.txStart()) {
Serial.println(F("txStart")); Serial.println(F("txStart"));
} else { } else {
radio.setModeReceive(); radio.setModeReceive();
}
} }
// Wait 2 seconds before we send our beacon again. }
Serial.println("tick"); // Wait 2 seconds before we send our beacon again.
// Wait up to 2.5 seconds to finish sending, and stop transmitter. Serial.println("tick");
// TODO: This is hackery. // Wait up to 2.5 seconds to finish sending, and stop transmitter.
for(int i = 0; i < 500; i++) { // TODO: This is hackery.
if(afsk.encoder.isDone()) for(int i = 0; i < 500; i++) {
break; if(afsk.encoder.isDone())
delay(50); break;
} delay(50);
Serial.println("Done sending"); }
delay(3000); Serial.println("Done sending");
radio.setModeReceive(); radio.setModeReceive();
} }
// TODO: d2 is now our switch, so don't write to that
ISR(TIMER2_OVF_vect) { ISR(TIMER2_OVF_vect) {
TIFR2 = _BV(TOV2); TIFR2 = _BV(TOV2);
static uint8_t tcnt = 0; static uint8_t tcnt = 0;
if(++tcnt == 8) { if(++tcnt == 8) {
//digitalWrite(2, HIGH); dds.clockTick();
dds.clockTick();
//digitalWrite(2, LOW);
tcnt = 0; tcnt = 0;
} }
} }
@@ -136,15 +150,9 @@ ISR(TIMER2_OVF_vect) {
ISR(ADC_vect) { ISR(ADC_vect) {
static uint8_t tcnt = 0; static uint8_t tcnt = 0;
TIFR1 = _BV(ICF1); // Clear the timer flag TIFR1 = _BV(ICF1); // Clear the timer flag
//PORTD |= _BV(2); // Diagnostic pin (D2)
dds.clockTick(); dds.clockTick();
if(++tcnt == 1) { if(++tcnt == 1) {
if(afsk.encoder.isSending()) { afsk.timer();
afsk.timer();
}
tcnt = 0; tcnt = 0;
} }
//PORTD &= ~(_BV(2)); // Pin D2 off again
} }

View File

@@ -6,7 +6,7 @@
* into the HamShield RF jack. Plug a pair of headphones into * into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then to * the HamShield. Connect the Arduino to wall power and then to
* your computer via USB. After uploading this program to your * your computer via USB. After uploading this program to your
* adruino, open the Serial Monitor so you will see the AFSK * Arduino, open the Serial Monitor so you will see the AFSK
* packet. Send AFSK packet from AFSK equipment at 145.01MHz. * packet. Send AFSK packet from AFSK equipment at 145.01MHz.
* Note: add message receive code * Note: add message receive code
@@ -47,6 +47,7 @@ void setup() {
radio.frequency(145010); radio.frequency(145010);
radio.setSQOff(); radio.setSQOff();
Serial.println(F("Frequency")); Serial.println(F("Frequency"));
Serial.println(radio.getFrequency());
delay(100); delay(100);
Serial.print(F("Squelch(H/L): ")); Serial.print(F("Squelch(H/L): "));
Serial.print(radio.getSQHiThresh()); Serial.print(radio.getSQHiThresh());

View File

@@ -5,7 +5,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, open the Serial Monitor. * this program to your Arduino, open the Serial Monitor.
* Type 'h' into the bar at the top of the Serial Monitor * Type 'h' into the bar at the top of the Serial Monitor
* and click the "Send" button for more instructions. * and click the "Send" button for more instructions.
*/ */

View File

@@ -1,6 +1,6 @@
/* Hamshield /* Hamshield
* Example: DDS * Example: DDS
* This is a simple example to show hot to transmit arbitrary * This is a simple example to show how to transmit arbitrary
* tones. In this case, the sketh alternates between 1200Hz * tones. In this case, the sketh alternates between 1200Hz
* and 2200Hz at 1s intervals. * and 2200Hz at 1s intervals.
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna

View File

@@ -6,7 +6,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, open the Serial Monitor to * this program to your Arduino, open the Serial Monitor to
* monitor the status of the beacon. To test, set a HandyTalkie * monitor the status of the beacon. To test, set a HandyTalkie
* to 438MHz. You should hear the message " KC7IBT ARDUINO * to 438MHz. You should hear the message " KC7IBT ARDUINO
* HAMSHIELD" in morse code. * HAMSHIELD" in morse code.

View File

@@ -1,283 +0,0 @@
// BlueHAM Proto01 Connection Guide
/**********************
**
** BlueHAM Proto01 <--> Arduino
** ADC_SCL A5
** ADC_DIO A4
** GND GND
** PWM_RF_CTL D9
**
** Setting Connections
** MODE -> GND
** SENB -> GND
** PDN -> 3.3V
** AVDD -> 5V (note this should be a beefy supply, could draw up to 4As)
**
**
**
** Pinout information for RadioPeripheral01 Prototype board
** GPIO0 -
** GPIO1 -
** GPIO2 - VHF_SEL
** GPIO3 - UHF_SEL
** GPIO4 - RX_EN
** GPIO5 - TX_EN
** GPIO6 -
** GPIO7 -
**************************/
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include "Wire.h"
#include "HAMShield.h"
#include <Goertzel.h>
//typedef enum {
#define MAIN_S 0
#define RX_S 1
#define TX_S 2
#define FREQ_S 3
#define UHF_S 4
#define VHF_S 5
#define PWR_S 6
#define GPIO_S 7
//} menu_view;
int state;
/* goertzel routines */
int sensorPin = A0;
int led = 13;
const float TARGET_FREQUENCY = 2200;
const int N = 100;
const float THRESHOLD = 4000;
const float SAMPLING_FREQUENCY = 8900;
Goertzel goertzel = Goertzel(TARGET_FREQUENCY, N, SAMPLING_FREQUENCY);
// create object for RDA
HAMShield radio;
#define LED_PIN 13
bool blinkState = false;
void setup() {
// initialize serial communication
Serial.begin(115200);
Serial.println("beginning radio setup");
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();
// verify connection
Serial.println("Testing device connections...");
Serial.println(radio.testConnection() ? "RDA radio connection successful" : "RDA radio connection failed");
// initialize device
Serial.println("Initializing I2C devices...");
radio.initialize(); // initializes automatically for UHF 12.5kHz channel
Serial.println("setting default Radio configuration");
// set frequency
Serial.println("changing frequency");
radio.setFrequency(446000); // in kHz
radio.setModeReceive();
// configure Arduino LED for
pinMode(LED_PIN, OUTPUT);
state = MAIN_S;
print_menu();
}
void loop() {
goertzel.sample(sensorPin);
float magnitude = goertzel.detect();
if(magnitude>THRESHOLD) digitalWrite(led, HIGH); //if found, enable led
else digitalWrite(led, LOW);
while (Serial.available()) {
if (state == FREQ_S) {
char freq_khz[6];
int i = 0;
while(i < 6) {
if (Serial.available()) {
freq_khz[i] = Serial.read();
i++;
}
}
// interpret frequency
uint32_t freq = 0;
i = 0;
while (i < 6) {
uint32_t temp = freq_khz[i] - '0';
for (int k = 5-i; k > 0; k--) {
temp = temp * 10;
}
freq += temp;
i++;
}
Serial.print("setting frequency to: ");
Serial.println(freq);
radio.setFrequency(freq);
state = MAIN_S;
} else if (state == PWR_S) {
uint8_t pwr_raw[3];
int i = 0;
while(i < 3) {
if (Serial.available()) {
pwr_raw[i] = Serial.read();
i++;
}
}
// interpret power
uint8_t pwr = 0;
i = 0;
while (i < 3) {
uint8_t temp = pwr_raw[i] - '0';
for (int k = 2-i; k > 0; k--) {
temp = temp * 10;
}
pwr += temp;
i++;
}
Serial.print("Setting power to: ");
Serial.println(pwr);
radio.setRfPower(pwr);
state = MAIN_S;
} else if (state == GPIO_S) {
uint8_t gpio_raw[2];
int i = 0;
while(i < 2) {
if (Serial.available()) {
gpio_raw[i] = Serial.read();
i++;
}
}
uint16_t gpio_pin = gpio_raw[0] - 48; // '0';
uint16_t gpio_mode = gpio_raw[1] - 48;
radio.setGpioMode(gpio_pin, gpio_mode);
state = MAIN_S;
} else {
char action = Serial.read();
if (action == 'r') { // get current state
state = RX_S;
} else if (action == 't') {
state = TX_S;
} else if (action == 'f') {
state = FREQ_S;
} else if (action == 'u') {
state = UHF_S;
} else if (action == 'v') {
state = VHF_S;
} else if (action == '1') {
turn_on(state);
state = MAIN_S;
} else if (action == '0') {
turn_off(state);
state = MAIN_S;
} else if (action == 'p') {
state = PWR_S;
} else if (action == 'g') {
state = GPIO_S;
} else if (action == 's') {
int16_t rssi = radio.readRSSI();
Serial.print("rssi: ");
Serial.println(rssi);
} else if (action == 'i') {
int16_t vssi = radio.readVSSI();
Serial.print("vssi: ");
Serial.println(vssi);
}
Serial.println(action);
}
Serial.flush();
print_menu();
}
}
void turn_off(int dev) {
switch (dev) {
case RX_S:
radio.setRX(0);
break;
case TX_S:
radio.setTX(0);
break;
case UHF_S:
radio.setGpioMode(3, 3); // set GPIO3 high (uhf is active low)
break;
case VHF_S:
radio.setGpioMode(2, 3); // set GPIO2 high (vhf is active low)
break;
default:
break;
}
}
void turn_on(int dev) {
switch (dev) {
case RX_S:
radio.setRX(1);
break;
case TX_S:
radio.setTX(1);
break;
case UHF_S:
radio.setGpioMode(3, 2); // set GPIO3 low (uhf is active low)
break;
case VHF_S:
radio.setGpioMode(2, 2); // set GPIO2 low (uhf is active low)
break;
default:
break;
}
}
void print_menu() {
Serial.println("MENU");
switch (state) {
case MAIN_S:
Serial.println("select step: [r]x, [t]x, [f]req, [u]hf, [v]hf, [p]wr, [g]pio control, r[s]si, vss[i] ...");
break;
case RX_S:
Serial.println("enter 1 to turn on rx, 0 to turn off rx");
break;
case TX_S:
Serial.println("enter 1 to turn on tx, 0 to turn off tx");
break;
case FREQ_S:
Serial.println("enter frequency in kHz (ffffff)");
break;
case UHF_S:
Serial.println("enter 1 to turn on uhf, 0 to turn off uhf");
break;
case VHF_S:
Serial.println("enter 1 to turn on vhf, 0 to turn off vhf");
break;
case PWR_S:
Serial.println("enter power (raw) (ppp)");
break;
case GPIO_S:
Serial.println("enter GPIO pin and control (no spaces, eg pin 1 mode 3 is 13");
Serial.println("modes 0 - HiZ, 1 - FCN, 2 - Low, 3 - Hi");
break;
default:
state = MAIN_S;
break;
}
}

View File

@@ -1,95 +0,0 @@
/*
Indentifier
Arduino audio overlay example
*/
#include <HamShield.h>
#define DOT 100
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
const char *bascii = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,?'!/()&:;=+-_\"$@",
*bitu[] = { ".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","-----",".----","..---","...--","....-",".....","-....","--...","---..","----.",".-.-.-","--..--","..--..",".----.","-.-.--","-..-.","-.--.","-.--.-",".-...","---...","-.-.-.","-...-",".-.-.","-....-","..--.-",".-..-.","...-..-",".--.-."
};
const char *callsign = {"1ZZ9ZZ/B"} ;
char morsebuffer[8];
void setup() {
// NOTE: if not using PWM out, it should be held low to avoid tx noise
pinMode(PWM_PIN, OUTPUT);
digitalWrite(PWM_PIN, LOW);
// prep the switch
pinMode(SWITCH_PIN, INPUT_PULLUP);
// set up the reset control pin
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
Serial.begin(9600);
Serial.println("starting up..");
Serial.print("Radio status: ");
int result = radio.testConnection();
Serial.println(result,DEC);
radio.initialize();
radio.frequency(446000);
radio.setVolume1(0xF);
radio.setVolume2(0xF);
radio.setModeReceive();
radio.setTxSourceMic();
radio.setSQLoThresh(80);
radio.setSQOn();
Serial.println("Done with radio beacon setup. Press and hold a key to transmit.");
}
int state = 0;
long timer = 0;
int morseletter = 0;
int morsesymbol = 0;
long keyer = 0;
char symbol;
void loop() {
if(Serial.available() > 0) {
if(state == 0) {
state = 10;
radio.setModeTransmit();
timer = millis();
keyer = millis();
}
if(state == 10) {
timer = millis();
}
}
if(millis() > (timer + 500)) { radio.setModeReceive(); morseletter = 0; morsesymbol = 0; state = 0; }
if(state == 10) {
if(millis() > (keyer + (DOT * 3))) {
keyer = millis();
symbol = lookup(callsign[morseletter],morsesymbol);
if(symbol == '-') { tone(9,1000,DOT*3); }
if(symbol == '.') { tone(9,1000,DOT); }
if(symbol == 0) { morsesymbol = 0; morseletter++; }
if(callsign[morseletter] == 0) { morsesymbol = 0; morseletter = 0; }
}
}
}
char lookup(char letter, int morsesymbol) {
for(int x = 0; x < 54; x++) {
if(letter == bascii[x]) {
return bitu[x][morsesymbol];
}
}
}

View File

@@ -4,9 +4,10 @@
* will check to see if the channel is clear before it will * will check to see if the channel is clear before it will
* transmit. * transmit.
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall power and then * into the HamShield RF jack. Connect the Arduino to wall
* to your computer via USB. To test, set a HandyTalkie * power and then to your computer via USB. To test, set a
* to 438MHz. You should hear a one-minute tone every 10-13 minutes. * HandyTalkie to 438MHz. You should hear a one-minute tone
* followed by a callsign every 10-13 minutes.
*/ */
#include <HamShield.h> #include <HamShield.h>

View File

@@ -6,7 +6,7 @@
* into the HamShield RF jack. Plug a pair of headphones into * into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then * the HamShield. Connect the Arduino to wall power and then
* to your computer via USB. After uploading this program to * to your computer via USB. After uploading this program to
* your adruino, open the Serial Monitor. Serial Monitor will * your Arduino, open the Serial Monitor. Serial Monitor will
* describe what you should be expecting to hear from your * describe what you should be expecting to hear from your
* headphones. Tune a HandytTalkie to 446MHz to hear morse * headphones. Tune a HandytTalkie to 446MHz to hear morse
* code example. * code example.

View File

@@ -6,7 +6,7 @@
* into the HamShield RF jack. Plug a pair of headphones into * into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then * the HamShield. Connect the Arduino to wall power and then
* to your computer via USB. After uploading this program to * to your computer via USB. After uploading this program to
* your adruino, open the Serial Monitor. You will see a * your Arduino, open the Serial Monitor. You will see a
* repeating display of different signal strengths. Ex: * repeating display of different signal strengths. Ex:
* *
* [....|....] -73 * [....|....] -73

View File

@@ -1,60 +0,0 @@
/* Hamshield
* Example: HAMBot
* Simple DTMF controlled HAM Radio Robot. You will need
* seperate DTMF equipment as well as robot for this
* example.
* Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading
* this program to your adruino, you can send commands from
* your DTMF equipment using the following list:
* '4' => turn robot left
* '6' => turn robot right
* '2' => move robot forward
* '5' => tell robot to send morse code identity
*/
#include <ArduinoRobot.h> // include the robot library
#include <HamShield.h>
#include <SPI.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
void setup() {
// NOTE: if not using PWM out, it should be held low to avoid tx noise
pinMode(PWM_PIN, OUTPUT);
digitalWrite(PWM_PIN, LOW);
// prep the switch
pinMode(SWITCH_PIN, INPUT_PULLUP);
// set up the reset control pin
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
Robot.begin();
radio.initialize();
radio.frequency(145510);
}
void loop() {
if(radio.waitForDTMF()) { // wait for a received DTMF tone
uint8_t command = radio.getLastDTMFDigit(); // get the last DTMF tone sent
if(command == '4') { Robot.turn(-90); } // turn robot left
if(command == '6') { Robot.turn(90); } // turn robot right
if(command == '2') { Robot.motorsWrite(-255,-255); delay(500); Robot.motorsWrite(255, 255); } // move robot forward
if(command == '5') { // tell robot to send morse code identity
if(radio.waitForChannel()) { // wait for the user to release the transmit button
radio.setModeTransmit(); // turn on transmit mode
radio.morseOut("1ZZ9ZZ I AM HAMRADIO ROBOT"); // send morse code
radio.setModeReceive(); // go back to receive mode on radio
}
}
}
}

View File

@@ -6,7 +6,7 @@
* into the HamShield RF jack. Plug a pair of headphones into * into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then * the HamShield. Connect the Arduino to wall power and then
* to your computer via USB. After uploading this program to * to your computer via USB. After uploading this program to
* your adruino, open the Serial Monitor. Press the button on * your Arduino, open the Serial Monitor. Press the button on
* the HamShield to begin setup. After setup is complete, type * the HamShield to begin setup. After setup is complete, type
* your desired Tx/Rx frequency, in hertz, into the bar at the * your desired Tx/Rx frequency, in hertz, into the bar at the
* top of the Serial Monitor and click the "Send" button. * top of the Serial Monitor and click the "Send" button.

View File

@@ -5,7 +5,7 @@
* into the HamShield RF jack. Plug a pair of headphones with * into the HamShield RF jack. Plug a pair of headphones with
* built-in mic into the HamShield. Connect the Arduino to * built-in mic into the HamShield. Connect the Arduino to
* wall power and then to your computer via USB. After * wall power and then to your computer via USB. After
* uploading this program to your adruino, open the Serial * uploading this program to your Arduino, open the Serial
* Monitor to monitor the program's progress. After setup is * Monitor to monitor the program's progress. After setup is
* complete, tune a HandyTalkie (HT) to 144.025MHz. Listen on * complete, tune a HandyTalkie (HT) to 144.025MHz. Listen on
* the HT for the HamShield broadcasting from the mic. * the HT for the HamShield broadcasting from the mic.

View File

@@ -18,7 +18,6 @@ DDS dds;
KISS kiss(&Serial, &radio, &dds); KISS kiss(&Serial, &radio, &dds);
AFSK afsk; AFSK afsk;
//TODO: move these into library
#define PWM_PIN 3 #define PWM_PIN 3
#define RESET_PIN A3 #define RESET_PIN A3
#define SWITCH_PIN 2 #define SWITCH_PIN 2
@@ -45,7 +44,6 @@ void setup() {
radio.initialize(); radio.initialize();
radio.setSQOff(); radio.setSQOff();
radio.frequency(144390); radio.frequency(144390);
//I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x44, 0x05FF);
dds.start(); dds.start();
afsk.start(&dds); afsk.start(&dds);

View File

@@ -5,7 +5,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, tune a PSK31 receiver and * this program to your Arduino, tune a PSK31 receiver and
* wait to receive the message "Why hello there, friend. * wait to receive the message "Why hello there, friend.
* Nice to meet you. Welcome to PSK31. 73, VE6SLP sk" * Nice to meet you. Welcome to PSK31. 73, VE6SLP sk"
*/ */

View File

@@ -1,131 +0,0 @@
/* Hamshield
* Example: Parrot
* Record sound and then plays it back a few times. Very low
* sound quality @ 2KHz 0.75 seconds. A bit robotic and weird.
* You will need a HandyTalkie (HT) to test the output of this
* example.
* Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then to
* your computer via USB. To test the output, tune you HT to
* 446MHz. The HamShield should make a recording ofthe next
* broadcast on that frequncy. The recording should then be
* repeated ten times by the HamShield.
*/
#include <HamShield.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
#define RATE 500
#define SIZE 1500
HamShield radio;
char sound[SIZE];
unsigned int sample1;
int x = -1;
int16_t rssi;
byte mode = 8;
void setup() {
// NOTE: if not using PWM out, it should be held low to avoid tx noise
pinMode(PWM_PIN, OUTPUT);
digitalWrite(PWM_PIN, LOW);
// prep the switch
pinMode(SWITCH_PIN, INPUT_PULLUP);
// set up the reset control pin
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
// int result = radio.testConnection();
radio.initialize();
radio.frequency(446000);
setPwmFrequency(9, 1);
}
void loop() {
rssi = radio.readRSSI();
if(rssi > -100) {
if(x == -1) {
for(x = 0; x < SIZE; x++) {
if(mode == 4) {
sample1 = analogRead(2);
sound[x] = sample1 >> 4;
delayMicroseconds(RATE); x++;
sample1 = analogRead(2);
sound[x] = (sample1 & 0xF0) | sound[x];
delayMicroseconds(RATE);
} else {
sound[x] = analogRead(2);
delayMicroseconds(RATE); x++;
sound[x] = analogRead(2);
delayMicroseconds(RATE);
}
}
}
}
if(rssi < -100) {
if(x == 1500) {
radio.setModeTransmit();
delay(500);
tone(9,1000,500); delay(750);
for(int r = 0; r < 10; r++) {
for(x = 0; x < SIZE; x++) {
if(mode == 4) {
analogWrite(9,sound[x] << 4);
delayMicroseconds(RATE); x++;
analogWrite(9,sound[x] & 0xF);
delayMicroseconds(RATE); } else {
analogWrite(9,sound[x]);
delayMicroseconds(RATE); x++;
analogWrite(9,sound[x]);
delayMicroseconds(RATE);
}
} }
tone(9,1000,500); delay(750);
radio.setModeReceive();
x = -1;
}
}
}
void setPwmFrequency(int pin, int divisor) {
byte mode;
if(pin == 5 || pin == 6 || pin == 9 || pin == 10) {
switch(divisor) {
case 1: mode = 0x01; break;
case 8: mode = 0x02; break;
case 64: mode = 0x03; break;
case 256: mode = 0x04; break;
case 1024: mode = 0x05; break;
default: return;
}
if(pin == 5 || pin == 6) {
TCCR0B = TCCR0B & 0b11111000 | mode;
} else {
TCCR1B = TCCR1B & 0b11111000 | mode;
}
} else if(pin == 3 || pin == 11) {
switch(divisor) {
case 1: mode = 0x01; break;
case 8: mode = 0x02; break;
case 32: mode = 0x03; break;
case 64: mode = 0x04; break;
case 128: mode = 0x05; break;
case 256: mode = 0x06; break;
case 1024: mode = 0x7; break;
default: return;
}
TCCR2B = TCCR2B & 0b11111000 | mode;
}
}

View File

@@ -5,7 +5,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, tune a QPSK63 receiver and * this program to your Arduino, tune a QPSK63 receiver and
* wait to receive the message "Why hello there, friend. * wait to receive the message "Why hello there, friend.
* Nice to meet you. Welcome to QPSK63. 73, VE6SLP sk" * Nice to meet you. Welcome to QPSK63. 73, VE6SLP sk"
*/ */

View File

@@ -5,7 +5,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, open the Serial Monitor to * this program to your Arduino, open the Serial Monitor to
* view the status of the program. Tune your SSTV to * view the status of the program. Tune your SSTV to
* 446MHz to receive the image output. * 446MHz to receive the image output.
*/ */

View File

@@ -5,7 +5,7 @@
* Connect the HamShield to your Arduino. Screw the antenna * Connect the HamShield to your Arduino. Screw the antenna
* into the HamShield RF jack. Connect the Arduino to wall * into the HamShield RF jack. Connect the Arduino to wall
* power and then to your computer via USB. After uploading * power and then to your computer via USB. After uploading
* this program to your adruino, open the Serial Monitor to * this program to your Arduino, open the Serial Monitor to
* view the status of the program. Tune your SSTV to * view the status of the program. Tune your SSTV to
* 145.5MHz to receive the image output. * 145.5MHz to receive the image output.
*/ */

View File

@@ -6,7 +6,7 @@
* into the HamShield RF jack. Plug a pair of headphones into * into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then * the HamShield. Connect the Arduino to wall power and then
* to your computer via USB. After uploading this program to * to your computer via USB. After uploading this program to
* your adruino, open the Serial Monitor. Use the bar at the * your Arduino, open the Serial Monitor. Use the bar at the
* top of the serial monitor to enter commands as seen below. * top of the serial monitor to enter commands as seen below.
* *
* EXAMPLE: To change the repeater offset to 144.425MHz, * EXAMPLE: To change the repeater offset to 144.425MHz,
@@ -21,28 +21,14 @@ Mode ASCII Description
-------------- ----------- -------------------------------------------------------------------------------------------------------------------------------------------- ----------------- -------------- ----------- -------------------------------------------------------------------------------------------------------------------------------------------- -----------------
Transmit space Space must be received at least every 500 mS Yes Transmit space Space must be received at least every 500 mS Yes
Receive not space If space is not received and/or 500 mS timeout of space occurs, unit will go into receive mode Yes Receive not space If space is not received and/or 500 mS timeout of space occurs, unit will go into receive mode Yes
CTCSS In A<tone>; <tone> must be a numerical ascii value with decimal point indicating CTCSS receive tone required to unsquelch No
CTCSS Out B<tone>; <tone> must be a numerical ascii value with decimal point indicating CTCSS transmit tone No
CTCSS Enable C<state>; Turns on CTCSS mode (analog tone) with 1, off with 0. No
CDCSS Enable D<state>; Turns on CDCSS mode (digital tone) with 1, off with 0. No
Bandwidth E<mode>; for 12.5KHz mode is 0, for 25KHz, mode is 1 No Bandwidth E<mode>; for 12.5KHz mode is 0, for 25KHz, mode is 1 No
Frequency F<freq>; Set the receive frequency in KHz, if offset is disabled, this is the transmit frequency No Frequency F<freq>; Set the receive frequency in KHz, if offset is disabled, this is the transmit frequency No
CDCSS In G<code>; <code> must be a valid CDCSS code No
CDCSS Out H<code>; <code> must be a valid CDCSS code No
Print tones I Prints out all configured tones and codes, coma delimited in format: CTCSS In, CTCSS Out, CDCSS In, CDCSS Out No
Morse Out M<text>; A small buffer for morse code (32 chars) Morse Out M<text>; A small buffer for morse code (32 chars)
Power level P<level>; Set the power amp level, 0 = lowest, 15 = highest No Power level P<level>; Set the power amp level, 0 = lowest, 15 = highest No
Enable Offset R<state>; 1 turns on repeater offset mode, 0 turns off repeater offset mode No Enable Offset R<state>; 1 turns on repeater offset mode, 0 turns off repeater offset mode No
Squelch S<level>; Set the squelch level No Squelch S<level>; Set the squelch level No
TX Offset T<freq>; The absolute frequency of the repeater offset to transmit on in KHz No TX Offset T<freq>; The absolute frequency of the repeater offset to transmit on in KHz No
Volume V<level>; Set the volume level of the receiver No
Reset X Reset all settings to default No
Sleep Z Sleep radio No
Filters @<state>; Set bit to enable, clear bit to disable: 0 = pre/de-emphasis, 1 = high pass filter, 2 = low pass filter (default: ascii 7, all enabled) No
Vox mode $<state>; 0 = vox off, >= 1 audio sensitivity. lower value more sensitive No
Mic Channel *<state>; Set the voice channel. 0 = signal from mic or arduino, 1 = internal tone generator No
RSSI ? Respond with the current receive level in - dBm (no sign provided on numerical response) No RSSI ? Respond with the current receive level in - dBm (no sign provided on numerical response) No
Tone Gen % (notes) To send a tone, use the following format: Single tone: %1,<freq>,<length>; Dual tone: %2,<freq>,<freq>,<length>; DTMF: %3,<key>,<length>; No
Voice Level ^ Respond with the current voice level (VSSI) Voice Level ^ Respond with the current voice level (VSSI)

View File

@@ -9,7 +9,7 @@
* into the HamShield RF jack. Plug a pair of headphones into * into the HamShield RF jack. Plug a pair of headphones into
* the HamShield. Connect the Arduino to wall power and then * the HamShield. Connect the Arduino to wall power and then
* to your computer via USB. After uploading this program to * to your computer via USB. After uploading this program to
* your adruino, open the Serial Monitor. HamShield will print * your Arduino, open the Serial Monitor. HamShield will print
* the results of its signal test to the Serial Monitor. To * the results of its signal test to the Serial Monitor. To
* test with another HandyTalkie (HT), tune in to 446MHz and * test with another HandyTalkie (HT), tune in to 446MHz and
* listen for the call sign. Then key up on your HT and make * listen for the call sign. Then key up on your HT and make