Adafruit Playground is a wonderful place to share what you find interesting. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.
Adafruit Playground is a safe place to share with the wonderful Adafruit community of makers and doers.
Click here to learn more about Adafruit Playground and how to get started.
-
RP2040 CW Keyer
Adafruit Feather RP2040
Noel J Petit, WB0VGI
This project expands on a keyer developed in 2020 using a previous microcontroller and touch sensitive sensors. Keyers should have:
Touch pads for dash and dot
Push buttons for preprogrammed messages (CQ, RST, etc)
Rotary encoders to adjust keying rate
The Adafruit Feather RP2040 has interfaces and a library of code for all three of the above. The advantage of the Feather RP2040 controller over previous microcontrollers is that the 2040 has touch sensitive pins on the controller itself. This means that minimal external devices are needed as most of the control is provided by software. Touch pins were programmed to control dot and dash. Touch control lines need to sense detection over a given time and not sense multiple detection as the key is touched and removed. This “debouncing” is difficult to do in hardware, but the language we use, CircuitPython provides deboucing for touch panels and switches.
In early 2021, the Raspberry Pi Foundation introduced the RP2040 microcontroller chip. They produced a microcontroller board and Adafruit expanded on that board with a Feather Board. The Feather is specifically made to interface with external devices. Adafruit immediately expanded its library of CircuitPython functions for the Raspberry Pi Pico RP 2040. As a microcontroller, the RP 2040 is not meant to have a fully functional operating system with files and interfaces to things like keyboards and mice. The microcontroller is designed to run one program and interface with many different kinds of inputs and outputs (digital, analog, I2C, SPI, USB…).
Keyers provide services to CW operators for an easier life. Most modern transceivers include an internal electronic keyer that uses either the straight key or dual paddle key to key the transmitter. Timing of the dots and dashes depends on the operator (for the straight key) or the radio's internal keyer (for the paddles). In addition to character timing, some radios include the ability to store messages such as 'CQ CQ CQ DE WB0VGI'. My particular Yaesu FT-897’s include dual paddle dots and dashes timing but cannot store messages. Additionally, to change the keying speed, the Yaesu must stop sending, choose one of the menus, change the speed and then continue the CW conversation. I found this challenging and slow. Programmable keyers allow you to change CW speed while sending and to send preset messages with a touch of a button.
To perform these tasks, a microcontroller is needed. The computer is the Raspberry Pi Foundation’s Feather RP2040 -- a small computer built around a dual-core Arm Cortex-M0+ processor with 264KB internal RAM and support for up to 16MB of off-chip Flash. This is a 32-bit computer running at about 133 Mhz. This small computer is built to run small devices with a language called Circuit-Python (CP). CP is a subset of the python language to talk to and display many digital and analog data sources. Included on the RP2040 are pins that can be digital inputs or outputs (high or low voltage), some analog pins (converted to or from binary numbers).
Figure 1
The RP2040 Keyer uses these touch sensitive pads as inputs to key the transmitter with dots and dashes. An additional rotary encoder increases or decreases the CW sending speed. This means I can adjust the speed without having to stop conversing For touch sensors, all that is needed is a small piece of copper coated PC board glued to a metal plate (in this case another PC board) When touched, the output is a high logic value.
Figure 2
The Feather RP2040 Keyer is built in an aluminum Bud Box with the Feather computer on a small breadboard (this allows for changes as needed). The key sticks out the middle on a piece of copper two-sided circuit board soldered to a base piece of circuit board that fits in the top of the Bud Box. One circuit board for the base is 4” x 2 ¾” and bolted to the top of the Bud Box. The key extension is 4 ½” x 2” and soldered perpendicular to the base PC board. The key extension must be notched to fit the edge of the bud box. External capacitive touch pads are wired to the RP2040 with 28 gauge wire and message/speed selection via push button switches atop the Bud Box (see figure 2 and 3).
Capacitive touch keying takes some time to get used to. For the traditional paddle key, the paddles move back and forth and you feel the motion toward the dot or dash. For capacitive touch you must touch the surface to activate the key and remove you finger from the touch pad to stop the dot or dash. You do not get the sensation of moving the key and you must completely be off the touch pad to turn it off. I am still getting used to it. Capacitive touch pads in figure 2 are used as the dot and dash keys. Note that the Bud Box is not heavy enough to be a comfortable key. My MFJ dual paddle key weighs 2.5 pounds, but the Bud box and its circuitry only weighs about 10 ounces. The solution is use heavy washers or other weights in the removable U shaped bottom of the keyer. I have the box up to about 1.5 pounds and it is quite comfortable.
Figure 3
Your laptop/desktop programs the Feather with a simple editor called MU. The MU editor can, edit python files, check python files for correctness, load or store files onto the Feather , and monitor the output from the Feather. Normally the output appears as either interface pins (digitally on or off) or output is the result of program steps such as the python print() statement. Only one program runs on the Feather and it is called "code.py" but it can have many subprograms called from code.py. Once loaded onto the Feather, "code.py" runs and the results are seen on the serial screen of MU. Since the memory on the Feather is non-volatile flash, as long as the Feather has power it will run code.py but without power, the Feather remembers the program and restarts code.py upon power up. Figure 4 is the layout of the inside of the keyer. Beneath the power connector on the left is the Feather and its breadboard. To the right are two 1/8” sockets for keying the transmitters. A toggle switch between them selects the radio to be keyed.
Figure 4
The schematic is simple. The Feather receives power from the USB-C connector or an external supply of 5 volts. I chose both to use up some of the plug-in supplies in my collection. 220 uf and 0.01 uf capacitors filter the supply’s input. RF will get into the 5 Volt DC input so you may need ferrites or repositioning of the wires to prevent the Feather from chaos. Inputs are pins A2-A3 for the rotary encoder, D25 and D9 for the pre-programmed messages, D5 and SCL for the Dash and Dot. The output pin D11 lights an LED on key. Output pin D12 is goes low to key the transmitter. The circuit is wired with wire wrap 28 gauge wire. Cut pins from wire wrap sockets to use as wire wrap terminals on the breadboard. The SPDT switch on the output determines which radio is keyed. This avoids changing the mode of the radio when satellite up and down links are reversed.
Figure 5
A Feather starts life as a simple microcontroller that expects and executable file of type .UF2 as its operating system. You can download .UF2 files from the Adafruit site and see that the device works correctly. When plugged into a laptop/desktop the Feather appears as one of the disk drives on your PC. To do your own programming, load the latest version of Circuit-Python onto the Feather with just a drag and drop. Once loaded, the Feather expects a python program named code.py. The MU editor will load and store programs for the Feather from then on. All the details are available on the Adafruit learning pages.
Additionally, the Feather has many libraries for multiple devices. These libraries are available from Adafruit as a bundle of about 300 files. You will need some libraries listed in the “import’ statements at the beginning of the Python Code. Also, libraries from Adafruit provide interface to all sorts of things: temperature, magnetic field, displays, humidity, servo motors, LED’s, acceleration (which way is up?) and so on. Download the library .zip file and extract all of the libraries into a directory on your laptop/desktop. When you need a library, drag it from your laptop/desktop’s library to the “lib” folder on the Feather.
Before coding the keyer, you can program and test the Feather without connecting the Feather to any peripherals (how's that for cool?). Connect your laptop/desktop computer to the Feather through a USB to USB C adapter and watch the Feather light up. Follow the instructions for set up of the Feather at the Adafruit.com learning pages. This puts in Circuit-Python, downloads and starts the MU editor for you. Get sample python programs from Adafruit's pages as well. Sample code for the Feather Touch and Digital keyers are at links below. Be sure to change the names of the files to code.py to run them on the Feather . I keep the names descriptive on my PC but change them to code.py on the Feather.
A rotary encoder changes the CW speed up and down. The other two push buttons on top of the keyer provide preprogrammed messages. In my case, one is CQ and the other a standard 599 response. The dash and dot keys are inactive during the message.
Once programmed, the Feather can run with just a power supply connected on the Feather side of the box. It automatically starts the code.py program when powered up. 1/8" coaxial connectors on the keyer side connect to the key inputs of the radios.
The parts list has specific Digikey and Adafruit numbers. Everything except U1 – the Feather RP2040 can be substituted for whatever you have in the shop. Resistors, capacitors, and diodes of anywhere near these specifications will work just fine. Capacitive touch pads are made from cut pieces of copper printed circuit board. I found that smaller touch pads work best. The Dot and Dash pads are 5/8” x 3/8” to be very responsive. Keep the pads small as their percentage change in capacitance is more than a large pad when touched. This may require some experimentation.
References:
Adafruit.com Learning Page: https://learn.adafruit.com/adafruit-qt-py
Adafruit.com Products: https://www.adafruit.com/
Sample Program for RP2040 Touch: https://bit.ly/37aWhse
Sample Program for RP2040 Digital: https://bit.ly/373RZTp
Parts List
Chassis Bud CU-3006-A Digikey 377-1093-ND
Printed Circuit Board (10” x 8”) Digikey 182-1017-ND
Mini Breadboard Digikey 1471-1522-ND or Adafruit Product ID 4539
J1-J3 (1/8” jacks) Digikey 889-1821-ND
D1 Diode 1N4004 (any will do) Digikey 1N4004GOS-ND
C1 0.01 uf disc Digikey 1255PH-ND
C2 220 uf @ 6.3 VDC Electrolytic Digikey P829-ND
R1,2 100 ohm ½ watt Digikey 100H-ND
R3,4 10K ohm ½ watt Digikey 1MH-ND
S1,2 Push Button Digikey EG1930-ND
L1 Red LED Digikey L513HD
S1 SPDT Switch Digikey 2368-54-302PC-ND
U1 Feather RP2040 Adafruit Product ID 4884
X1 Rotary Encoder Adafruit Product ID 377
P1 5 VDC USB-C Supply Adafruit Product ID 4298
USB-A to USB-C cable Adafruit Product ID 4472
Figure Captions
Figure 1 – Adafruit Feather RP2040 microcontroller
Figure 2 – Adafruit Feather RP2040 Digital Keyer with push buttons for messages, rotary encoder for CW speed and external capacitive touch sensors for dots and dashes
Figure 3 – Adafruit Feather RP2040 Pin out diagram
Figure 4 – Adafruit Feather RP2040 mounted on Mini Breadboard inside the keyer
Figure 5 – Adafruit Feather RP2040 schematic