I recently moved into a new place, and discovered that my friend and I live in buildings that face each other. We’re about a kilometer apart, but both our balconies have line of sight to each other. I’ve always wanted to build a communications network with my friends since I was a kid, so I dusted off an old book about Morse, one of my Raspberry P’s and got to work. I’m a big fan of mixing old and new technologies, so instead of using something modern, I decided to use Morse code.
This tutorial is the first in a two part series for building a building-to-building morse code communications system. In it, we’ll explore how to create a morse code transmitter using a Raspberry Pi and a DJ light.
What You’ll Need For This Project
- Raspberry Pi 4 or Raspberry Pi 3 with power adapter
- Enttec Open DMX USB Adapter (opens in new tab)
- DMX Capable RGB DJ Light
- 5-pin male to 3-pin female DMX cable
- 8 GB (or larger) microSD card
- Monitor with HDMI and power cables. (Optional)
How to Build a Morse Code Transmitter with a Raspberry Pi
Before you get started, get your Raspberry Pi set up. If you haven’t done this before, see our article on how to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install (without the keyboard and screen). For this project, we recommend a headless Raspberry Pi install.
1. Install git. We’ll need it to download the code from GitHub.
sudo apt-get update sudo apt-get -y install git
2. Clone the repository to your home directory. This will ensure we have all the code necessary to run the project.
cd ~/ git clone https://github.com/rydercalmdown/building_to_building_morse.git
3. Connect your Enttec Open DMX USB adapter to your Raspberry Pi with the included USB cable.
4. Run the “make install” command to install all project dependencies. This script will take care of installing lower level dependencies, as well as the Python libraries you need for the project to run.
cd ~/building_to_building_morse/ make install
5. Run the ola_dev_info command to retrieve the device and port number of the Enttec device.
ola_dev_info | grep FT232R
6. Using the device number (example 8) and port number (example 1) provided in the output, run the patch command to patch the device and port to DMX universe 0.
# patching device ( -d ) 8 and port ( -p ) 1 to universe 0. # replace 8 and 1 with the respective from the previous command ola_patch -d 8 -p 1 -u 0
7. Connect your DMX light to the Enttec USB adapter with a DMX cable, and plug your light in.
8. Turn on your DMX light and ensure it’s running on DMX channel 001.
9. Test your light with the following command on your Raspberry Pi. It should display a bright white.
ola_streaming_client -d 255,255,255 -u 0
10. Run the make transmit command; this will start a web server that can be accessed from a remote machine at your Pi’s IP address.
11. On another machine, connect to the Pi’s IP address on port 8000 to see the enter-message command.
12. Enter a message and click enter. The Pi will convert it to morse code, and flash the light with the corresponding morse.
13. Set up your light facing a friend’s house, and get ready to build the receiving module.
In a future tutorial, we’ll handle the more complicated task of receiving the messages, so your friends can actually understand what you’re communicating.
--. --- --- -.. / .-.. ..- -.-. -.-