Connect a hardware key

While the on-screen key isn’t super-bad, a hardware key is much, much better. Here is how to proceed to attach one.

Buy one

You can buy an adapter at VBand (https://hamradio.solutions/vband/). This will also work with Dahdidahdit.

Build one from the web

Several projects are published on the web:

Build a Morse paddle with built-in USB

The general idea is to consider a Morse key (paddles or straight key) as a very limited form of a keyboard. The nice thing about this idea is that very many systems support USB keyboards and we don’t need a special driver for it. There are even cheap microcontroller dev-boards that feature USB connectors that can be used for the microcontroller. The one we’re going to use here is the Raspberry Pi Pico based on the RP2040 microcontroller, because of its price and built-in debounce.

While the electronic part is covered, the mechanical part we need to build ourselves – using a 3D printer.

Needed parts

The bill of materials can be found at the GitHub site that has all the files needed for the mechanics.

Besides the items from the hardware shop, you’ll also need a Raspberry Pi Pico.

Electronics

Prepare the Pico

Download the current stable distribution of CircuitPython from circuitpython.org and save it.

On the same web site, go to “Libraries” and locate the “bundle”, a Zip file that contains many libararies. Download the bundle for the CircuitPython version you downloaded before. In that Zip file, there is a folder named “adafruit_hid”. Extract this folder with all the files in it.

Download the ZIP file with the code to install on the Pico from this website and unpack the file code.py from it.

Create a folder on your computer called “cipy”. In this folder, create a folder called “lib”. Into this folder move the folder “adafruit_hid”. Copy the morse keyboard program code.py that you extracted from the ZIP file in the previous step into it. In the folder “cipy” there should now be a file “code.py” and a folder “lib” in “lib” there is a folder “adafruit_hid” with some files.

Now press the reset button of the Pico and, while keeping the button pressed, connect the Pico to your computer. That puts the Pico into programming mode, making it usually be mounted as an external hard drive. Release the reset button.

If you cannot find the Pico mounted as a drive on your computer, chances are pretty good that the USB cable you’re using is power-only. Find a good cable and do not use any adapters – especially no USB OTG adapters. You need to connect the Pico straight using a plain old USB A to USB A micro cable.

Install the software

Move the downloaded CircuitPython distribution onto the external Pico hard drive. When the file transfer is finished, unmount the Pico drive. The Pico restarts automatically.

Since the Pico is still connected to the computer’s USB port, is is mounted again as an external hard drive, but this time, since the reset button is not pressed, the CircuitPython drive is mounted. This drive is empty.

Now copy the content of the “cipy” folder onto the empty external CircuitPython hard drive. Do not copy the folder itself! After the copying process, the content of the external hard drive should look exactly like the contents of the “cipy” folder.

When the copying is finished, the drive can be unmounted and the Pico unplugged from the computer.

The Pico is now ready for mounting.

Mechanics and housing

For the mechanical parts of the Morse key, you need to download and print some parts. You’ll find everything you need on GitHub. Download the project and render STL files for base, bottom, case and paddle; latter one of which has to be printed twice: one copy as is and the other one mirrored to make the other paddle. The advantage of this is you then have the source code for the parts and you can modify them to your needs – e.g. emboss your call sign, fit to screws that you already have instead of the 2.5 mm screws needed for the provided print and so on.

Alternatively, you can also head over to Printables and download ready-to-slice STLs. The advantage of this is a low lead time, but you give up your freedom to tinker.

Connect the key to your phone

To connect the key, you need a USB OTG (on the go) for your phone. You plug that USB OTG adapter into your phone and then you plug in the USB cable you previously used for programming the Pico into USB OTG adapter on the one end and the key on the other.

Now start one of the Morse input modes in Dahdidahdit – e.g. the brass pounder – and check if the key works.

If it does not work, you can try to connect the key to a computer, open a text editor and then tap the paddles. If the key is working, the text editor window should show ‚a‘ and ‚b‘ characters, depending on whether you tap the left or the right paddle. If that does not work, try to load the software again. If it does work on the PC but not on your phone, the OTG adapter might be at fault. In that case you could check if the OTG adapter works with different hardware attached to it and you could try a different OTG adapter.