Last edited: 2.3.2022
My local radio amateur club asked for at little design to show the call sign – OZ7RD – of the club in Morse.
It sends a 30 sec “beacon” with output on and speaker off, then sends the callsign in Morse to the output and the speaker.
It is aimed to power a large 12V LED so the output has a MOSFET.
The board has a small blue LED and a speaker for demonstration use.
It is possible to adjust the Morse speed by two straps (JP1 and JP2), so the dot length can be made 80, 120, 160 or 200 msec.
JP3 is not used in the SW any more.
Another strap (JP4) selects if the speaker is wanted or not.
I made this in a little circuit with a ATtiny85 programmed in Arduino.
The ATtiny85 chip is programmed by a USBasp programmer.
Here is the prototype:
Here the schematic:
And here in PDF: Morse_t85_sch_211203
I made a board layout in Eagle and here is the PCB:
I got it made by AISLER in Holland, 3 pcs for 83 dkr, delivered in about 3 weeks:
An here the finished board:
And here the Arduino sketch:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
/* MORSE code translator 08.12.2021 with ATtiny85, Hans Harbeck */ String CallSign = "OZ7RD"; #define TONE #define Delay0 1000 // Delay before and after morse transmission #define Delay1 30000 // Output ON time (beacon 30 sec) // DOT length in msek, jumper definitions JP1-JP2, see schematic #define Speed0 200 // JP1 off, JP2 off #define Speed1 160 // JP1 on, JP2 off #define Speed2 120 // JP1 off, JP2 on #define Speed3 80 // JP1 on, JP2 on // ATtiny85 pin definitions #define LedPin 0 // pin 5 #define SpeakerPin 1 // pin 6 #define SpeedPin1 3 // pin 2, morse speed middle #define SpeedPin2 4 // pin 3, morse speed high #define DelayPin 2 // pin 7, delay off = 2 sec, on = 4 sec // +-\/-+ // Ain0 (D 5) PB5 1| |8 Vcc // Ain3 (D 3) PB3 2| |7 PB2 (D 2) Ain1 // Ain2 (D 4) PB4 3| |6 PB1 (D 1) pwm1 // GND 4| |5 PB0 (D 0) pwm0 // +----+ unsigned int dotDelay; // morse speed unsigned int pause; // delay between transmissions // se explanation af tone creation here: http://www.technoblogy.com/show?KVO //For letters char* letters[] = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", // A-I ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", // J-R "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.." // S-Z }; //For Numbers char* numbers[] = { "-----", ".----", "..---", "...--", "....-", // 0-4 ".....","-....", "--...", "---..", "----." // 5-9 }; void setup() { // ----------------------------------- pinMode(LedPin, OUTPUT); pinMode(SpeakerPin, OUTPUT); pinMode(SpeedPin1, INPUT_PULLUP); pinMode(SpeedPin2, INPUT_PULLUP); pinMode(DelayPin, INPUT_PULLUP); // not used CallSign.toUpperCase(); } void loop() { // ------------------------------------ bool Pin1 = digitalRead(SpeedPin1); bool Pin2 = digitalRead(SpeedPin2); if (Pin1 == 1 && Pin2 == 1) dotDelay = Speed0; if (Pin1 == 0 && Pin2 == 1) dotDelay = Speed1; if (Pin1 == 1 && Pin2 == 0) dotDelay = Speed2; if (Pin1 == 0 && Pin2 == 0) dotDelay = Speed3; // if (digitalRead(DelayPin)) pause = Delay1; // jumper off // else pause = Delay0; // jumper on char ch; for (byte i = 0; i < CallSign.length(); i++) { ch = CallSign[i]; if (ch >= 'A' && ch <= 'Z') flashSequence(letters[ch - 'A']); else if (ch >= '0' && ch <= '9') flashSequence(numbers[ch - '0']); else if (ch == ' ') delay(dotDelay * 4); } pause = Delay0; delay (pause); // delay between morse and beacon OutOn(0); pause = Delay1; delay (pause); // beacon time OutOff(); pause = Delay0; delay (pause); // delay between beacon and morse } // send one character void flashSequence(char* sequence) { byte i = 0; while (sequence[i] != 0) { flashDotOrDash(sequence[i]); i++; } delay(dotDelay * 3); } // send . or - void flashDotOrDash(char dotOrDash) { OutOn(1); if (dotOrDash == '.') delay(dotDelay); // . dot else delay(dotDelay * 3); // must be a - dash OutOff(); delay(dotDelay); } void OutOn (bool HT) { digitalWrite(LedPin, HIGH); #ifdef TONE if (HT) { TCCR1 = 0x90 | (3); // start playing a tone OCR1C = 141; // set the OCR } #else digitalWrite(SpeakerPin, HIGH); #endif } void OutOff () { digitalWrite(LedPin, LOW); #ifdef TONE TCCR1 = 0x90; // stop the tone counter #else digitalWrite(SpeakerPin, LOW); #endif } |