Build A Simplified Arduino CW Trainer
Build A Simplified Arduino CW Trainer
September 16, 2016 version 2.1 (see the last page for V2 information)
The September 2016 issue of QST has my original article about the Arduino CW trainer.
That article does not have too much information on how to build the trainer. More infor-
mation is in this paper. Figure one shows the original CW trainer, figure two shows a
simplified version. The simplified version is easier to build because it does not have a
relay output or a connection for a nine volt battery through a switch. Both are not need-
ed for the trainer. The speaker will provide the audio output. The power is supplied by
Continued on page 3
Figure 3, Nine Volt Power Adapter, PID 63 Figure 4, Nine Volt Battery Case, PID 67
2
an AC adapter or an external nine volt battery. Adafruit has a nine volt battery case with
a plug that will plug in to the Arduino power connector. They also sell an AC adapter
that can be used. See Figures 3 and 4 for pictures of them. When searching for parts at
the adafruit website, enter the product number in their search box without a pid in front
of it. I have no connection to adafruit. You can buy parts anywhere but my LCD code
works with the adafruit LCD display and may not work with other displays. I have Hy-
perlinks for many of the parts in this document. To open a Hyperlink just click on the
blue underlined text.
Figure five shows a nine volt battery in a case powering a brand new Arduino. One
green LED is on and one yellow one is blinking. The brand new Arduinos are pro-
gramed to blink the yellow LED.
3
I used a clear plastic Lustroware 13 oz. food container to hold the completed CW Trainer.
The food container was the right size for the project and it was easy to drill holes in it. I
bought it at The Container Store here in Raleigh.
LS1 Speaker
J2, PS2 Keyboard
S2, Reset
push button U1, Arduino
Figure 6, The three circuit boards that make the Arduino CW Trainer.
Figure 6 shows the three circuit boards that make the Arduino CW Trainer. J1 and S1 are
not used.
4
Figure 7, The three circuit boards connected to each other and turned on.
The two white wires from the trainer to the speaker don’t show up very well. More
pictures are on the following pages.
5
Here is more information on the Proto Shield kit. It provides places to connect the
connectors, switch and speaker.
Figure nine show the parts that come with the Proto Shield kit, adafruit PID 2077. All the
parts are not needed for this project. For information on how to assemble it, go to the ada-
fruit website. On the 2077 product page, slide down to where it says, “Comes as a kit of
parts so you can choose how you want to configure your shield. However its ver y
easy to assemble even for beginning solderers. More information & instructions are avail-
able here. “. Click on More information and down load the PDF file. Read the document
and install the stacking headers. Do not use the plain headers shown on page 22 of the
document. Install the stacking headers and the two small capacitors. After that follow the
pictures on the next few pages.
Figure 10, adafruit Proto Shield kit with the stacking headers and two capacitors installed
6
Now add the speaker and PS2 Keyboard connector.
Figure 11, adafruit keyboard connector pid 804 and speaker pid 1890
Figure 12, Close up of the keyboard connector wiring and speaker wiring
7
PS/2 keyboard
connector
Speaker
Figure 14, This picture shows the reset pushbutton and the keying input added
Figure 16, RGB LCD Shield with a 16x2 character display, adafruit PID 714.
All the parts that make this RGB LCD shield are shown on the next page.
9
Figure 17, I2C controller and keypad shield kit for 16x2 LCD (PID 715).
Products
------------------------------------------------------
1 x 9 VDC 1000mA regulated switching power adapter - UL listed[ID:63] = $6.95
1 x PS/2 Wired Connector - Panel Mount MiniDIN-6[ID:804] = $3.95
1 x Arduino Uno R3 (Atmega328 - assembled)[ID:50] = $24.95
1 x RGB LCD Shield Kit w/ 16x2 Character Display - Only 2 pins used! (NEGATIVE
DISPLAY) [ID:714] = $24.95
1 x Adafruit Proto Shield for Arduino Kit - Stackable Version R3[ID:2077] = $9.95
------------------------------------------------------
Sub-Total: $70.75
United Parcel Service (1 pkg x 0.98 lbs total) (UPS GROUND): $8.55
Sales Tax: $0.00
Total: $79.30
I already had a Speaker, adafruit pid 1890 ($1.50) and did not buy another one. I also
had a momentary push button for the reset and a RCA jack for the keying input.
http://www.banggood.com/IIC-I2C-1602-Blue-Backlight-LCD-Display-Module-For-
Arduino-p-950726.html
http://www.banggood.com/UNO-R3-ATmega328P-Development-Board-For-Arduino-No
-Cable-p-964163.html
http://www.dx.com/c/electrical-tools-499/arduino-scm-supplies-436
Digikey stocks the PS/2 connector for $2.47. They will ship via US Mail for a lot less
than Adafruit. Digi-Key Part Number CP-2960-ND.
11
Programming the Arduino
You will need to program the Arduino with the trainer sketch (program). First you will
need the Arduino Development Environment (ADE) on your home computer. Chapter
five of the book ARRL book Arduino for Ham Radio has information about it. This web-
site also has information, https://www.arduino.cc/en/Guide/Environment.
The source code for the Trainer is on the ARRL website. Go to http://www.arrl.org/qst-in
-depth and look for the September issue and Trainer Sketch.
You will get an error when you compile the pr ogr am that reads like this.
To fix this error, edit the Mor seEnDecoder.cpp file and add const to line that star ts
with char morseTable[].
Here is the corrected line.
const char morseTable[] PROGMEM = "*5*H*4*S***V*3*I***F***U?
*_**2*E*&*L\"**R*+.****A***P@**W***J'1* *6-B*=*D*/"
12
The Morse Library is at http://www.w5obm.us/Arduino/ go to chapter 7 and then Morse. I
copied all the files keyworks.txt, Morse.cpp, Morse.h and a directory of Examples to my sys-
tem. The directory is C:\Program Files (x86)\Arduino\libraries\Morse.
Once you have all the items on your computer you can use the ADE to program the Arduino
via the computer’s and Arduino USB ports.
I tried a USB keyboard on this project by buying a USB to PS2 adapter at Office
Depot. It will convert a USB keyboard to a PS2 connector. It did not work.
13
PS/2 Keyboard Keyer
PS/2 keyboard
connected to J2
Power in
From the
Keyer’s output
Connected to J3
1 2 3 4 5 6 7 8 9 10
K M R S U A P T L O
11 12 13 14 15 16 17 18 19 20
W I . N J E F 0 Y V
21 22 23 24 25 26 27 28 29 30
. G 5 / Q 9 Z H 3 8
31 32 33 34 35 36 37 38 39 40
B ? 4 2 7 C 1 D 6 X
15
Using the Arduino CW Trainer
Learn to send.
The first thing to do is learn how to send so that the trainer can copy your code.
Turn on the trainer and push D. That will run the decoder only. Now send to the
trainer. Make sure your sending can be copied by the trainer. I found that I need to
leave a little more space between each character.
Now use the Kotch method to learn the sound of each character. Push F5 followed
by a 1. Push the right and left arrows so that you have 2 characters selected. Then
push F10 to save the values. Now push G for go. The trainer will send you K and
K. You send K and K back. After you know the sound of K push reset. Now push
F5 followed by a 2. Now push F10 and G. The trainer will send you K and M.
Now send K and M back with out looking at the display so that you learn the
sounds. Keep doing this with more and more characters until you know all of
them. You can use F6 to set a different starting point in the Kotch method.
Now change the number of characters sent from 2 to higher numbers, and practice
remembering what was sent, again with out looking at the display and not writing
anything down.
If you stop one day and come back the next day the trainer will remember where
you left off because you pushed F10. If you want to continue where you were the
day before all you have to do is push G.
As I said in the article I am not an expert on learning the code. Jack W0UCE (SK)
was. Do a google search on “W0UCE's method for teaching CW” and read what
he wrote. Also look at www.kb6nu.com/another-method-for-teaching-and-
learning-morse-code.
73 Tom, N4TL
16
September 16, 2016, Version 2.1
I updated the sketch after receiving feedback from some users.
Added F7, This is used slow down sending by putting a delay between characters. Zero to
30 can be entered. Each count is 0.01 seconds. I found a number of 10 to 20 will slow the
sending down okay. This delay allows the characters to be sent a full speed with delay be-
tween each character. This is called the Farnsworth method. So now you can use the
Koch and Farnsworth methods at the same time.
Added P to the keyboard control. When P is pushed the trainer will send PARIS over and
over again until reset is pushed The length of time it takes to send PARIS divided in to 60
gives the speed in WPM. I changed the Key_speed_adj = -2 and measured these speeds. I
don’t know if different processor speeds will change these speeds.
Modified D, when characters are written to a new line, it is blanked first instead of being
overwritten. The characters are also written to the serial monitor.
One bug was fixed. Up to 10 characters are stored and compared to the student's sending.
The right arrow routine allowed up to 15. This was changed to 10. I did some code clean-
up and added a few constants. When the trainer first starts, I added a period after N4TL.
That allows me to know I am running the second version.
I may write another sketch that will send short words. If I do I will put information about
it on QRZ under my call’s information, and at QSL net, www.qsl.net/n4tl.
If you build a Arduino CW Trainer please let me know by sending me your name and call
via email, n4tl2 at yahoo.com, thanks.
73 Tom N4TL
17