Components and supplies
Capacitor 100 nF
Capacitor 100 µF
Jumper wires (generic)
Toggle Switch, Toggle
Relay (generic)
External handset/mic plug for your amateur radio
Arduino UNO
LED (generic)
Tools and machines
Solder Wire, Lead Free
Amateur Radio
Soldering iron (generic)
Project description
Code
Fox Hunting Radio Keyer
arduino
The Arduino that keys up the radio to transmit and sends the Morse code to identify itself.
1/*By Nelson Farrier 2 Key up radio and send tone 3 Keys up Baofeng UV-3R radio by turning on and off the relay, then ID's and and sends a 5 second tone. 4 */ 5 6// Pin 12 is connected to a relay. 7// Pin 13 is connected to a tone circuit. 8 9// modified from: Mike Myers (http://mikemyers.me) @netnutmike 10// Let's Make It Episode 6 (http://tech-zen.tv/index.php/shows/let-s-make-it/episodes/59-sensor-fun-with-arduino-1-massive-failure-but-4-successes-let-s-make-it-episode-6) 11// define the morse code for the alphabet and numbers 12 13char* letters[] = { 14 ".-", // A 15 "-...", // B 16 "-.-.", // C 17 "-..", // D 18 ".", // E 19 "..-.", // F 20 "--.", // G 21 "....", // H 22 "..", // I 23 ".---", // J 24 "-.-", // K 25 ".-..", // L 26 "--", // M 27 "-.", // N 28 "---", // O 29 ".--.", // P 30 "--.-", // Q 31 ".-.", // R 32 "...", // S 33 "-", // T 34 "..-", // U 35 "...-", // V 36 ".--", // W 37 "-..-", // X 38 "-.--", // Y 39 "--.." // Z 40}; 41 42char* numbers[] = { 43 "-----", // 0 44 ".----", // 1 45 "..---", // 2 46 "...--", // 3 47 "....-", // 4 48 ".....", // 5 49 "-....", // 6 50 "--...", // 7 51 "---..", // 8 52 "----." // 9 --- end of 1st segment of borrowed code from Mike Myers 53}; 54 55int relay = 12; 56int TonePin = 13; 57int frequency = 1000; // frequency of tone 58 59int dotDelay = 70; // duration of the dot in morse code, this is also the time between the dots and dashes 60int charDelay = 500; // duration of the wait between letters for Farsnworth method 61int wordDelay = 1100; // duration of the wait between words for Farsnworth method 62int cycleDelay = 15000; // HALF the duration because the largest value is 16383 63 64// the setup routine runs once when you press reset: 65void setup() { 66 // initialize the digital pin as an output. 67 pinMode(12, OUTPUT); 68 pinMode(13, OUTPUT); 69 delay(2000); // initial delay after powering on 70} 71 72// the loop routine runs over and over again forever: 73void loop() { 74 digitalWrite(relay, HIGH); // turn the relay on (HIGH is the voltage level) 75 delay(1000); // wait for a second 76 77 SendText("NF7Z FOX"); 78 79 delay(1000); // wait for a second 80 81 tone(TonePin, frequency); // send 7 sec tone 82 delay(7000); 83 noTone(TonePin); 84 85 delay(10000); // 10 seconds transmit w/o tone 86 87 digitalWrite(relay, LOW); // turn the relay off by making the voltage LOW 88 89 delay(cycleDelay); // wait for cycle time (because the largest value is 16383) 90 delay(cycleDelay); // wait for cycle time 91} 92 93//================================================================= 94// 95// modified from: Mike Myers (http://mikemyers.me) @netnutmike 96// Function: morseCodeSequence 97// 98// Input: Character Array of Dots and Dashes to be sent 99// 100// Description: 101// This function takes as input an array or "." and "-" and 102// calls dotOrDash for each item in the array. 103// 104// At the end of the sequence, there is a delay of 3 times 105// the dot duration. 106//================================================================= 107 108void morseCodeSequence(char* sequence) 109{ 110 int i = 0; 111 112 // Loop for each element in the array 113 while (sequence[i] != NULL) 114 { 115 dotOrDash(sequence[i]); // Send out the dot or dash 116 i++; // Increment to the next element in the array 117 } 118 delay(charDelay); // gap between letters 119} 120//================================================================= 121// 122// Function: SendText 123// 124// Input: Character Array of text in English 125// 126// Description: 127// This function takes text as input and sends Morse code for each letter. 128// There then is a pause after each letter. 129// 130//================================================================= 131 132void SendText(char* MorseCodeLetters) 133{ 134 int i = 0; 135 char ch; 136 137 // Loop for each element in the array 138 while (MorseCodeLetters[i] != NULL) 139 { 140 ch = MorseCodeLetters[i]; 141 // Is it lowercase letter? 142 if (ch >= 'a' && ch <= 'z') 143 { 144 morseCodeSequence(letters[ch - 'a']); 145 } 146 else if (ch >= 'A' && ch <= 'Z') // Uppercase Letter 147 { 148 morseCodeSequence(letters[ch - 'A']); 149 } 150 else if (ch >= '0' && ch <= '9') // Number 151 { 152 morseCodeSequence(numbers[ch - '0']); 153 } 154 else if (ch == ' ') // Space (wait for 4 times dotDelay 155 { 156 delay(wordDelay); // gap between words 157 } 158 else { 159 } 160 i++; // Increment to the next element in the array 161 } 162 delay(charDelay); // gap between letters 163} 164 165//================================================================= 166// 167// Function: dorOrDash 168// 169// modified from: Mike Myers (http://mikemyers.me) @netnutmike 170// Input: Character that should be either a dot or a dash 171// 172// Description: 173// This function first turns on the output then looks to see 174// if the character is a "." and if so delays the dotDelay. 175// 176// If the character is not a "." then the routine assumes it 177// is a "-" and keep the output high for 3 times the length of 178// dotDelay. This could be improved by making sure the 179// character is a "-" but for most cases it would not matter. 180// 181// After the delay time the pin is taken low turning off the 182// tone. 183// 184// Then it delays for one dotDelay time so the dots and dashes 185// do not run together. 186//================================================================= 187 188void dotOrDash(char dotOrDash) 189{ 190 tone(TonePin, frequency); 191 if (dotOrDash == '.') 192 { 193 delay(dotDelay); 194 } 195 else // must be a - 196 { 197 delay(dotDelay * 3); 198 } 199 noTone(TonePin); 200 delay(dotDelay); // gap between flashes 201} 202
Fox Hunting Radio Keyer
arduino
The Arduino that keys up the radio to transmit and sends the Morse code to identify itself.
1/*By Nelson Farrier 2 Key up radio and send tone 3 Keys up Baofeng 4 UV-3R radio by turning on and off the relay, then ID's and and sends a 5 second 5 tone. 6 */ 7 8// Pin 12 is connected to a relay. 9// Pin 13 is connected 10 to a tone circuit. 11 12// modified from: Mike Myers (http://mikemyers.me) @netnutmike 13// 14 Let's Make It Episode 6 (http://tech-zen.tv/index.php/shows/let-s-make-it/episodes/59-sensor-fun-with-arduino-1-massive-failure-but-4-successes-let-s-make-it-episode-6) 15// 16 define the morse code for the alphabet and numbers 17 18char* letters[] = { 19 20 ".-", // A 21 "-...", // B 22 "-.-.", // C 23 "-..", // 24 D 25 ".", // E 26 "..-.", // F 27 "--.", // G 28 "....", 29 // H 30 "..", // I 31 ".---", // J 32 "-.-", // K 33 ".-..", 34 // L 35 "--", // M 36 "-.", // N 37 "---", // O 38 ".--.", 39 // P 40 "--.-", // Q 41 ".-.", // R 42 "...", // S 43 "-", 44 // T 45 "..-", // U 46 "...-", // V 47 ".--", // W 48 49 "-..-", // X 50 "-.--", // Y 51 "--.." // Z 52}; 53 54char* 55 numbers[] = { 56 "-----", // 0 57 ".----", // 1 58 "..---", // 59 2 60 "...--", // 3 61 "....-", // 4 62 ".....", // 5 63 "-....", 64 // 6 65 "--...", // 7 66 "---..", // 8 67 "----." // 9 --- 68 end of 1st segment of borrowed code from Mike Myers 69}; 70 71int relay = 12; 72int 73 TonePin = 13; 74int frequency = 1000; // frequency of tone 75 76int dotDelay 77 = 70; // duration of the dot in morse code, this is also the time between the 78 dots and dashes 79int charDelay = 500; // duration of the wait between letters 80 for Farsnworth method 81int wordDelay = 1100; // duration of the wait between 82 words for Farsnworth method 83int cycleDelay = 15000; // HALF the duration because 84 the largest value is 16383 85 86// the setup routine runs once when you press 87 reset: 88void setup() { 89 // initialize the digital pin as an 90 output. 91 pinMode(12, OUTPUT); 92 pinMode(13, OUTPUT); 93 delay(2000); 94 // initial delay after powering on 95} 96 97// the loop routine runs over and 98 over again forever: 99void loop() { 100 digitalWrite(relay, HIGH); // turn the 101 relay on (HIGH is the voltage level) 102 delay(1000); // wait for 103 a second 104 105 SendText("NF7Z FOX"); 106 107 delay(1000); // 108 wait for a second 109 110 tone(TonePin, frequency); // send 7 sec tone 111 delay(7000); 112 113 noTone(TonePin); 114 115 delay(10000); // 10 seconds transmit 116 w/o tone 117 118 digitalWrite(relay, LOW); // turn the relay off by making the 119 voltage LOW 120 121 delay(cycleDelay); // wait for cycle time (because 122 the largest value is 16383) 123 delay(cycleDelay); // wait for cycle 124 time 125} 126 127//================================================================= 128// 129// 130 modified from: Mike Myers (http://mikemyers.me) @netnutmike 131// Function: morseCodeSequence 132// 133// 134 Input: Character Array of Dots and Dashes to be sent 135// 136// Description: 137// 138 This function takes as input an array or "." and "-" and 139// calls 140 dotOrDash for each item in the array. 141// 142// At the end of the sequence, 143 there is a delay of 3 times 144// the dot duration. 145//================================================================= 146 147void 148 morseCodeSequence(char* sequence) 149{ 150 int i = 0; 151 152 // Loop for each 153 element in the array 154 while (sequence[i] != NULL) 155 { 156 dotOrDash(sequence[i]); 157 // Send out the dot or dash 158 i++; // Increment 159 to the next element in the array 160 } 161 delay(charDelay); // gap 162 between letters 163} 164//================================================================= 165// 166// 167 Function: SendText 168// 169// Input: Character Array of text in English 170// 171// 172 Description: 173// This function takes text as input and sends Morse code for 174 each letter. 175// There then is a pause after each letter. 176// 177//================================================================= 178 179void 180 SendText(char* MorseCodeLetters) 181{ 182 int i = 0; 183 char ch; 184 185 // 186 Loop for each element in the array 187 while (MorseCodeLetters[i] != NULL) 188 189 { 190 ch = MorseCodeLetters[i]; 191 // Is it lowercase letter? 192 if 193 (ch >= 'a' && ch <= 'z') 194 { 195 morseCodeSequence(letters[ch - 'a']); 196 197 } 198 else if (ch >= 'A' && ch <= 'Z') // Uppercase Letter 199 { 200 201 morseCodeSequence(letters[ch - 'A']); 202 } 203 else if (ch >= '0' && 204 ch <= '9') // Number 205 { 206 morseCodeSequence(numbers[ch - '0']); 207 208 } 209 else if (ch == ' ') // Space (wait for 4 times dotDelay 210 211 { 212 delay(wordDelay); // gap between words 213 } 214 else 215 { 216 } 217 i++; // Increment to the next element in the array 218 219 } 220 delay(charDelay); // gap between letters 221} 222 223//================================================================= 224// 225// 226 Function: dorOrDash 227// 228// modified from: Mike Myers (http://mikemyers.me) 229 @netnutmike 230// Input: Character that should be either a dot or a dash 231// 232// 233 Description: 234// This function first turns on the output then looks to see 235 236// if the character is a "." and if so delays the dotDelay. 237// 238// 239 If the character is not a "." then the routine assumes it 240// is 241 a "-" and keep the output high for 3 times the length of 242// dotDelay. 243 This could be improved by making sure the 244// character is a "-" but 245 for most cases it would not matter. 246// 247// After the delay time the pin 248 is taken low turning off the 249// tone. 250// 251// Then it delays for 252 one dotDelay time so the dots and dashes 253// do not run together. 254//================================================================= 255 256void 257 dotOrDash(char dotOrDash) 258{ 259 tone(TonePin, frequency); 260 if (dotOrDash 261 == '.') 262 { 263 delay(dotDelay); 264 } 265 else // must be a 266 - 267 { 268 delay(dotDelay * 3); 269 } 270 noTone(TonePin); 271 272 delay(dotDelay); // gap between flashes 273} 274
Downloadable files
Schematic for the fox hunt radio's keyer
Schematic for the fox hunt radio's keyer
Comments
Only logged in users can leave comments
nfarrier
0 Followers
•0 Projects
Table of contents
Intro
10
0