Fork me on GitHub

Project Notes

#567 Random Code Practice

A simple Morse code practice generator that prints the character and sounds the dit-dahs to a speaker. Based on a project by Glen Popiel KW5GP.

Build

Here’s a quick demo..

clip

Notes

Glen Popiel’s Arduino for Ham Radio is a great little collection of ham radio-adjacent projects that not only provides some good project inspiration but also presents them in a way that is easy to follow no matter one’s level of Arduino experience.

This project is an adaptation/enhancement of a simple Morse code practice generator:

  • it selects a random character
  • displays the character on an LCD
  • and sounds the Morse code to a piezo speaker
  • the speed can be adjusted with a variable resistor

I’ve extended and revised the code to add some new features:

  • a switch to select between all character / alpha only / numbers only
  • display the actual dit-dah Morse representation on the screen as well as the character being sounded

Construction

Designed with Fritzing: see RandomCodePractice.fzz.

A SPDT Centre Off switch is used as a tri-state toggle for the character select:

  • ON: pulled high (alpha only)
  • CENTRE: VCC/2 voltage divider (all characters)
  • OFF: pulled low (numbers only)

bb

schematic

First testing the circuit on a breadboard:

bb_build

Code & Libraries

Main sketch: RandomCodePractice.ino

Libraries:

  • Arduino Wire library
  • LiquidCrystal_I2C - LCD over I²C
  • Morse.h / Morse.cpp
    • Morse encoding by Erik Linder SM0RVV and Mark VandeWettering K6HX.
    • I cannot find a link to the original source (Version 0.2), so it is included in the project folder.
    • Includes Glen Popiel KW5GP’s fixes for Morse encoding
    • extended by me to allow dynamic speed adjustment

Putting it in a Box

In the first version of the build, I switched the Uno for an Arduino Nano and mounted it all in a suitably sized chocolate box. This version didn’t have the output jack.

internal_build

RandomCodePractice_build

Adding an Output Jack

I subsequently added an output jack using a 3.5mm PCB-mount Stereo Socket. For more details on these connectors, see LEAP#309 Audio Connectors.

Designed with Fritzing: see RandomCodePractice_v2.fzz.

bb

schematic

With the jack installed:

internal_build_v2

Connecting an external speaker bypasses the internal buzzer:

RandomCodePractice_build_v2

Credits and References

About LEAP#567
RadioCWArduino

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader