๐Ÿ›’ What You'll Need

Raspberry Pi board

Raspberry Pi

Model 3, 4, or 5. Any will work. You'll also need a power supply and a microSD card with Raspberry Pi OS installed.

Required
Sense HAT add-on board with 8x8 LED matrix

Sense HAT

The official Raspberry Pi Sense HAT add-on board. It plugs directly onto the Pi's GPIO header โ€” no soldering needed.

Required
๐Ÿ–ฑ๏ธ

USB Mouse

Any standard USB mouse. This is your Morse code input device.

Required
๐Ÿ–ฅ๏ธ

HDMI Display

A monitor or TV with HDMI input to see the fullscreen interface.

Required
๐Ÿ”Š

Speaker

Connected via the 3.5mm audio jack or HDMI. Needed for beep sounds and text-to-speech.

Recommended
โŒจ๏ธ

USB Keyboard

For initial setup and the optional keyboard mode. Not needed for Morse code input.

Recommended

๐Ÿ“ฆ Installation

Step 1 โ€” Clone the Repository

Open a terminal on your Raspberry Pi and run:

git clone https://github.com/GTS2gaming/Raspberry-pi-morse-code.git cd Raspberry-pi-morse-code

Step 2 โ€” Install Python Dependencies

Install the required Python libraries:

pip3 install sense-hat pygame pyttsx3 numpy

Step 3 โ€” Install espeak (TTS Fallback)

This provides a backup text-to-speech engine:

sudo apt-get install espeak

Step 4 โ€” Run the Application

Start the Morse code system:

cd morse python3 morse_code_sense_hat.py

The application will launch in fullscreen mode. You're ready to start clicking Morse code.

๐Ÿ”„ Auto-Start at Boot (Optional)

Want the Morse code system to start automatically when you power on the Pi? Run:

python3 morse_code_sense_hat.py --install-service

This creates a systemd service that launches the application on every boot. To disable it later:

sudo systemctl disable morse-code-sense-hat.service

โœ… Quick Test

Try spelling "HI" in Morse code to verify everything works:

H = ยท ยท ยท ยท (four short clicks)

Click the left mouse button four times quickly. You'll hear four short beeps. Wait 1.5 seconds โ€” the letter "H" appears on the LED and screen.

I = ยท ยท (two short clicks)

Click twice quickly. Wait 1.5 seconds โ€” "I" appears. Now right-click to complete the message. The Pi will say "Message complete: HI" and play the Mario tune.

๐Ÿ”ง Troubleshooting

No LED display?

Make sure the Sense HAT is firmly seated on the GPIO pins. The system will continue to work without it โ€” check the HDMI screen for output.

No sound?

Check your audio output setting with raspi-config. Try both the 3.5mm jack and HDMI output. Make sure the volume is up.

Import errors?

Re-run pip3 install sense-hat pygame pyttsx3 numpy. On some Pi OS versions you may need sudo apt-get install python3-pygame.

Display orientation wrong?

The code sets sense.set_rotation(270). If letters appear sideways, try changing this to 0, 90, or 180 in the source code.

๐ŸŒŸ Ideas to Extend the Project

Once you have it running, here are some fun ways to make it your own:

๐ŸŽจ

Custom Colours

Change the LED colours for different letters or add a rainbow mode.

๐ŸŽต

Custom Tunes

Replace the Mario tune with your own melody. The note format is simple: (frequency, duration).

๐Ÿ†

Speed Challenge

Add a timer to see how fast you can spell words in Morse code.

๐Ÿ“š

Learning Mode

Show the Morse code for a random letter and ask the user to input it correctly.

๐ŸŒ

Network Mode

Send Morse code messages between two Raspberry Pis over the network.

๐Ÿ“Š

Statistics

Track accuracy, speed, and most-used letters. Display stats on the screen.

Ready to build? Grab the code and start clicking.

โญ View on GitHub