Nanokeyer Building Instructions PCB Rev d1 PDF
Nanokeyer Building Instructions PCB Rev d1 PDF
Nanokeyer Building Instructions PCB Rev d1 PDF
Introducing…
by Oscar, DJ0MY
nanoKeyer Kit, PCB REV. D
I hope you will enjoy it and have a great building and operating
experience with it.
This is an open-source hardware project solely for private and hobby reasons.
While everybody may participate and use the data in this document for his
personal and hobby purposes it is explicitly not permitted to use any of the
data in the document or files from the nanoKeyer website or project for
commercial purposes, whatsoever.
Oscar, DJ0MY
nanoKeyer Kit, PCB REV. D
Attention:
This keyer kit requires in addition an Arduino Nano microcontroller plug-in board. The
Arduino Nano must be purchased separately from one of the various Arduino dealers.
Make sure to use only an Arduino Nano V3.0 (or compatible) based on a ATMEGA 328 chip.
The Arduino Nano V2.x, which is ATMEGA 168 based, has not sufficient flash memory to hold
the size required by the K3NG Arduino keyer source code.
No entries yet…
nanoKeyer Kit, PCB REV. D
Bill of Materials
Before starting to build your kit we strongly suggest to make an inventory and
check if all parts are supplied as listed below.
Note:
Since this is an open source hardware project we provide the parts source (mostly from
www.reichelt.de in Germany) for all footprint critical parts. Parts from other manufacturers
may not fit the PCB holes or may even have a different pin polarity.
Also the LED’s are given with its part numbers, because the current limiting resistors are
adapted to this specific type of LEDs and each LED color requires a different current setup,
since they are operated in low current mode to avoid overloading the Arduino digital pins.
If you use alternative LEDs please make sure to adapt R7-9 to values resulting in e.g. 2-8mA
current at the LEDs specified operating voltage. Operating at the typical 20mA may overload
the Arduino digital pins, since the LEDs are operated in parallel to the optocouplers…
nanoKeyer Kit, PCB REV. D
Technical Specifications:
The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated
external power supply (via pin 30), or 5V regulated external power supply (via pin 27).
The power source is automatically selected to the highest voltage source.
nanoKeyer:
In case you need to switch older radios (e.g. tube radios or power amplifiers) you may need to
change the voltage limiting resistors R2 and R3 and replace the TLP621 by higher rating
optocouplers such as TLP627 (150mA) or use solid state relays in pin compatible packages
nanoKeyer Kit, PCB REV. D
Preparation Work
Before you start building the keyer please read the following information regarding the
female headers used as a socket for the Arduino Nano plug-in board.
The Arduino Nano has a total of 30 pins, therefore you will need only 2 x 15 pins.
The remaining 5 pins need to be cut-off from the headers prior to building the kit using a
small saw or a wire cutting pliers (as on the photo below).
CAUTION:
Please cut in the centre of the 16th pin or you will destroy the headers !
(cutting exactly between the pins will not work due to the fragile plastic)
It is recommended to chose an
enclosure first and have the LED
holes drilled so that you can
adapt the lead lenghts during
enclosure mounting.
nanoKeyer Kit, PCB REV. D
1. If you do not plan to build the PCB into an enclosure and use it as an open PCB
module you will operate the nanoKeyer from the top side and therefore you will
need to mount the buttons on the component side
2. If you plan to build the PCB into an enclosure you would mount the PCB upside down
and therefore need to mount the buttons on the solder side. See pictures on the next
page. When mounting this way make sure the K3NG firware is compiled with this
option “uncommented” to reverse the button order response of the Firmware:
Buttons mounted on top side (for “open use”) Buttons mounted on solder side (for enclosure use)
nanoKeyer Kit, PCB REV. D
Enclosure mounting
The nanoKeyer PCB can be built into a standard enclosure of your choice by means of the
four mounting holes and using standoffs and screws. It is advisable to do the up-side-down
mounting option in this case.
The completed keyer board (REV. B shown here) should look like this:
See my website for the firmware file adapted specially to PCB REV. D:
http://nanokeyer.wordpress.com (in the downloads section)
The firmware file from my site is already preconfigured with the recommended source
code features in ANNEX I.
ANNEX I
For making maximum use of the nanoKeyer hardware features we suggest to compile the
following features of the K3NG sourcecode:
To make the PS2 keyboard library to compile without errors I suggest to copy the library files
(PS2Keyboard.cpp and PS2Keyboard.h) into a new subfolder (named PS2Keyboard) of the
library folder of your Arduino IDE installation location on the HDD.
(see K3NG website)
#define FEATURE_SERIAL
#define FEATURE_WINKEY_EMULATION
#define FEATURE_SAY_HI
#define FEATURE_MEMORIES
#define FEATURE_POTENTIOMETER
#define FEATURE_PS2_KEYBOARD
#define FEATURE_DEAD_OP_WATCHDOG
#define FEATURE_AUTOSPACE
#define FEATURE_FARNSWORTH
#define OPTION_INCLUDE_PTT_TAIL_FOR_MANUAL_SENDING
#define OPTION_SERIAL_PORT_DEFAULT_WINKEY_EMULATION
PS2Keyboard keyboard
All other default features should be disabled (“commented” out with // at the beginning of
each line). Otherwise the compiled binary file becomes too large and does not fit into the
Arduino Nano flash memory of approx.. 30kB anymore.
nanoKeyer Kit, PCB REV. D
ANNEX II
Source: http://radioartisan.wordpress.com/arduino-cw-keyer/
Here are the main pins you need to connect up to get started:
Left Paddle – pin 2 – connect to your left paddle (grounding will send dits)
Right Paddle – pin 5 – connect to your right paddle (grounding will send dahs)
Transmitter Key – pin 11 – goes high for key down; use to drive a transistor to ground the TX
key
Sidetone – pin 4 – this outputs square wave sidetone to drive a speaker (schematic coming
out shortly for driving with a transistor). The sidetone can be deactivated on transmit for
transmitters that generate their own sidetone.
The command button – pin A1 and at least R7
Memory buttons, up to 12. Add buttons and resistors R8, R9, R10, etc. (You can do just a few
memory buttons, all 12, or none at all.
All pins can be easily changed at the beginning of the code if desired, though note that if the
PS2 keyboard functionality is used, the clock pin must remain at pin 3 due to interrupt
requirements. Also, the future optional I2C functionality which is in development must use
pins A4 and A5.
Buttons
Button 0 is the command button. Pressing it will put the keyer into command mode which is
described in detail below. Holding down the command button and pressing the left or right
paddles will increase or decrease the CW speed.
Buttons 1 through 12 will play memories when momentarily depressed. To have a memory
autorepeat (such as for doing a repetitive CQ), hold down the memory button and tap the left
paddle. Holding buttons 1 through 6 down for a half second will switch the transmitter (1
through 6), if multiple PTT lines are enabled.
nanoKeyer Kit, PCB REV. D
Command Mode
To enter command mode, press button 0, the command button and you will hear a “boop
beep”, after which you can enter various commands by sending character using the paddle.
(Note that if you’re in bug or straight key mode, you will temporarily be switched to iambic in
command mode.)
If you enter a bogus command or the keyer didn’t recognize the character you sent, it will
send a question mark, upon which you can retry your command.
To exit command mode, send X in CW using the paddles or just press the command button
again upon which you will hear “beep boop” and you’ll be back in regular sending mode.
I – TX enable / disable
P# – Program a memory
T – Tune mode
W – Change speed
X – Exit command mode (you can also press the command button (button0) to exit)
Z – Autospace On/Off
The keyer has a serial command line interface using the built in Arduino USB port. Simply
connect to your computer and use a terminal program such as the Arduino serial port program
or Putty. If you use the Arduino program, it’s recommended that you set it for carriage return
(lower right).
To use the CW keyer functionality, simply type in what you want to send. In the Arduino
serial interface you will need to hit Enter to send the data to the keyer for it to start sending.
Programs like Putty will immediately send the characters and the keyer will send the code
immediately as well.
Commands are preceded with a backslash (” \ “), the key above your Enter key (at least on US
PC keyboards). To see a help screen, enter backslash question mark ” \? ” (no quotes). The
status command (\s) is a useful command for viewing various settings and seeing the contents
of the memories. If you enter a double backslash (“\\”), all sending buffers will be cleared and
any memory sending will stop (this includes sending invoked by the PS2 keyboard or Winkey
interface emulation features).
CLI Commands:
\? Help
\# Play memory #
\a Iambic A mode
\b Iambic B mode
\d Ultimatic mode
\g Bug mode
\i Transmit enable/disable
\s Status
nanoKeyer Kit, PCB REV. D
\t Tune mode
\~ Reset unit
To enable the CLI, you must uncomment two lines in the source code before compilation:
#define FEATURE_SERIAL
#define FEATURE_COMMAND_LINE_INTERFACE
CW Speed Adjustment
The speed potentiometer can also adjust the speed. The pot must first be activated using the
command mode V command or command line \v command. Adjusting the speed pot will
immediately change the CW speed during manual sending or memory playing, however its
changes will not be written to non-volatile memory. If the speed is changed using other
methods (command mode, command line interface, memory macro, command button
shortcut) that will override the pot setting until the pot is adjusted again.
nanoKeyer Kit, PCB REV. D
Beacon Mode
In order to have the keyer go directly into beacon mode at power up or reset and stay in
beacon mode, simply ground pin 2. This is useful for keyers that are dedicated to beacon or
fox service.
Iambic Modes
To switch to Iambic A mode, use the A command in command mode or \a in the command
line interface.
To switch to Iambic B mode, use the B command in command mode or \b in the command
line interface.
To go into straight key mode, hold down the right paddle when powering up or power
resetting.
Bug Mode
To go into bug mode, use the command mode G command or the command line \g command.
Ultimate Mode
To go into Ultimatic mode, use the command mode D command or the command line \d
command.
Sidetone Line
The sidetone line normally outputs square wave sidetone for driving a speaker. Sidetone can
be disabled on transmit using the command mode O command. This is for transmitters that
generate their own sidetone.
The sidetone frequency can be adjusted using the F command in command mode.
The PTT pins go high whenever code is sent. If it’s desired to have the PTT line go high
before code is sent or stay high for a period of time after code stops being sent, these two lines
can be adjusted:
The lead and tail times are in milliseconds. This feature is useful for driving T/R switches or
older transmitters than need a little more time to get keyed up, or FM fox transmitters that
need to have PTT keyed and sidetone pumped into the microphone line.
PTT tail time is invoked when sending code automatically, such as via a memory play, the
CLI, the PS2 keyboard, or Winkey interface emulation. PTT hang time is invoked for manual
sending using the paddle and is speed (wpm) dependent.
Note that if you activate PTT lead time, you should activate tail time as well, otherwise PTT
lead time will be invoked before each dit or dah, significantly slowing down the sending
speed.
Currently PTT lead, tail, and hang times can only be changed at runtime using the Winkey
interface emulation. (Let me know if you would like CLI commands to do this.)
For testing purposes the PTT line can be manually toggled on and off using the \u CLI
command.
If your CW transmitter keys up when the CW line is keyed (or you are not going to use multi-
transmitter support), there is probably no need to use the PTT line.
If you do not need the PTT lines and wish to use the Arduino pins for another function such as
a transmitter keying line, simply set the pin number to zero, as so:
#define ptt_tx_1 0
#define ptt_tx_2 0
QRSS mode can be activated using the command line \q command or in memory macros
using the \q macro. Both take the dit length in seconds (double digit number) as an argument.
For example: \q09 would put the keyer in QRSS mode with nine second long dits (and 27
second long dahs).
The \r command will switch back to regular CW speed mode in both the command line and in
memories.
High speed CW can be accomplished by using the \w command line interface command or in
memories as a macro. Whereas the command mode speed adjustment and the speed
potentiometer allow the speed to go up to a maximum of 60 WPM, the \w command will let
you take it up to 255 WPM.
Hellschreiber
The keyer will send Hellschreiber characters by placing it in Hellscreiber mode using the \h
command in the serial command line interface or memory macros. In the command line
interface \c will return the keyer to CW mode and the \l (as in lima) memory macro will
change back to CW. While in Hellschreiber mode, the paddle will still send CW. The
Hellschreiber mode is intended mainly for beacons but works just find for direct keyboard
sending.
Hellschreiber Copied From the Keyer Speaker into a Laptop (click to enlarge)
Memories can be manually played using buttons 1 through 5, or using the \# command in the
command line interface (for example, \1 plays memory 1). In command mode the memories
can be sent without transmitting by entering the number of the memory.
Memories are programmed using the command line interface \p# command or in command
mode using the P command.
To program memory 1 using command mode, enter command mode by pressing the
command button and sending the P command. After hearing a beep, send the CW code to be
stored and when finished, hit the command button to exit programming. The keyer will then
play back the memory. If the keyer didn’t recognize a character you sent it will send a
question mark in its place.
\u Activate PTT
\v Deactivate PTT
(Note that both command line commands and CW memories are case insensitive.)
#define number_of_memories 12
#define memory_area_start 20
nanoKeyer Kit, PCB REV. D
Up to 12 memories can be configured, with some caveats. Nine memories are supported in the
CLI and in memory macros, and the full 12 are supported with the PS2 keyboard.
Memory_area_start and memory_area_end define the starting and ending EEPROM locations
for the entire bank of memory. The memory area is divided up evenly between the memories.
The example settings above will result in 12 memories each with 83 bytes, or 83 characters.
The CW dash length to dot length ratio can be adjusted using the J command in command
mode. Upon entering the J command you will hear a repeating dit dah. Use the left and right
paddles to shorten or lengthen the dah. Squeeze both paddles to exit the weight adjust
command. After that you can enter X or press the command button to exit command mode.
The ratio can also be adjusted in the command line interface using the \j command. \j300 sets
the keyer for a normal 3:1 ratio, \j250 would set it for a 2.5:1 ratio, for example.
Paddle Reverse
The command mode N command switches the left and right paddles. The equivalent function
in the CLI is \n and using the PS2 keyboard it’s CTRL-N.
Tune Mode
The command mode T command or command line interface \t command goes into tune up
mode. In the PS2 keyboard, use CTRL-T.
TX Disable / Enable
The transmit line can be disabled and enabled using the \i CLI command or I command in
command mode. The equivalent PS2 keyboard command is CTRL-I. This feature can be used
for sending practice without keying the transmitter.
Autospace
The autospace feature can be toggled on and off with the Z command in command mode, the
\z command in the command line interface, and CTRL-Z using the PS2 keyboard. This
feature “cleans up” manual sending a bit by automatically inserting a wordspace delay if the
operator waits more than one dit after sending a dit or dah to paddle either paddle. The
autospace feature is activated by uncommenting this line:
nanoKeyer Kit, PCB REV. D
#define FEATURE_AUTOSPACE
Wordspace Adjustment
Wordspace is the key up time in between words. By default it is set for seven dit lengths by
this line:
#define default_length_wordspace 7
Keying Compensation
The keying compensation filter extends the time of both dits and dahs to compensate for older
transmitters that are slow on the draw in QSK at higher speeds. The inter-element key up
times are reduced a corresponding amount of time. The time in mS can be set here:
#define default_keying_compensation 0
Currently there is no command to adjust this at runtime, however the Winkey emulation will
adjust this if it is set in the host application.
This feature makes the first dit or dah sent longer to compensate for slow T/R switches in rigs.
The time is set here:
#define default_first_extension_time 0
Currently there is no command to adjust this at runtime, however the Winkey emulation will
adjust this if it is set in the host application.
Prosigns
Custom prosigns can be sent using \+ in the CLI or in memories as a macro. Several “hard
wired” / common prosigns are available for various keys on the PS2 keyboard like =, -, &,
etc. and the Sroll Lock key can be used to create custom prosigns on the fly.
In the command line interface the \k goes into callsign receive practice. Random callsigns are
sent, the user enters the received callsigns, and the keyer will tell the user if they were correct.
Currently this code produces only US callsigns. I’ll be working on enhancements later to add
other country callsigns, allow various user settings and adjustments, and variable speed based
on the user’s accuracy.
nanoKeyer Kit, PCB REV. D
#define FEATURE_CALLSIGN_RECEIVE_PRACTICE
A common PC keyboard (PS2) can be interfaced with the keyer to create a computerless CW
keyboard. Here’s what you need to do:
1. Download the modified PS2Keyboard library files below. Create a directory in your
sketchbook directory called PS2Keyboard and place the two files in there.
#include <PS2Keyboard.h>
Keyboard keyboard;
3. Connect up a PS2 keyboard to your Arduino. Details on the pinouts of a PS2 keyboard
connector can be found here.
CTRL-T – Tune
Myself and others have experienced issues using just the USB +5V to power the Arduino and
keyboard, with operation being erratic or the keyboard just not functioning at all. This is due
to computer USB ports not being able to supply enough current. The solution is simple: power
the Arduino board directly using the power connector.
nanoKeyer Kit, PCB REV. D
Note that the keyboard data line can be relocated to other pins if desired, but the keyboard
clock line must remain at pin 3 as that pin has special functionality for interrupt operation
which is required by the PS2 keyboard library code.
The keyer can be interfaced to logging and contest programs with the Winkey emulation
feature. To enable, uncomment the following line:
#define FEATURE_WINKEY_EMULATION
If you want compile both the CLI and Winkey emulation features and upload to a unit,
uncommenting the line below will cause the unit to default to Winkey emulation rather than
the normal Command Line Interface mode at power up or reset.
#define SERIAL_PORT_DEFAULT_WINKEY_EMULATION
With the Winkey emulation feature enabled, if you hold down the command button (button 0)
and reset or power up the unit, it will go into the non-default mode. (If the default is Winkey
Emulation, it will go into Command Line Interface mode, and vice versa.)
You may need to disable some features to get both the CLI and Winkey features to fit into an
Arduino Uno. Other larger Arduino variants may be able to host all features. (Your mileage
may vary.)
In Winkey Emulation mode the USB port will be set for 1200 baud. The emulation is a 99.9%
complete emulation, and it should work with most programs that support Winkey interfacing.
The N1MM contesting program and Ham Radio Deluxe (HRD) have been tested and work
with all features I’ve tried.
Autospace
PTT Lead, Tail, and Hang Time
Speed Pot Setup and Query
First Extension
Software Paddle
Weighting
HSCW
Serial Echoback
Prosigns
This functionality is intended to interface to logging and contest programs and is not intended
to be a Winkey replacement. The Winkey “protocol” is a de facto standard and many
programs support it, and developing an open standard protocol and getting all the major
programs to support it would be a monumental undertaking. So it made sense to merely
emulate the existing protocol everyone else is talking.
I have found to have this emulation work reliably with programs other than N1MM, you
should disable the Arduino Automatic Software Reset described here. This is done by
cutting the PC board trace labeled RESET-EN on the Arduino Uno board. I have found with
some programs, including HRD and the Winkeyer WKDemo program, when the program
connects to the COM port, errant bytes are interpreted/received by the Arduino which trips up
the protocol conversation and the program and keyer will not connect. In this configuration
the keyer will not reset when a program connects to the COM port and it will be “ready to
talk” immediately when the program begins sending bytes.
If you do not disable Automatic Software Reset and are using Ham Radio Deluxe uncomment
the following line:
#define OPTION_WINKEY_DISCARD_BYTES_AT_STARTUP
This option will discard the first three bytes that arrive on the USB port. This hack works for
my hardware, but your mileage may vary. The number of bytes discards at start up can be set
here:
#define winkey_discard_bytes_startup 3
A side effect of disabling Automatic Software Reset is that you will need to manually hit the
reset button when uploading new software to the Arduino. The button should be pressed as
soon as you “Binary sketch size: xxxxx bytes” message in the Arduino program.
In the current build of HRD I’m using, there is a bug in its Winkey interface implementation.
If you rapidly change the dah to dit ratio in the graphical user interface or change the speed
rapidly, HRD will send incomplete commands to the Winkey. This will cause errant
characters to be sent by the keyer, but otherwise the keyer will continue to function.
Ham Radio Deluxe offers a very nice Winkey settings interface. Presumably one could use
this interface in place of the keyer command mode or command line interface and control
most of the functionality in this keyer.
nanoKeyer Kit, PCB REV. D
If you attempt to use this emulation with other programs and have issues, please let me know
and I’ll attempt to figure it out. Serial port sniffer captures are helpful in troubleshooting these
issues.
This feature turns off the transmit line after 100 consecutive dits or dahs. It can be enabled by
uncommenting this line:
#define FEATURE_DEAD_OP_WATCHDOG
Most settings are stored in non-volatile EEPROM memory. Memory macros which alter the
CW speed are not stored to EEPROM as to avoid “wearing out” EEPROM locations,
especially in beacon mode.
Reset to Defaults
In order to reset the keyer to defaults, depress both the left and right paddles and do a reset or
power reset. This will wipe out all memories and change all the settings back to defaults.
Multi-Transmitter Capability
This keyer supports multiple transmitters that can be selected using the \x CLI command, the
CTRL-F1, F2, etc. key combinations on the PS2 keyboard, or using the hardware buttons
(button0 hold + button1, button2, etc.). The code by default has two PTT pins defined, pins 13
and 12 which are transmitters 1 and 2, respectively. Up to six transmitter PTT lines can be
defined by configuring this code:
#define ptt_tx_1 13
#define ptt_tx_2 12
#define ptt_tx_3 0
#define ptt_tx_4 0
#define ptt_tx_5 0
#define ptt_tx_6 0
Setting a line to zero disables it. Obviously, with the Arduino Uno, pins are at a premium and
each features uses pins. Larger Arduino platforms like the Mega offer more pins and more
compiled-in functionality due to the larger memory space.
nanoKeyer Kit, PCB REV. D
Code Compilation
All of the features will not fit on an Arduino Uno simultaneously. I find that when the
compiled code goes over about 29K, the upload to the Uno will fail.
I’m in the process of getting an Arduino Mega. The code here should compile just fine for
that platform, and with 128K of flash memory it should easily hold all of the program
functions.
Miscellaneous Notes
To use “legacy style” buttons (one button per I/O pin), uncomment this line:
#define FEATURE_LEGACY_BUTTONS
Do not enable the potentiometer feature if you do not have a potentiometer connected,
otherwise noise on the pin will falsely trigger wpm changes.