Morse Code Generator

- -   - - -   . - .   . . .   .       - . - .   - - -   - . .   .       - - .   .   - .   .   . - .   . -   -   - - -   . - .   . - . - . -

Overview

This project generates Morse code from input text. The input is entered in console using the keyboard, and read through the USB virtual COM port. The generated code is displayed on the console, and played on the speaker and the mbed built-in LED. The Morse code generator in this project follows the International Morse code Recommendation ITU-R M.1677-1.

Components

Hardware

  • Speaker (including a driver transistor and a 220-1k resistor)

Software

  • USB Virtual Serial Port Library

    Import library

    Public Member Functions

    Serial (PinName tx, PinName rx, const char *name=NULL)
    Create a Serial port, connected to the specified transmit and receive pins.
    void baud (int baudrate)
    Set the baud rate of the serial port.
    void format (int bits=8, Parity parity=SerialBase::None, int stop_bits=1)
    Set the transmission format used by the serial port.
    int readable ()
    Determine if there is a character available to read.
    int writeable ()
    Determine if there is space available to write a character.
    void attach (void(*fptr)(void), IrqType type=RxIrq)
    Attach a function to call whenever a serial interrupt is generated.
    template<typename T >
    void attach (T *tptr, void(T::*mptr)(void), IrqType type=RxIrq)
    Attach a member function to call whenever a serial interrupt is generated.
    void send_break ()
    Generate a break condition on the serial line.
    void set_flow_control (Flow type, PinName flow1=NC, PinName flow2=NC)
    Set the flow control type on the serial port.

Note

The mbed serial port works by default on Mac and Linux, but Windows needs an additional driver. Download the driver from the instructions here: http://mbed.org/handbook/Windows-serial-configuration

Connections

uLCD:

mbeduLCD HeaderuLCD Cable
VU5V5V
GndGndGnd
p28 (TX)RXTX
p27 (RX)TXRX
p29ResetReset

Speaker:

mbedSpeaker
p26 (PwmOut)Resistor

http://mbed.org/media/uploads/4180_1/_scaled_speakerdriverschem.png http://mbed.org/media/uploads/4180_1/2n3904.jpg

Pushbuttons (6):

mbedPushbutton #
p19#1
p20#2
p21#3
p22#4
p23#5
p24#6
GndAll

http://mbed.org/media/uploads/4180_1/pullup.png

Note

All pushbutton connections are set up to use an internal Pull-up mode, so the external resistor to Vcc is not necessary.

Demo

Image of the Set-up: http://i.imgur.com/mmvtWOS.png

Video demo of "Hello world" - console capture:

The Morse code playback on the console is in sync with the LED and speaker.

Video demo of "Hello world":

Video demo of playback controls:

Project Code

Import programMorseCode

Generate Morse code using console text input and output to LED and speaker.

Future Work

References

“International Morse code Recommendation ITU-R M.1677-1”. itu.int. International Telecommunication Union. October 2009. http://www.itu.int/rec/R-REC-M.1677-1-200910-I/

http://en.wikipedia.org/wiki/Morse_code


Please log in to post comments.