Skip to content

pe1hvh/configurable_morse_code_interface

Repository files navigation

DIY Configurable USB/HID Morse Code Interface

Introduction

DIY Configurable USB Morse Code Interface for LCWO, PCWFistCheck, VBand, MorseMania etc. In collaboration with the Online Configurator , this interface allows you to use your favorite Morse key with various programs and apps, instead of relying on a mouse or keyboard.

Please note that not all browsers support WebUSB. Refer to the Browser Support section in this Readme doc for more information.

How it works

When the interface is connected to a USB port, the interface program waits for an initial key press (from the Morse key).

  • If this key press lasts less than 2 seconds, the interface program will proceed with either the default values or the configuration values specified using the online configurator.
  • If it lasts longer than 2 seconds, the program will wait for a connection with the Online Configurator.

The Online Configurator will prompt you to select the correct USB device/port (in this case, the Seeeduino XIAO).

Screenshot from 2025-03-09 11-30-51

Screenshot from 2025-03-09 11-31-09

Screenshot from 2025-03-09 11-31-28

Once the connection is established, you can specify the type of Morse key and configure the interface for:

  • Mouse emulation, or
  • Keyboard emulation.

Depending on the chosen emulation mode, you can assign actions such as the right/left mouse button or the right/left Ctrl key.

To stop the configuration process (don´t forget to send the new configuration to the XIAO):

  • Press the Morse key briefly, or
  • Close the Online Configurator.

The configuration will be stored in the interface's permanent memory.

Configuration Examples

Straight Key/LeftPaddle Right Paddle Emulation
vband [ ] Keyboard
Vail x z Keyboard
morsecode.me e I Keyboard
vband, vail Ctrl-L Ctrl-R Keyboard
PCWFistCheck Left-Mouse Right-Mouse Mouse

Hardware/STL File

This project only needs a micro jack, some wire, a USB-C/USB cable, and of course a Seeeduino XIAO SAMD21.

image

For this project, pins 6,7 and ground are used.

image

The STL files for the 3D-printed Seeeduino case can be found on morse-code-usbhid-interface-the-gadget.

image

Visual Code and PlatformIO

For this project, I used Visual Studio Code as the IDE with the PlatformIO plugin. PlatformIO requires functions to be declared before they are called in the code. This is because PlatformIO uses a more standard C++ compilation process, which strictly adheres to the requirement that functions must be declared before use.

For using the Arduino IDE, the code is converted and placed in a separate folder in this repository. See the Arduino IDE paragraph for more details.

SonarLint

For writing clean code, the SonarLint plugin is installed in Visual Studio Code. SonarLint is an open-source code analysis tool that helps developers write cleaner, safer, and higher-quality code. While it's not necessary to use all SonarLint rules, the most important ones are enabled.

ArduinoIDE

This code is converted to be compatible with the Arduino IDE and is placed in the arduino_ide folder as an Arduino project.

To add Seeeduino XIAO to your Arduino IDE:

  1. Click on File > Preferences
  2. Fill "Additional Boards Manager URLs" with the following URL: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
  3. Use your library manager to install the following libraries:
  • Keyboard
  • Mouse
  • Simple Web Serial (confirm to install dependencies too, if asked)
  • Arduino_Json
  • FlashStorage_SAMD

Related Websites

Examples of software and webpages working with this interface

Browser support

The Online Configurator will work with the following browsers:

  • Chrome: Fully supports WebUSB. It also supports Web Serial API.
  • Edge: Supports WebUSB.
  • Opera: Supports WebUSB.
  • Android browsers: Chrome for Android fully supports WebUSB.

Firefox doesn't support WebUSB or Web Serial API yet

OS support

It will work with the following desktop operating systems:

  • Windows (>= 8.1)
  • macOS
  • Linux
  • ChromeOS

You can use the interface with your smartphone, but you cannot use the online configurator on your smartphone.

Notes and Warning

While the Morse code interface uses the Keyboard.print() or Keyboard.press() command, the Arduino board takes over your keyboard! Make sure you have control before you use the command.

73 PE1HVH