$ show k3ng/k3ng_cw_keyer
This repository contains the K3NG Arduino CW Keyer, a highly configurable firmware for generating Morse code (CW) in amateur radio operations. The system runs on a wide range of Arduino-compatible microcontrollers (AVR, SAM, STM32, ESP32, Raspberry Pi Pico) and supports multiple input methods including paddles, straight keys, PS2 keyboards, USB keyboards (via MAX3421E USB host shield), and game controllers. It emulates the Winkey protocol for integration with logging software like N1MM+ and provides advanced features such as a CW decoder (using Goertzel algorithm), a built-in web server for remote control, beacon mode, practice/training modes, and SO2R (single operator two radio) support. The architecture is a monolithic Arduino sketch with extensive conditional compilation: over 20 hardware-specific configuration files (keyer_features_and_options_*.h, keyer_pin_settings_*.h, keyer_settings_*.h) allow tailoring the firmware to specific boards and feature sets. The main entry points are the standard Arduino setup() and loop() functions, with the web server module (k3ng_keyer_webserver.ino) providing HTTP-based control. External dependencies include the USB Host Shield library (for USB keyboard/controller input), Adafruit LiquidCrystal and TwiLiquidCrystal libraries (for LCD displays), and a PS2 keyboard library. The codebase is well-structured for its domain but carries significant complexity due to the sheer number of configuration combinations and bundled third-party libraries.
The LLM identified 3 files worth highlighting for reuse:
A reusable class for reading multiple buttons via an analog resistor ladder. Implements debouncing, averaging, and hold detection using a state machine. Can be extracted and used in any Arduino project requiring multiple button inputs with minimal modification.
Implements the Goertzel algorithm to detect a specific audio frequency (558 Hz for CW) from an analog input. Includes configurable sampling rate, noise blanker, and moving average. Self-contained and easily portable to other tone-detection applications.
A configurable RTTY FSK modem for the Raspberry Pi Pico, using a hardware timer interrupt for precise bit-banging. Supports standard baud rates (45.45, 50, 75) and the N1MM+ logging protocol. Demonstrates non-obvious skill in real-time signal generation and can be reused in other RTTY projects.