Inspired by this, I decided to build a morse transmitter and add some cool features to it.
This project show how to build a little morse transmitter using an MSP430G2231 MCU.
The device can transmit in two modes:
- serial, getting the characters from a COM port and translating them into morse code;
- manual, using the key switch.
In serial mode, one character at a time is read from the COM port and transmitted as morse at 15 WPM. To better understand how morse code works, read this .
Morse keying is achieved toggling an output pin connected to the oscillator power pin, thus getting a pure CW mode.
The device is powered with 2xAA batteries, and the power consumption is kept to a minimum thanks to the Low Power Mode when not transmitting. You may add a second 4xAA supply for the octal buffer in order to increase RF power.
Step 1: BOM & Tools Needed
Here's what you'll need to build this project:
- 1x MSP430G2231 Texas Instruments MCU
- 1x 74HC240 Octal buffer
- 1x Oscillator (operating frequency should be in the 10/12m CW band (24/28 MHz))
- 2x 220 ohm resistors
- 2x 1 kohm resistors
- 2x LED (different colors are better)
- 2 push-buttons (included in the Launchpad, you may want to use a better switch for morse keying)
- 2 AA batteries (you may want to use a separate 6V (4AA) supply for 74HC240)
- 1m electrical wire (9 AWG)
- soldering iron
- wire stripper
- breadboard or stripboard
- TI's Launchpad board
- mini-usb cable
Step 2: Hardware & Schematic
As you can see from the schematic, the MCU is used to toggle power to the oscilator, in order to make the ON-OFF modulation needed in morse coding.
The oscillator's output is then fed to the octal buffer; the amplified signal is the transmitted via the long wire antenna.
LED1 will indicate the operation mode (Serial or Manual) , LED2 will indicate whether the device is transmitting or not.
With a first pressure of KEY switch, the device will enter manual mode: further presses will transmit morse code, as a normal morse key.
To get back to serial mode, just press RST button.
You may build this very easily on a breadboard and use the Lauchpad only to program and host the MCU (altought it may be a bit too noisy).
As you can see from the photos, I've built a sort of shield for the Lauchpad with male headers, but a future build will surely be on a PCB.
Step 3: Software
The program cycles indefinitely until a character is received on the UART, then encodes it into morse, executes the combinations of dots and dashes on the output pin and finally echoes back the character.
The code is pretty well commented, so you shouldn't find much problems understanding it.
The hard part came when I needed to build a lookup table for the morse code, as there's no known algorithm capable of encoding a character directly into morse. I had to use some defines and combinations of dots and dashes in order to fit the table in the 512 bytes of RAM of the G2231.
Part of this code is based on NJC's "Half Duplex SW UART on Launchpad" tutorial , read it to better understand how serial communications works on the MSP430.
Step 4: Video Demo
The MSP430 communicates with the Putty terminal via USB thanks to the serial converter built into the Launchpad.
As you can see I type characters on the serial terminal and they get transmitted as morse code
(I know I'm out of band, but I only had a 24 Mhz oscillator lying around).
There's a little delay between typing and the sound because I'm using Globaltuners as I can't still afford a real radio receiver :) .
I'm at about 2km from the location of the receiver in the video.
Step 5: Conclusions
There is much to improve in this project.
In a future build i will make a little PCB to fit it in a nice box.
Surely I'll change the oscillator with one with a legal frequency.
I'll also try to improve the antenna and minimize electrical noise to get a perfect tone.
On the software side, I'll try to add a buffer for the serial communication and improve the bandwidth. Another thing to change is the delay-driven toggling: hopefully with better MSP430 Value Line devices incoming I'll try to add timer interrupts for this.
I hope you enjoy building and testing this project as much as I've done.
For other porjects and tutorials, check out my blog.
Good luck and 73s!