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.


Here’s a quick demo..



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


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)



First testing the circuit on a breadboard:

Breadboard Build

Code & Libraries

  • Arduino Wire library
  • LiquidCrystal_I2C - LCD over I²C
  • Morse - 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

For a final build, I switched the Uno for an Arduino Nano and mounted it all in a suitably sized chocolate box.



Credits and References

Project Source on GitHub Project Gallery Return to the LEAP Catalog

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

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - 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
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.