Recently I take an interest in the amateur radio sports and I have been planning to get a license from CRAC for a month. Few days ago I bought a CW keyer (although I will not have the chance to operate on SW before I got the B license), but had no idea how to connect it to a computer.

My keyer

Figure 1. My DJG-K4 keyer purchased from Taobao

There are resolutions that disassembling an old mouse, soldering the two contacts to the pads of left button, turning the keyer to be a mouse’s left button. However I have no old mouses so I just came out an idea: use an Arduino device that can simulate HID devices to turn the keyer into a mouse’s left button. In my case I am using a CJMCU Beetle board, which is Arduino Leonardo compatible, only with less GPIOs.

CJMCU Beetle

Figure 2. CJMCU Beetle development board, looks like a USB dongle

It is quite simple to program the logic. Basically speaking, we set one of the digital pins to be an input, and connect one of the keyer’s plug contact to it; we also connect GND to another plug contact (see the code below). When we detect a closed circuit on that pin, we use Arduino’s Mouse library to press the mouse. When we detect an open circuit, we release the mouse. That’s it!

#include <Arduino.h>
#include <Mouse.h>

#define PIN_KEYER 9

void setup() {
    // Refer to
    // for the meaning of INPUT_PULLUP

void loop() {
    if (digitalRead(PIN_KEYER) == LOW) // low active due to pulled up;

There is another problem on how to gracefully connect the plug of keyer to the board. So far I randomly pick two wires to connect them. Later I may show my soldered, dedicated 6.5mm-to-USB converter here, if I hadhave time :)

Figure 3. A finely crafted converter should be shown here

I use Lakey to practice morse code. It seems to be a (semi-)open-source1 software written by a Chinese HAM. It has a CW button on the user interface, and I can put the cursor on the CW button, then use my keyer to practice morse code sending. Lakey can also collect audio from the microphone, sample sounds from a frequency range, and turn CW signal into texts. It integrates the Koch training mechanism so that a user can train his morse code copying with a scientific method. HAMs recommend it, and so do I (for now, I am just a “sausage” (pre-HAM)).

Lakey about

Figure 4. Lakey

If you are also a HAM, I wish a QSO with you! 73!


  1. On several Chinese download websites there says “… buddy needing the source code can visit the home page of Lakey to download it, but because the server is located in my home and is accessed using DDNS, a 100% 7x24 uptime cannot be guaranteed. If you can’t download it, please send me an email or contact me over MSN.” For reference see