This project shows how to form a light impulses using an ATtiny13 to transmit messages encoded with International Morse Code. Project is easy to build and require only three parts. The code is on Github, click here.
Morse Code allow to transmit data via short (dots) and long (dashes) impulsions. The advantage of the Morse Code lies in its simplicity and its universality. In fact the impulsions that allows the data to be transmitted could be sound signals, light signals or radio signals. You could transmit data with every way that allow you to produce recognizable impulsions.
International Morse Code Character Table
This table is the character chart for the code that is recognized as the International Morse Code. You may wish to see more information here – http://www.itu.int/rec/R-REC-M.1677-1-200910-I/
CHARACTER | CODE |
---|---|
A | . – |
B | – . . . |
C | – . – . |
D | – . . |
E | . |
F | . . – . |
G | – – . |
H | . . . . |
I | . . |
J | . – – – |
K | – . – |
L | . – . . |
M | – – |
N | – . |
O | – – – |
P | . – – . |
Q | – – . – |
R | . – . |
S | . . . |
T | – |
U | . . – |
V | . . . – |
W | . – – |
X | – . . – |
Y | – . – – |
Z | – – . . |
FIGURE | CODE |
---|---|
0 | – – – – – |
1 | . – – – – |
2 | . . – – – |
3 | . . . – – |
4 | . . . . – |
5 | . . . . . |
6 | – . . . . |
7 | – – . . . |
8 | – – – . . |
9 | – – – – . |
Parts
- ATtiny13 – i.e. MBAVR-1 development board
- Resistor – 220Ω, see LED Resistor Calculator
- LED
Circuit Diagram
Firmware
This code is written in C and can be compiled using the avr-gcc. More details on how compile this project is here. Complete example code is on GitHub.
/** * Copyright (c) 2016, Łukasz Marcin Podkalicki <lpodkalicki@gmail.com> * ATtiny13/022 * Morse Code Beacon - flashing light. * -- * Settings: * FUSE_L=0x6A * FUSE_H=0xFF * F_CPU=1200000 */ #include <avr/io.h> #include "morsecode.h" #define LED_PIN PB0 int main(void) { /* setup */ DDRB = _BV(LED_PIN); // set LED pin as OUTPUT /* loop */ while (1) { MORSECODE_puts("SOS"); } } void MORSECODE_signal_on(void) { PORTB |= _BV(LED_PIN); } void MORSECODE_signal_off(void) { PORTB &= ~_BV(LED_PIN); }
Spaces are not transmitted correctly. For example, the string “Hello World” results in “Hello oWorld”. It can be fixed replacing:
xmit(buffer);
with:
if (c != ‘ ‘) {
xmit(buffer);
}
Thanks for this great projects Łukasz! Keep going!
Morse codes in table appeared to be wrong. It looks like wordpress converts two dashes to en dashe (–) and three dashes to em dash (—).
Junaid, you’re right. I fixed it. Thank you!
/L