After a few on-air queries, I decided to write this article which documents how I operate CW using my SDR based QO-100 groundstation. The circuit I designed incorporates the necessary functions into a single operational device. It avoids some of the CPU and SDR overhead associated with PC applications and any virtual audio cabling.
Since the SDR hardware and software has no easy way of easily generating a CW signal directly, I use an injected audio tone in SSB mode. It was an emission type often referred to as A2A when I first took the RAE in 1985. It is not a new technique and is already in use by some other QO-100 operators. This unit conveniently combines all the useful functions which are necessary to operate CW through the satellite's NB transponder into one box.
It can also be used if using traditional analogue radios through QO-100. Where the CW is directly transmitted as A1A by the uplinking radio in the normal way. Here, we can still use the unit's memory keyer, receiver mixer and QSK Break-In functions.
The project was an exercise in opamp design and noise elimination. Overcoming superfluous noise by designing with different grounding options and component choices was particularly challenging. I have included a complete schematic walkthrough with circuit description. Links to datasheets and other relevant information are included.
This is the first project for which I have not had to code any firmware for. There are already many good CW keyer projects in existence. The K3NG code by Anthony Good probably provides the most complete keyer firmware available. It is fully configurable and has many options. My final schematic and subsequent PCB is compatible with the K3NG sketch and the Arduino MEGA 2560 R3. This providing all the options are correctly set in the keyer's sketch files.INTRODUCTION
Any CW operator will tell you that once this mode is minimally mastered it will quickly become the preferred mode of choice. CW's efficiency in relaying messages across the globe are unsurpassed. Despite FT8's better signal to noise performance, CW surpasses it as a communication mode when you considered that you are not limited in the contents of the message exchanged, as well as the simplicity of the equipment normally needed to become QRV.
Most CW on the NB transponder is generated in the classic way by the keying of modern CW capable transceivers. Two radios are often simultaneously used for uplink and downlink duplex operation. For efficient CW operation with headphones, we need to mix both our transmitted sidetone with the signal received. A headphone audio mixer is necessary.
Other operators, like myself, use SDR Pluto based groundstations with PCs running SDR software. This combination does not give an easy way to transmit CW code over QO-100. Sometimes SDRs have a CW key input jack (eg. the HF SDR Hermes Lite 2) but the Pluto does not. Here I use the Kafkaesque method of producing a clean carrier in SSB mode by injecting in a pure audio tone. Other amateurs have already faced a similar dilemma and have used this eclectic solution. Be warned however, that this method may not give perfect results when using PCs, soundcards and SDR software. Your Milage May Vary (YMMV).
CW SOFTWARE AND VIRTUAL AUDIO CABLESFEATURES
Some CW operators have used software like 'CWType' and 'Morse Keyer 4.3' with Virtual Audio Cables to feed in the tone to SDR Console in SSB mode. A paddle can be connected to the PC serial port via a simple homebuilt interface circuit. Serial to USB converters are also available if your PC does not have a serial port. Eduardo Erlemann PY2RN has good YouTube videos of how to do this and I would recommend trying this method first.
Eduardo Erlemann PY2RN channel:
- ADALM Pluto / Lime SDR etc. How to use a real Keyer to make CW!
- Making CW using SDR Console, Pluto SDR and FLDIGI
More often than not however, even with the most powerful machines, the CW flow is not smooth because of how the PC has to manage it's workload. Although mitigated, since the unit described here still has to work with a soundcard and SDR software, inherent timing delays and glitches may still manifest themselves. YYMMV, so please read the Caveats section below.
- Low noise high performance mixing and headphone amplifier section.
- High performance TPA6111A2 stereo headphone amplifier by Texas Instruments.
- Low noise Texas Instruments OPA4134 opamp audio mixer.
- Separate PCB grounding sections to quell noise.
- Power isolation using a Murata NKE0505SC subminiature DC/DC Converter.
- Symmetrical power supply with an LM2664 charge-pump voltage inverter.
- Clean sinusoidal Twin-T audio oscillator.
- Sidetone level adjustment (with High, Medium, Low).
- Individual Left and Right channel adjustment of received audio.
- Transmit tone frequency control.
- Transmit tone level control.
- Tone envelope edge shaping control.
- Rx Mute jumper for full-duplex or QSK break-in operation.
- Configurable QSK break-in delay time.
- CW or SSB selection switch with warning LED.
- TRRS (CTIA) headset 3.5mm jack socket.
- Simple connection to most gaming headphones using TRRS (CTIA) jacks.
- TRRS (CTIA) soundcard (or radios) 3.5mm jack socket.
- Simple straight through TRRS (CTIA) cable required to connect soundcard.
- Illuminated 16x2 LCD display.
- LCD brightness and contrast controls.
- LED indicators for TX1, PTT1, TX2 and PTT2 status.
- Three for LEDs indicating Command Mode and sending practice response.
- Powered from Arduino Mega board's USB port (PC/MAC) or barrel jack.
- Command Line Interface (CLI) through USB port.
- Compatible with WinKeyer by K1EL or variants like Mortty.
- Automatic Software Reset (ASR) enable/disable jumper.
- Both CLI or WinKeyer operation can be selected on same USB port.
- Direct microcontroller reset available on shield.
- PS/2 mini din keyboard input, for CW sending and commanding keyer.
- Paddle or straight key input, 3.5mm stereo jack socket.
- Two transmitter outputs (TX1 and TX2), 3.5mm stereo jack sockets.
- Keying and PTT line on each transmitter jack output.
- Optoisolation of receiver muting line from the microcontroller.
- Optoisolation of tone oscillator control line from microcontroller.
- Rotary encoder with push button for Command Mode.
- Five on board memory push buttons.
- On board piezo sounder.
- Piezo sounder volume control.
- Shield fits cheap and ubiquitous Arduino MEGA 2560 Rev.3 board.
- Uses a 10x10cm double sided PCB for cheaper fabrication.
- SMD components for compact form factor.
- Six pin Options header for Goertzel decoder is available.
- I2C four pin header port is available.
- Compatible with the many features of the K3NG keyer firmware.
The analogue section of the schematic incorporates a sine wave audio oscillator to feed an SSB radio and gives us a nice headphone sidetone too. The quad opamp buffers, splits and amplifies this tone then mixes in received audio from the downlinked signals. Using the receiver audio mute switch circuits, the schematic allows for full duplex or QSK Break-In operation. A latching switch routes either the microphone or the CW tone to the transmitter for quickly selecting either CW mode or voice mode.
The digital section of the schematic incorporates the Arduino MEGA and makes up the K3NG compatible keyer circuit. It has inputs for a paddle, straight key or keyboard. Its two transmitter outputs, TX1 and TX2, give us CW keying and PTT for two separate radios. It also has pushbuttons, rotary encoder, display and a few other LEDs and headers to help operate and configure the keyer.
The power is derived from either the MEGA’s USB connector or its barrel jack. A symmetrical power supply is used to power the opamp. DC isolation, separate grounds and optocouplers are used in a bid to eliminate noise.COMPLETE CIRCUIT WALKTHROUGH
This will be a full description of the unit with circuit theory and component information. Any datasheet information is linked to in the components section.
THE THREE TONESANALOG SECTION
Essentially we will be referring to three tone outputs:The twin-T oscillator fixed tone output will be split into two signals.
- One is the tone to transmit (TX.TONE) and will be used to modulate the SSB transmitter to generate our mock CW.
- The other (SIDETONE) will be mixed with the received audio and routed to our headphones to permit us to have a monitoring sidetone and thus hear what we are sending.
- The last signal is a separate multi tone generated directly by the MEGA’s K3NG firmware and which is used predominantly just to talk to the keyer when changing settings. These multi-frequency tones give useful audible hints when commanding the keyer through the paddle in Command Mode and emanate from the small piezoelectric buzzer.
The NKE0505SC is a DC-DC Converters and is particularly suitable for isolating and/or converting DC power rails. It comes in a small SIP package for easy PCB mounting.
An LM2664 switched capacitor voltage converter is used to generate -5V. The +5V and -5V symmetrical power supply is used by the operational amplifiers.
The circuit uses a Twin-T oscillator centered around a 2N3904 transistor to generate a stable tone. The shield PCB uses a MMBT3904 which is just a 2N3904 in a smaller SOT-23 package. Frequency adjustment from approx 500 to 1000Hz is possible with a 5K potentiometer. A tone of 700Hz seems a good choice. A BS170 MOSFET lets pass or shunts to ground the Twin-T's sinusoidal output. At its gate, a resistor and capacitor network shapes the waveform. The associated 2K potentiometer is used to set the amount of edge shaping and delivers a more agreeable sounding tone.
This easily controlled envelope shaping of the carrier wave is one of the advantages of generating CW in this way. It eliminate key clicks and reduces harmonics.
The Twin-T oscillator arrangement is triggered from the microcontroller's KEY1 line. This is the same line that keys the transmitter on the TX1 3.5mm jack, so the TX1 output must be selected (CLI command "\x1"). A logic high level here passes through an optoisolator and a driver MOSFET to control the Twin-T's output. Optoisolation was included to remedy microcontroller noise which was found to be propagating into the analogue circuit section on the prototyping bench. YMMV and this isolation may be unneeded. So experiment and see. If removed, the correct triggering logic from KEY1 should of course be maintained to still control the oscillator properly.
For best performance the audio mixer uses an OPA4134 quad audio opamp. Other opamps can be used but after trying the LM324, NE5532, LM339 and a couple of others I settled for the OPA4134. It is a high performance low noise quad operational amplifier by Texas Instruments. The cheaper opamps I used on initial prototypes of the circuit introduced higher noise levels which was frustrating. The OPA4134's slightly higher cost frankly justifies it's performance. As a bonus there is a DIP14 package version available which facilitated testing and prototyping. The final PCB uses the SOIC-14 package of this IC which not only saves board real estate but seems more abundant and easier to source online.
The oscillator's output tone feeds into pin 12 of the non-inverting opamp U32.4 configured as a voltage follower. This buffer stage provides a high impedance to the preceding oscillator and avoids any possible loading. Its low impedance output feeds later stages and from which we also take the TX.TONE. This is the signal we will be injecting into our SSB radio or SDR soundcard and whose level can be set with the 10K potentiometer beforehand.
Following on, the inverting opamp U32.3 provides a set gain to elevate the tone level for subsequent audio mixing in the next stages. The voltage divider, formed by a potentiometer and two resistors, lets us control the output level to accommodate the received audio levels we will be mixing in. By bridging the header pins marked High, Medium or Low with a jumper, allows for comfortable level adjustment using the same 10K potentiometer's rotational travel.
The next pair of opamps, U23.1 and U23.2, will mix our sidetone with the received audio from the PC soundcard's left and right channels respectively. Each branch has a unity gain inverting opamp configuration with independent output level control. By having separate left and right level adjustment potentiometers, we can preset headphone L/R balance on the unit itself if needed.
The TPA6111A2 is a small stereo headphone amplifier by Texas Instruments. We feed it the left and right channels of receiver audio which has now been mixed with our sidetone. The power output from this IC is sufficient to drive headphones connected to the Headset TRRS 3.5mm jack socket.
RECEIVER MUTING FOR QSK BREAK-IN
The second TRRS jack socket connects to the radio or soundcard. Left and right channels of the received audio individually go to the two opamp mixers. Each through a pair of back to back MOSFETS used as an audio switch. The switches are used to interrupt the flow of received audio when in QSK Break-In mode. They mute the received audio when sending code and are driven from the microcontroller's PTT1 line. This is the same PTT line going to the TX1 output. Therefore, the TX1 output must be selected (CLI command "\x1") as well as the global enabling of PTT (CLI command "\]").
The CLI command "\]" will globally enable or disable the PTT lines from the keyer. Therefore, ensure the PTT lines are enabled here for controlling the audio mute circuitry.
\] PTT Enable / Disable
The CLI command "\x1" will switch to transmitter TX1. Therefore, ensure the TX1 transmitter output is selected.
\x# Switch to transmitter #
A logic high passes through an optoisolator and a driver MOSFET to mute the received audios. Optoisolation was included to remedy microcontroller noise which was found to be propagating into the analogue circuit section on the prototyping bench. YMMV and this isolation may be unneeded. So experiment and see. If removed, the correct driver logic from PTT1 should of course be maintained to still mute the audio paths properly.
When transmitting, a low on the 1N4148 diode cathode will turn off the two MOSFETS instantly to mute the audio. On receive, a high will take a little time to charge up the 2.2uF capacitor through the 100K resistor. This small delay will unmute the audio more slowly. This transition avoids thumps and clicks for more agreeable listening. Two BS170 MOSFETS are used back to back, for improved audio blocking and won't be hindered by the MOSFET's body diode characteristics.
Actually, SDR Console already has an option to mute or reduce the level of received audio during transmission time (Transmit Options > Pure Signal > Receiver Mute). However, including these MOSFET audio mute switches in the circuit is useful when operating QSK Break-In if operating with traditional analogue radios, or indeed when using SDR software which does not have this option.
A RX Mute jumper is provided on the PCB which can be set for either Full-Duplex or QSK Break-In operation. This jumper allows us to disable the audio switch muting (full duplex listening) but still have the option to use the PTT1 output to drive exterior equipment on TX1.
Enable Rx Mute by placing the jumper across header pins 1 and 2 (indicated on the header with an asterisk '*'). Disable RX Mute by removing jumper (or better, by placing the tiny jumper across pins 2 and 3 so as not to loose it).
Since the audio switch circuit uses the PTT1 line to mute the received audio, the QSK Break-In delay time (and so the total time which the audio will stay muted) can be altered through the PTT1 keyer settings. The easiest way to set this would be by enabling the use of the extended commands of the CLI to then set the PTT1 tail time. This is all detailed later in the configuration explanation.
Remember, AMSAT stipulates that each operator should always monitor his transmit frequency by operating in full duplex mode.DIGITAL SECTION
Therefore, a QO-100 CW operator must send whilst still monitoring his receive frequency. In his headphones he should hear both what is being sent as well as monitoring what is being received. However the delay of the signal when communicating through a satellite positioned 36000Km away is quite substantial. This received echo is very disruptive to an operator sending CW. On HF, using QSK Full Break-In operation is quite common. It allows the operator to receive in between his morse transmissions. He can be interrupted by the station he is corresponding with, as well as hear any QRM or even break in stations wishing to join the conversation. The QSK delay setting on radios can be configured to permit listening between sentences, words, characters or even between every sent morse element (no delay).
This section was designed to work with the K3NG keyer firmware whose details are described in its associated Wiki.
K3NG GitHub Wiki: https://github.com/k3ng/k3ng_cw_keyer/wiki
Arduino MEGA 2560 R3
This runs all the CW keyer functions. It also provides the shield with a +5V regulated voltage stepped down from its barrel jack or more conveniently from its USB PC port. This PC connection can also be used to control the unit in CLI (Command Line Interface) mode.
Other Arduino boards like the popular UNO R3 could have been used. However by using the larger Arduino MEGA we are not limited by memory space available and can run all keyer features concurrently and without problems.
The rotary encoder controls functions of the keyer directly from the unit itself. A single push to enter (or exit). Then navigate around in Command Mode.
The five tactile push buttons are used to access CW message memories.
The backlit LCD with the Hitachi HD44780 driver is used to provide a 16 character by 2 line display of all keyer operations. Contrast and brightness can be individually adjusted with the 5K and 500 Ohm trimmer potentiometers.
The 6 pin Mini DIN PS/2 socket allows for morse keyboard operation.
The piezo buzzer with volume control gives us audio cues and statuses.
The status LEDs near the rotary controller indicate when Command Mode is active (Blue LED) as well as when a Correct or Wrong reply is given in Alphabet Code Practice mode (green and red LEDs repectively).
The reset button is made available directly on the shield. Since the original reset button on the MEGA microcontroller is now hidden and made inaccessible by the shield itself.
The jumper to enable/disable ASR (Automatic Software Reset) is close by. This is essential when the unit is configured to use WinKeyer. It prevents the microcontroller resetting on connecting to the USB port.
AUTOMATIC SOFTWARE RESET (ASR)For Winkeyer operation, the Automatic Software Reset (ASR) should be disabled. Otherwise, each time a logging program connects to the serial connection through the USB port, it will reset this link.Enable ASR by placing the jumper across pins 1 and 2 (indicated with an asterisk '*'). Disable ASR by removing the tiny jumper (or better placing it across pins 2 and 3 so as not to loose it).The only drawback of disabling ASR comes when you need to upload a new sketch to the Arduino. Then, you must reset it manually just within a second or so of clicking the upload command. This will allow the Arduino bootloader to function correctly.
The Option Port consisting of a 5 pin header provides an optional connection for using the Goertzel decoding function if you feel the need.
The I2C Port consisting of a 4 pin header provides for an I2C connection if required at some future occasion.
The transmitter outputs connected through 3.5mm stereo jacks named TX1 and TX2 can control two transmitters. Each has a CW keying line and a PTT line output via BS170 MOSFETs. The BS170 drain current should not be exceeded and this needs to be taken into consideration when connecting radios, amps and other equipment.
The MMBF170 used on the shield is a BS170 in SOT-23 package. It has a continuous drain current of 500mA (within 300mW maximum power dissipation). This value should not be exceeded. The larger BS170 in the TO-92 package allows 500mA (within 800mW maximum power dissipation). Use a current limiting resistor if necessary. Use a driver transistor or relay for equipment requiring larger currents.
The paddle or straight key is connected using another 3.5mm stereo jack. It has external pullup resistors and filter capacitors.POWER REQUIREMENTS
Power can be applied either through the Arduino's DC barrel jack or its USB connector. To save board space, no on/off switch is made available on the shield. My unit is always plugged into my PC, ready to be used with the SDR software. Consequently it just powers-up and down in tandem with the PC.
If not utilising a PC and its USB connection, a DC wall wart adapter or a USB power bank battery can be used. If so wished, there are also DC adapters and USB cables having inline power switches on their leads.
The MEGA's +5V regulator is also used to power the shield. The unit only requires a moderate amount of current and won't add too much of an extra burden.
To the barrel connector, we can supply anywhere from 6V to 20V (7V to 12V recommended). The higher voltages would have a tendency to heat up the Arduino's onboard regulator as it sheds any excess voltage above +5V. In this case the effect is inconsequential since the overall current drawn by the unit, and thus overall power requirement, is relatively low.
If connected to a PC to use the Command Line Interface or maybe operating CW logging software with the keyer's Winkey function, the Arduino MEGA will take power from the USB PC connection. These USB ports can supply up to 900mA for USB3 (only 500mA for USB2) and this is enough current for our needs.INTERFACING
FOR SDR GROUNDSTATIONS
Only two straight through TRRS cables are needed for connecting two 3.5mm jacks to the PC soundcard and the headset (CTIA).
FOR ANALOGUE GROUNDSTATIONS
If uplinking with a CW radio in the traditional way no injected tone is necessary. In a full duplex radio setup, with independent up and down converter chains, we can just key CW with the uplink radio as done normally. In this case we would use this unit as an external memory keyer and audio mixer. The mixer will allow us to hear the sidetone of what we are transmitting whilst at the same time keeping an ear on what is being received from the downlink radio. All through the same headset.
Custom cables to connect the lines we want from each radio to the jack sockets on the back of the shield can be used. Like this, the keying, PTT, microphone and receiver audio lines can be routed correctly. An interface box of sorts would probably be the neatest solution to accomplish this.
The circuit can be configured for full duplex or, if our returned CW echo is too distracting, configured for QSK Break-In operation.
As a visual reminder and to help my tired eyes, I have used only coloured sockets for all the connections going to the operator and only black sockets for connections going to the radio. This avoids me mixing up TRS and TRRS 3.5mm cabling.CONSTRUCTION AND TESTING
THE SHIELD PCB
After designing and bench testing the circuit a suitable prototype was needed. Squeezing in all the various component parts whilst maintaining an aesthetic layout for the control buttons, trimmer pots, LCD and sockets was a somewhat demanding task. The use of separate grounds to reduce noise made the routing very laborious. The final routing ended up a bit of a dog's dinner but which works well. The whole circuit fits into a 10cm square double-sided PCB for easy fabrication and to keep the cost down.
For double sided PCBs, Chinese fabhouses usually have a price promotion for fabricating PCBs of size 10x10cm or less. In fact the postage, packing and customs cost will run much higher.
Like my other projects I have used mostly 0805 surface mount devices. This package size is small enough for compact PCBs yet still manageable to the human hand and eye.
The shield was designed to fit onto an easily available Arduino MEGA 2560 R3 board. Other more compact Chinese versions of the MEGA board are available but I have used the common R3 one. The smaller copies are very compact but since there is enough room under the shield for a standard MEGA 2560 R3 this is not of great advantage. Also, since the smaller Chinese boards have little to no standardization, some board versions may have differing size and pinout placements.
Be aware that not all Arduino MEGAs are created equally. Build quality does differ. There may also be discrete differences between boards. Missing ICSP header pins. Crystal or ceramic resonators. Reset switch placement. The price is often a reflection of the quality...but not always.
Using mainly SMD components a reflow oven was used after the laborious task of picking and placing the SMD components manually. A hotplate could also be utilized. Using a hot air gun or soldering iron is trickier but no doubt possible too.
Except for the LCD module, all through hole components were added afterwards. The LCD once soldered, will permanently cover the SMD components forming a good part of the circuit and so inhibit any access with test probes if we have an initial problem. Leaving the LCD module off for the time being still allows for loading the firmware and easy testing and fault finding.
Care should be observed when fitting the shield to the Arduino MEGA. The shield’s through hole leads should be short and not touching any of the MEGA’s ICSP header connector pins. Also the USB Type-B socket will sandwich between the two boards. To avoid any possible short-circuit unpleasantness between it’s grounded shroud and tracks running below the shield at this location, I put a piece of insulating tape on the top of the USB Type-B connector.
Be aware that there is an unused pin on Arduino boards. This is at the top left looking down on to the MEGA and is just above the IOREF pin. The shield ignores this header pin.
We can upload the K3NG keyer sketch to the MEGA in the normal way using the Arduino IDE. This can be done before or after fitting the MEGA to the shield. Still without the LCD module, on applying power the start up “HI” response from the keyer firmware should be heard over the piezo buzzer. If we connect paddles we can send CW. We can enter and exit the Command Mode with the blue LED showing this. Without an LCD circuit functions like the Twin-T oscillator, audio mixing, headphone amplifier, QSK Break-In muting can still all be checked. If there is a problem there is still the possibility of probing the circuit with an oscilloscope before covering it up for eternity with the display module.
Another way to do this initial test without worrying about the LCD module permanently covering the shield is to use different header pins. Replacing the LCD module’s male 16 pin header with a female header and then using a 16 pin male header on the shield. In this way the LCD can be plugged in and out at our convenience allowing both operation and access to the circuit below it if needed. The only drawback to this is that the LCD will sit higher on the shield which could be disadvantageous if size constraints matter on a finished unit. I myself tested everything like this. Then once satisfied all was working correctly I replaced it with a headerless module. The through holes of the headerless module slide in to the male header pins on the shield and can then be soldered. This retains the original height of the module on the shield.
Normally LCD modules have a black metal bezel holding the LCD to its board. This is held to the module with six metal tabs on the underside of it. Enough space around the SMD components has been left to accomodate these tabs if they rest on the board. However, since silkscreen is not classed as an insulator it may be prudent to raise them up a bit by soldering the module slightly elevated. I used plastic standoffs on the module to keep it from touching the PCB.
FRONT PANEL AND CASE
Another 10x10cm PCB serves as a front panel. It has cutouts for all the relevant synoptic components and controls. I fitted the stack of three PCBs which make up the unit inside a custom 3D enclosure which I designed and then printed in emergency orange PETG. This adds some protection and improves aesthetics.
The following provides a guide to configuring the K3NG firmware and interface it properly with the shield. Various I/O pins will also need to be defined for the circuit to work correctly. This can all be done using the standard Arduino IDE.
Three main files need to be edited:
Go here to enable or disable the various keyer modules, by commenting or uncommenting function code lines.
Go here to set specific keyer feature values.
Go here to define correct GPIO pins.
-CMOS SUPER KEYER
The firmware provides simulation of this classic keyer which is a favourite amongst many CW operators.
The K3NG firmware has a CMOS Super Keyer mode which can be enabled and customized. I finally found a replacement for my CMOS Super Keyer III which I built in 1998. Serving me well over all the years, it has a nice feel and it's timings are very forgiving. I still prefer to use it despite all modern radios having their own internal CW keyers.
#define default_cmos_super_keyer_iambic_b_timing_percent 33
// use with FEATURE_CMOS_SUPER_KEYER_IAMBIC_B_TIMING; should be between 0 to 99 % (0% = true iambic b;100% = iambic a behavior)
See Wiki entry 400: Operating Modes
This functionality allows interfacing with many logging programs for automatic and glitch free CW keying.
// comment out to revert to Winkey version 1 emulation
//Use when activating both FEATURE_WINKEY_EMULATION and FEATURE_COMMAND_LINE_INTERFACE simultaneously.
This will make Winkey emulation be the default at boot up. Hold command button down at boot up to activate CLI mode.
See Wiki entry 370: Winkey
If using Winkey the automatic software reset (ASR) must be disabled before connecting to the USB port. Otherwise on connecting, the microcontroller will be reset.After activating Winkey in "keyer_features_and_options.h" it is still possible to choose to use CLI mode by holding down the CMD button at power-up or restart. This means you can switch to and from either WinKeyer operation or the CLI.
A PS/2 keyboard can be connected to this port. Because of the Oscar 100 footprint coverage, the majority of satellite users will be needing non US keyboard layouts. These other keyboard layouts can be selected. There are German and French keyboard mappings available but these may need tweaking.
If operation becomes erratic or not function at all when powering from the MEGA's USB client port. This may be due to the computer USB ports not being able to supply enough current. The solution would be to power the unit directly from its barrel connector or from a USB powered hub.
Connector pin 4 to +5V
Connector pin 5 to D3 (Clock)
Connector pin 1 to A3 (Data)
Connector pin 3 to Ground
#define ps2_keyboard_clock 3
#define ps2_keyboard_data A3
Some keyboards (often mini keyboards) may require a reset code sent to them in order to function correctly:
The Perixx PERIBOARD-409 PS/2 mini-keyboard.
PS2 keyboards can still be found both new and used. I have used this very affordable keyboard sold through Amazon. However, together with the initial reset at power-up, the wait time needed for it to initialize needs to be increased. This is accomplished by adding a delay of 1 second before initialize in the "k3ng_keyer.ino" file.
See Wiki entry 340: Keyboard & Mouse
Input for dual lever paddles which is designed for a standard 3.5mm TRS (stereo) jack. Default wiring is Tip = Dit (or straight key), Ring = Dah, Sleeve = Ground.
Paddle wiring can easily be reversed in software using "N" in Command Mode (or "\n" with the Command Line Interface).
Tip = Dit to D5 and straight key to pin D52
Ring = Dah to D2
Sleeve = Ground
#define paddle_left 5
#define paddle_right 2
An input for a simple straight key.
It uses the same 3.5mm TRS (stereo) socket as for the paddle. Default wiring is Tip = Key (or paddle dit), Sleeve = Ground.
Tip to D52
#define pin_straight_key 52
It is preferred however, to ignore the straight key functionality, as having it enabled can cause timing issues when using paddles. With it disabled, if you boot the keyer with a properly wired straight key (or a paddle with one key grounded), the keyer will still function in straight key mode. This avoids any of the mentioned timing problems. Best to avoid this feature, unless you really need to swap between paddles and a straight key on the fly.
This is for the input of the resistance ladder forming the five memory pushbuttons.
Resistance ladder to A1
#define analog_buttons_number_of_buttons 6 //Includes the command button (ie: command button + 5 memory buttons = 6)
#define analog_buttons_r1 10
#define analog_buttons_r2 1
#define analog_buttons_pin A1
The rotary encoder allows navigation through the Command Mode choices. It incorporates a pushbutton.
SW to A1
A to D7 (CCW)
C to GND
B to D6 (CW)
//#define OPTION_ENCODER_HALF_STEP_MODE // Half-step mode?
#define rotary_pin1 6 // CW Encoder Pin
#define rotary_pin2 7 // CCW Encoder Pin
#define OPTION_ENCODER_ENABLE_PULLUPS //To enable weak pullups
-GOERTZEL AUDIO DECODER (OPTION)
A five pin header port is provided for optional decoder circuitry.
Header pin 2 to A0 (Goertzel)
Header pin 3 to A4 (External decoder)
Header pin 4 to D50 (Decoder LED)
#define cw_decoder_pin A4 //For use with external decoding hardware
#define cw_decoder_audio_input_pin A0
#define cw_decoder_indicator 50 // Output - goes HIGH when cw tone is detected by OPTION_CW_DECODER_GOERTZEL_AUDIO_DETECTOR
See Wiki entry 385: CW Decoder
A square wave is used to drive the onboard piezo sounder.
#define sidetone_line 4
See Wiki entry 225: Sidetone, PTT and TX Key Lines
For the 16 character by 2 line HD44780 display.
LCD pin RS to D40
LCD pin E to D30
LCD pin DB4 to D32
LCD pin DB5 to D34
LCD pin DB6 to D36
LCD pin DB7 to D38
#define FEATURE_LCD_4BIT // classic LCD display using 4 I/O lines
#define LCD_COLUMNS 16
#define LCD_ROWS 2
#define lcd_rs 40
#define lcd_enable 30
#define lcd_d4 32
#define lcd_d5 34
#define lcd_d6 36
#define lcd_d7 38
For synoptic display of some operations.
#define command_mode_active_led 28
#define correct_answer_led 27
#define wrong_answer_led 26
#define cw_decoder_indicator 50
For the CW keying and PTT control of to up to two radio transmitters.
KEY1 to D8
PTT1 to D10
KEY2 to D9
PTT2 to D11
The firmware supports multiple transmitters. One of up to six of these can be keyed. For our needs, the shield will only make available two TX connections. Each has a a CW keying line (KEY1 and KEY2) and a PTT line (PTT1 and PTT2).
The first, TX1, has the KEY1 line (on controller pin 8) to key a CW transmitter in the classic way. However, KEY1 is also used to generate a CW signal using an SSB only transmitter, like the one found in SDR Console. In parallel, it keys the Twin-T sinewave oscillator whose output will modulate an SSB transmitter to produce a faux CW signal. By using a separate tone generator we can ensure the purity of the transmitted sinewave. A good sinewave will ensure a narrow CW signal.
The second, TX2, has the KEY2 line (on controller pin 9) to key a CW transmitter in the classic way.
The shield must be configured to have KEY1 and KEY2 on GPIO pins 8 and 9 respectively (or left at zero if unused):
#define tx_key_line_1 8
#define tx_key_line_2 9
Logic high is used to switch the BS170 MOSFETs of the TX lines. This should also be correctly defined:
#define tx_key_line_active_state HIGH
#define tx_key_line_inactive_state LOW
Each of the TX keying outputs also has a working PTT line output with configurable lead and tail times. This feature is useful for driving amplifier T/R switches or transmitters that need a little more time to get keyed up.
Since the PTT1 line is also used to control the received audio muting switches, the tail time set for PTT1 is especially important as this will affect the QSK Break-In delay.
PTT1 and PTT2 lines should be set to pins 10 and 11 respectively (or left at zero if unused):
#define ptt_tx_1 10
#define ptt_tx_2 11
The active and inactive states of the PTT lines can be changed in your settings file with these lines:
#define ptt_line_active_state HIGH
#define ptt_line_inactive_state LOW
SETTING LEAD, TAIL AND HANG TIMING
These values can be changed using one of two methods.
1. By using the CLI:
This is probably the easiest way and will not affect any other EEPROM settings, however you will need to use extended CLI commands. These will need to be enabled beforehand by commenting out the line:
// #define OPTION_EXCLUDE_EXTENDED_CLI_COMMANDS
Then you may use the following extended commands (preceded with '\:') to change and review PTT timings:
pl [transmitter] [mS] - Set PTT lead time
pt [transmitter] [mS] - Set PTT tail time
pa [transmitter] [mS] - Set the Active time for the sequencer
pi [transmitter] [mS] - Set the Inactive time for the sequencer
comp [mS] - Set keying compensation time
timing - Lists the lead and tail times on all the PTT lines
The receiver audio mute switches are driven by the PTT1 line. Therefore, for adjusting QSK Break-In delay it’s necessary to use the tail time command on PTT1.
Example to change TX1 PTT tail time to 150mSecs:
\:pt 1 150
Sets PTT1 tail time to 150mSecs
To review the settings we can use:
Which would show something similar to the following:
TX Lead Tail
---- ------- ----
1 0 150
2 0 10
3 0 10
4 0 10
5 0 0
6 0 0
Example to change TX2 PTT tail time to 400mSecs and review settings:
\:pt 2 400
TX Lead Tail
---- ------- ----
1 0 150
2 0 400
3 0 10
4 0 10
5 0 0
6 0 0
2. By editing the keyer settings file:
If you have extended commands disabled, then the PTT lead and tail times can be taken from the values in the settings file and are written to EEPROM at first boot up.
#define initial_ptt_lead_time_tx1 10
#define initial_ptt_tail_time_tx1 10
#define initial_ptt_lead_time_tx2 10
#define initial_ptt_tail_time_tx2 10
#define initial_ptt_lead_time_tx3 10
#define initial_ptt_tail_time_tx3 10
#define initial_ptt_lead_time_tx4 10
#define initial_ptt_tail_time_tx4 10
#define initial_ptt_lead_time_tx5 10
#define initial_ptt_tail_time_tx5 10
#define initial_ptt_lead_time_tx6 10
#define initial_ptt_tail_time_tx6 10
If you need to change these timings, just edit these settings then recompile. After uploading to the MEGA a 'FACTORY RESET' must be performed at boot up (squeeze both paddles to reset). However be aware that this will also erase any memories previously saved.
See Wiki entry 225: Sidetone, PTT, and TX Key Lines.
https://github.com/k3ng/k3ng_cw_keyer/wiki/225-Sidetone, -PTT, -and-TX-Key-Lines
See Wiki entry 310: Command Line Interface.
See Wiki entry 835: Command Reference.
If using an SDR system to send CW by audio tone injection we may find that the soundcard or SDR software is slow to initially respond.
To pre-empt the loss of the first elements of the message a workaround is to manually switch to transmit just before starting to send our CW. Either with the 'TX' button, keyboard F5 key or a footswitch. If the PTT1 line is connected in the same way as a footswitch, this switching to transmit can be anticipated and automatic if a sufficient lead time is defined. Would this work sending with the paddles? Still untested by me.
Or leaving it in Tx during the QSO? With full duplex we still receive and when not keying there won't be any audio tone level for actual transmit drive.
- CW TRAINING MODULES
This works with the onboard piezoelectric sounder only.
Training can be entered using the CLI mode command "\k" :
Alphabet Send Practice can be entered using the Command Mode paddle command "S":
//enables Command Mode S
Send/Receive Progressive Echo Practice can be entered using the Command Mode paddle command "U":
#define FEATURE_COMMAND_MODE_PROGRESSIVE_5_CHAR_ECHO_PRACTICE //enables Command Mode U
A correct or incorrect answer is displayed by the green or red LEDs.
#define correct_answer_led 27
#define wrong_answer_led 26
See Wiki entry 495: CW Training Functionality
- EXTENDED COMMANDS
As mentioned above, some CLI commands require extended commands to be enabled by commenting the line which excludes them.
// #define OPTION_EXCLUDE_EXTENDED_CLI_COMMANDS
- FACTORY RESET
To reset the keyer to defaults, press both the left and right paddles and do a reset or power-up cycle. Be warned that this will wipe out all memories and change all the settings back to their defaults.
See Wiki entry 499: Performing a Factory Reset
A CW/MIC pushbutton is used to switch between SSB and CW modes. It routes either the headset's microphone signal or the transmit tone signal out to the radio. When switched to SSB a yellow warning LED will light up warning that the unit is in voice mode.
We never want to be switched to MIC on the CW portion of the band. If VOX is inadvertently active it will cause much unpleasantness.
To switch to and from SSB and CW on SDR Console can be as simple or as complicated as you like. It may require some previous preparation with particular settings which will depend on individual requirements.
- The transmit side should stay in SSB mode of course. Any microphone equalization disabled. A transmit bandpass filter can be defined and centered around 700Hz. This helps us to have a clean CW signal. These settings can be saved to the Microphone presets which define different profiles. I use 'Normal' for SSB and 'Other' for CW (and leave the 'DX' profile mostly for digital voice modes). Additionally, VOX and its triggering level should be enabled. Transmit drive level will probably need reducing.
- The receive side should be in CW mode and a suitable filter selected. RIT enabled with a shift of about 700Hz (our tone frequency) will be needed. It's best to send a test signal and then see where this lands in our receive bandwidth to check this RIT value. This way we will be receiving exactly where we are transmitting.
To help switch to and from CW and SSB, I wrote and printed out the procedure below. It's helpful to have this checklist when switching back and forth from each mode.USB to CW:
However, for fast mode changing, I can bypass much of this procedure. Leaving many settings as for SSB mode without any detrimental effect. Paying attention only to reducing the overall transmitted drive level and keeping a clean uplink.
Sync Rx (Freq)> OFF (or as required for simplex or split)
Sync Rx (Mode)> OFF
- If pre-defined
Gain> 60 to 90 (Should show very low ALC bargraph level)
[…] TX Options>
Audio In (Mic)>
Bandpass Filter> CW_700
Pre defined and saved as:
Low 600Hz Blackman
High 900Hz Filter Length 257
100dB Latency 2.7mS at 48KHz
VOX Gain> Adjust so it trips Tx.
VOX Hang> Adjust to desired QSK delay mSecs.
- End If.
[…] TX Options>
Receiver Mute> Mute Rx during Tx: Enabled = 0 (or as required)
RIT> Enable at -700Hz
Adjust drive and gain. Check CW on downlink for good/clean level.CW to USB:
Sync Rx (Freq)> ON
Sync Rx (Mode)> ON
- If pre-defined
Gain> 70 (Should show a normal ALC level on bargraph)
Processor Level> 30 (or as required)
[…] TX Options>
Audio In (Mic)>
Open: (relevant user file)
Bandpass Filter> 2.8KHz
- End If
Receiver Mute> Mute Rx during Tx: Enabled >= 1 (as required)
Adjust drive and gain. Check USB on downlink for good/clean level.PRIMARY COMPONENTS
Some components are non-critical and can be substituted for different types and packages. All passive SMD devices are of size 0805.
- Arduino MEGA 2560 R3.
- LCD Module HD44780 16x02.
- Passive piezo buzzer.
- Rotary encoder with push switch. Type EC11 or similar and of equal height and shaft type as the sidetone volume potentiometer (Command Mode control).
- NKE0505SC subminiature DC/DC Converter (isolated DC supply).
- Inductors 1.5uH, in 0805 size (DC filtering).
- LM2664 switched capacitor voltage converter (symmetrical power supply).
- 2N3904 Bipolar NPN transistor. The MMBT3904 used on the shield is a 2N3904 in a SOT-23 package (Twin-T oscillator).
- BS170 MOSFET. The MMBF170 used on the shield is a BS170 in SOT-23 package (KEY, PTT and audio switch driving).
- 1N4148 silicon diode (audio mute switching).
- PC817C optocouplers in SOP-4 SMD package (galvanic isolation).
- OPA4134 high performance low noise quad operational amplifier by Texas Instruments, in SOP14 package (buffer, amp, mixer).
- The TPA6111A2 small amplifier by Texas Instruments (stereo headphone amplifier).
- Trimmer potentiometers, all of type 3362P (crosshead+) although others with similar pinout spacings like 3386P (flat-) will also be suitable (onboard adjustments).
- Potentiometer 10K, Type RV09 or similar and of equal height and shaft type as the rotary encoder (sidetone volume level).
- TRRS 3.5mm jack socket, type PJ-320A (headset and radio connections).
- TRS 3.5mm jack socket, type PJ-307 (paddle, TX1 and TX2 connections).
- PS/2 6 pin mini DIN socket (keyboard connection).
- Tactile pushbuttons (memory keyer and hard reset).
- Header pins and jumpers, 0.1" (hard settings and optional connections).
- Female headers, 0.1" (Arduino MEGA connection).
- LEDs red, green, blue, yellow SMD 0805 (onboard synoptics).
CW WITH SSB
Although a dedicated CW keying input exists on some SDR transceivers, this is not the case for the Adalm Pluto or it’s variants which are in common use on many QO-100 ground systems. Some people have keyed later stages, after the Adalm Pluto Tx output, but with varying levels of success.
A viable solution is to generate a CW signal by feeding in an audio tone to the SDR software in SSB mode. Using a pure sinusoidal tone and facilities in the SDR software to equalise, filter and level adjust, we can attain a very clean CW signal.
THE PC CW PROBLEM
However, due to the inherent way Windows works, generating good CW timings has always been an elusive Holy Grail. The way a PC manages and shares its processing tasks will ultimately affect the smooth flow of CW being keyed in or out of the PC.
Keying CW into the PC
A few major hurdles have to be mitigate. Two of which are:
1. The overall processing load will affect the fluidity of gathering the CW being keyed into the PC via one of its ports. Getting this switched input into a PC and programming for a fast keying response is not that easy due to Windows timing issues.
2. The issue of using an audiocard SDR setup is that there can be an incurred and unpredictable audio latency. This may or may not be noticeable and depends on such things as computer performance, processor workload, audio card choice, ethernet use, etc. It can manifest itself as short delays and mini interruptions. These are not of great consequence when operating voice modes but can be noticeable on the aural fluidity of CW generated with an audio tone.
We can reduce this problem somewhat by minimizing the workload on Windows. Eliminating the use of unneeded applications and even not using certain functions of our SDR software may be beneficial.
However, even when using a seperate hardware unit to inject an audio tone for generating a CW uplink, ultimately we are still working with soundcards and SDR applications and so may suffer from their inherent timing shortcomings. Having said that I have used this system with my generic i7 PC andsoundcard with acceptable results...YMMV.
Keying CW out of a PC
The overall processing load will affect the fluidity of sent CW being keyed out of the PC via one of its ports. Getting a switched output from a PC and programming for a fast keying response is not that easy due to Windows timing issues.
This limitation of the PC has prompted solutions like the WinKeyer or Mortty units. These integrate Morse keying within applications and can run under the Windows, Linux or Mac operating systems. They ensure accurately timed CW characters and strings independent of PC processing load. Compatible logging programs send their CW data to the WinKeyer unit which then accurately formats the CW and keys the transmitter independently.BIBLIOGRAPHY
Arduino MEGA R3 information.
K3NG GitHub Wiki.
PERIBOARD-409 PS/2 Mini Keyboard discussion here.
Mono mixer and component choice inspiration.
To separate or not separate grounds.
Eduardo Erlemann, PY2RN YouTube channel.
Anthony Good, K3NG YouTube channel.
Getting started with keyer, first of two.
Automatic Software Reset (ASR).