2017年7月23日 星期日

sbKeyer Introduction and Assembly

sbKeyer
 Introduction and Assembly
by Vincent Lee/bv3ue

Why I build this Kit ?
K3NG build a beauty code for Arduino based Keyer and I think most of people is excited and want to try it immediately. As an old flow, breadboard plug-and-play is the fastest way to work for it. Yes, I went the old flow. As you can see in the following picture - a breadboard, an Arduino Nano board, some resistors/capacitors/LED/Buzzer, some jumping wires, some soldering for phone jack and rotary encoder. It takes 30 minutes to 1 hour to assembly then you can start to practice the CW code.


Figure 1 Breadboard assembly for the K3NG Keyer

Can we shortage for components in our trash box ? Can we buy something wrong in the store ? Yes, it happened. We just take time to drive out to buy something again or mail order to wait for days. Oscar/DJ0MY had provided a nanoKeyer kit for us.   (https://nanokeyer.wordpress.com/). After the assembly, you need to install an Arduino Nano board, one suitable case with some hole-drilling preparation then it is done. Is there someone to provide a kit, and we just “plug-and-play” ? It seems the Martin/OK1RR provide a detail information(http://www.ok1rr.com/index.php/technical-topics/122-the-tinykeyer) to build and named it as tinyKeyer. Martin provides it as kit to the interested people. Based on the same simplicity idea, I built my own and also provide as a kit to the interested people. After receiving the built kit in a sturdy box, you connect it with paddle and mini-USB cable to computer, then you can start to tweak the code to meet your need. If you need the basic feature as command line interface(CLI), memory macro and training practice. OK, that is what I preset for you. You spare your time in hardware preparation and focus on software tweaking and field usage.

Listing in the website, the features for the K3NG keyer,
We can’t compile all these features into an Arduino Nano board with only 32KB flash memory and 2KB SRAM. To get a full feature keyer, Arduino MEGA2560 or Teensy 3.2 is required.

The code I used is released at “2017.06.28.02” to compile with Arduino 1.6.12.
What is the sbKeyer ? “sb” is the short name for small box or sturdy box

I am not an experienced CW operator and also not join the contest. So I added following features at “keyer_features_and_options.h” to work for CW practice.
#define FEATURE_COMMAND_LINE_INTERFACE
#define FEATURE_MEMORIES
#define FEATURE_TRAINING_COMMAND_LINE_INTERFACE
#define FEATURE_ROTARY_ENCODER

The I/O pins definition for Paddle, rotary encoder, PTT, LED, Buzzer etc. are defined at “keyer_pin_settings.h” as
#define paddle_left 2                   //sbKeyer, PADDL left
#define paddle_right 5                //sbKeyer, PADDLE right
#define sidetone_line 4               //sbKeyer, connect a speaker for sidetone
#define tx_key_line_1 12            //sbKeyer, KEY
#define ptt_tx_1 13                     //sbKeyer, PTT
#ifdef FEATURE_COMMAND_BUTTONS
  #define analog_buttons_pin A1             //sbKeyer, command button sense
  #define command_mode_active_led 9  //sbKeyer, green LED
#endif //FEATURE_COMMAND_BUTTONS
#ifdef FEATURE_ROTARY_ENCODER
  #define OPTION_ENCODER_HALF_STEP_MODE  // Half-step mode?
  #define rotary_pin1 10                          //sbKeyer, CW Encoder Pin
  #define rotary_pin2 11                          //sbKeyer, CCW Encoder Pin
  #define OPTION_ENCODER_ENABLE_PULLUPS  // define to enable weak pullups.
#endif //FEATURE_ROTARY_ENCODER

In addition, D3/D6/D7/D8/A3/A4(SDA)/A5(SCL) is pulled out for future expansion. These pin assignment can be checked with Figure 2 schematic.
The whole listing of “keyer_features_and_options.h” and “keyer_pin_settings.h” is shown in Appendix
The compilation log displayed the Flash memory usage is 99% !!


Sketch uses 30,482 bytes (99%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,045 bytes (51%) of dynamic memory, leaving 1,003 bytes for local variables. Maximum is 2,048 bytes






Schematic

Figure 2 sbKeyer schematic

The pins assignment for the board are
1.      DIH/left and DAH/right for paddle – D2 and D5
2.      PTT and KEY to transceiver – D13 and D12
3.      CW and CCW for rotary encoder – D10 and D11
4.      Command and CW/Buzzer LED indicator – D9 and D4

a.      For someone need the LED to indicate the CW activity but don’t want to hear the sound, the SWBUZ jumper can work for that requirement. You can also use the command (\o) to turn-off the CW activity to LED and buzzer.
b.      C1(10mF) and ASR is used to inhibit the programming capability to the Nano board. When C1 is populated and ASM jumper is shorted, the Nano board can’t be programmed thru the USB interface.
c.      R7 and de-bounce capacitor over the rotary encoder is an option and they are not populated

PCB








Figure 3 sbKeyer PCB and assembled board

The PCB board is fixed in the box with sliding slot. No screw bot necessary. The front cover and back cover panel is also prepared with PCB without further hole drilling and labeling necessary.

Bill of Material
Designators
Description
Quantity
R1, R2, R3, R4, R6
10K, 0805 resistor(top code 103)
5
Q1, Q2
2N7002, SOT23 NCH MOSFET
2
R8, R9
1K, 0805 resistor(top code 102)
2
R5G, R5R
1K, 0805 resistor(top code 102)
2
R7
5K, 0805 resistor(option)
1
BRD1
Arduino Nano board(CH340 USB to UART)
1
BUZZ
Piezo buzzer(match the “+“ sign in PCB and buzzer)
1
C1
10uF, capacitor with polarity(top code 106)
1
C2, C3, C4, C5
1nF, 0805 capacitor(top code 102)
4
C6A, C6B
47nF, 0805 capacitor for debounce(option)
2
ASR
Jumper to inhibit the programming(short to inhibit)
1
PGND
Ground pin
1
RE1
Rotary encoder with switch
1
GPIO
I/O pins pull-out for experiment
- A3/A4(SDA)/A5(SCL) and D3/D6/D7/D8
1
LDCMD_GR
LED for Command(green) and CW activity(red)
- stack together with socket
1
LDBUZ_RED
1
PDL, PTT
Stereo phone jack
- 3 conductor jack with 2 break contacts (normal)
and 2 auxiliary make contacts
2
PCB
Main, front and back panel PCB
3
Metal Box
60x46x20(LxWxH) mm Aluminum box
1

Assembly Instruction
1.  Mount the backside and topside SMD components
R1/R2/R3/R4/R6/R5G/R5R/R8/R9, C1/C2/C3/C4/C5, Q1/Q2
2.  Mount the Arduino Nano board
Solder the DIP pin and connect it tightly with the main PCB, then the USB connector can align properly to the front panel.
3.  Mount the topside through hole components
PTEST pin, PDL/PTT phone jack, LEDSKT, Rotary encoder, Buzzer
4.  Connect the rotary encoder to front panel with bolt and washer, then slide the PCB into box track and mount back panel.
5.  A 30 minutes assembly video will show in Youtube later time

Serial Command Line Interface (CLI) / CW Keyboard
type what you want the keyer to send (all commands are preceded with a backslash)
\?  Help (requires FEATURE_SERIAL_HELP)
\#  Play memory # (requires FEATURES_MEMORIES; play memories 1 - 10)
\a  Iambic A mode
\b  Iambic B mode
\c  Single Paddle mode
\d  Ultimatic mode
\e#### Set serial number to ####
\f#### Set sidetone frequency to #### hertz
\g  Bug mode
\h  Toggle between CW and Hell sending (requires FEATURE_HELL)
\i  Transmit enable/disable
\j###  Dah to dit ratio (300 = 3.00, do \j alone to set to default)
\k CW Training Module (requires FEATURE_TRAINING_COMMAND_LINE_INTERFACE)
\l## Set weighting (50 = normal, do \l alone to set to default)
\m###  Set Farnsworth speed
\n  Toggle paddle reverse
\o  Toggle sidetone on/off
\p#(#) Program memory #
\q##  Switch to QRSS mode, dit length ## seconds
\r  Switch to regular speed mode
\s  Status
\t  Tune mode
\u  Manual PTT toggle
\v  Toggle potentiometer active / inactive   (requires FEATURE_POTENTIOMETER)
\w###  Set speed in WPM
\x#  Switch to transmitter #
\y#  Change wordspace to # elements (# = 1 to 9)
\z   Autospace on/off
\+   Create prosign
\!##  Repeat play memory
\|#### Set memory repeat (milliseconds)  (backslash and pipe)
\*   Toggle paddle echo
\`   Toggle straight key echo
\^   Toggle wait for carriage return to send CW / send CW immediately
\&   Toggle CMOS Super Keyer Timing on/off
\%##  Set CMOS Super Keyer Timing %    
\.   Toggle dit buffer on/off
\-   Toggle dah buffer on/off
\~   Reset unit
\:   Toggle cw send echo
\{   QLF mode on/off
\>   Send serial number, then increment
\<   Send current serial number
\(   Send current serial number in cut numbers
\)   Send serial number with cut numbers, then increment
\[   Set Quiet Paddle Interruption
\=   Toggle American Morse mode (requires FEATURE_AMERICAN_MORSE)
\\   Immediately clear the buffer, stop memory sending, etc.

Command Mode (press RE1 button to enter command mode and press again to exit)
A  Switch to Iambic A mode
B  Switch to Iambic B mode
C  Switch to Single Paddle Mode
D  Switch to Ultimatic mode
E  Announce speed
F  Adjust sidetone frequency
G  Switch to bug mode
H  Set weighting and dah to dit ratio to defaults
I  TX enable / disable
J  Dah to dit ratio adjust
K  Toggle Dit and Dah Buffers on and off
L  Adjust weighting
N  Toggle paddle reverse
O  Toggle sidetone on / off
P#(#) Program a memory
R####  Set serial number to ####
S  Alphabet code practice (FEATURE_ALPHABET_SEND_PRACTICE)
T  Tune mode
V  Toggle potentiometer active / inactive
W  Change speed
X  Exit command mode (you can also press the command button (button0) to exit)
Y#### Change memory repeat delay to #### mS
Z  Autospace On/Off
#  Play a memory without transmitting
?  Status
   1. Speed in WPM
   2. Keyer Mode (A = Iambic A, B = Iambic B, G = Bug, S = Single Paddle, U = Ultimatic)
   3. Weighting
   4. Dah to Dit Ratio

Appendix
a. Files definition and usage
k3ng_keyer.ino : this is the main code; object declarations for some hardware devices are included in this file
keyer.h : various declarations used in the k3ng_keyer.ino code
keyer_debug.h : turns on debugging code; you probably won’t ever have to touch this unless you’re deep in the code or someone on the Radio Artisan group asks you
keyer_dependencies.h: Don’t touch this file.  You’ll shoot your eye out.
keyer_features_and_options.h : configure the features you want here
keyer_hardware.h : This is for defining custom or preset configurations.
keyer_pin_settings.h : map the pins you’re using with your hardware
keyer_settings.h : various settings for features; you probably won’t need to touch this unless you’re a power user or want to tweak stuff to enable debugging and post the debug logs for troubleshooting purposes

Some files for special hardware likes nanoKeyer, open_interface, tinyKeyer are preconfigured. For tinyKeyer, they are
keyer_features_and_options_tinykeyer.h
keyer_pin_settings_tinykeyer.h
keyer_settings_tinykeyer.h
You can simply un-comment the definition over “keyer_hardware.h” to work them.

b. keyer_features_and_options.h
// red bold letter are the FEATURE opened in sbKeyer
// compile time features and options - comment or uncomment to add or delete features
// FEATURES add more bytes to the compiled binary, OPTIONS change code behavior
// #define FEATURE_COMMAND_BUTTONS  //limited flash size, sbKeyer don't open this feature
#define FEATURE_COMMAND_LINE_INTERFACE  
#define FEATURE_MEMORIES                 
// #define FEATURE_MEMORY_MACROS
// #define FEATURE_WINKEY_EMULATION        
// #define FEATURE_BEACON
#define FEATURE_TRAINING_COMMAND_LINE_INTERFACE
// #define FEATURE_CALLSIGN_RECEIVE_PRACTICE
// #define FEATURE_POTENTIOMETER           
// #define FEATURE_SERIAL_HELP
// #define FEATURE_HELL
// #define FEATURE_PS2_KEYBOARD      
// #define FEATURE_USB_KEYBOARD        
// #define FEATURE_CW_COMPUTER_KEYBOARD 
// #define FEATURE_DEAD_OP_WATCHDOG
// #define FEATURE_AUTOSPACE
// #define FEATURE_FARNSWORTH
// #define FEATURE_DL2SBA_BANKSWITCH      
// #define FEATURE_LCD_4BIT                
// #define FEATURE_LCD_ADAFRUIT_I2C        
// #define FEATURE_LCD_ADAFRUIT_BACKPACK  
// #define FEATURE_LCD_YDv1               
// #define FEATURE_LCD1602_N07DH     
// #define FEATURE_LCD_SAINSMART_I2C
// #define FEATURE_CW_DECODER
// #define FEATURE_SLEEP                  
 #define FEATURE_ROTARY_ENCODER         
// #define FEATURE_CMOS_SUPER_KEYER_IAMBIC_B_TIMING
// #define FEATURE_DIT_DAH_BUFFER_CONTROL
// #define FEATURE_HI_PRECISION_LOOP_TIMING
// #define FEATURE_USB_MOUSE               
// #define FEATURE_CAPACITIVE_PADDLE_PINS 
// #define FEATURE_LED_RING               
// #define FEATURE_ALPHABET_SEND_PRACTICE 
// #define FEATURE_PTT_INTERLOCK
// #define FEATURE_QLF
// #define FEATURE_EEPROM_E24C1024
// #define FEATURE_STRAIGHT_KEY
// #define FEATURE_DYNAMIC_DAH_TO_DIT_RATIO
// #define FEATURE_PADDLE_ECHO
// #define FEATURE_STRAIGHT_KEY_ECHO
// #define FEATURE_COMMAND_LINE_INTERFACE_ON_SECONDARY_PORT    
#define OPTION_PRIMARY_SERIAL_PORT_DEFAULT_WINKEY_EMULATION                                                          
// #define OPTION_SUPPRESS_SERIAL_BOOT_MSG
#define OPTION_INCLUDE_PTT_TAIL_FOR_MANUAL_SENDING
#define OPTION_EXCLUDE_PTT_HANG_TIME_FOR_MANUAL_SENDING
// #define OPTION_WINKEY_DISCARD_BYTES_AT_STARTUP    
// #define OPTION_WINKEY_STRICT_EEPROM_WRITES_MAY_WEAR_OUT_EEPROM
// #define OPTION_WINKEY_SEND_WORDSPACE_AT_END_OF_BUFFER
#define OPTION_WINKEY_STRICT_HOST_OPEN              
#define OPTION_WINKEY_2_SUPPORT                     
#define OPTION_WINKEY_INTERRUPTS_MEMORY_REPEAT
//#define OPTION_WINKEY_UCXLOG_9600_BAUD             
// #define OPTION_WINKEY_2_HOST_CLOSE_NO_SERIAL_PORT_RESET 
// #define OPTION_WINKEY_FREQUENT_STATUS_REPORT        
#define OPTION_WINKEY_IGNORE_LOWERCASE              
// #define OPTION_REVERSE_BUTTON_ORDER               
#define OPTION_PROG_MEM_TRIM_TRAILING_SPACES        
#define OPTION_DIT_PADDLE_NO_SEND_ON_MEM_RPT        
// #define OPTION_MORE_DISPLAY_MSGS                    
// #define OPTION_N1MM_WINKEY_TAB_BUG_WORKAROUND       
// #define OPTION_WATCHDOG_TIMER                       
// #define OPTION_MOUSE_MOVEMENT_PADDLE              
// #define OPTION_NON_ENGLISH_EXTENSIONS 
// #define OPTION_KEEP_PTT_KEYED_WHEN_CHARS_BUFFERED   
// #define OPTION_DISPLAY_NON_ENGLISH_EXTENSIONS 
// #define OPTION_UNKNOWN_CHARACTER_ERROR_TONE
// #define OPTION_DO_NOT_SAY_HI
// #define OPTION_PS2_NON_ENGLISH_CHAR_LCD_DISPLAY_SUPPORT
// #define OPTION_PS2_KEYBOARD_RESET
// #define OPTION_SAVE_MEMORY_NANOKEYER
#define OPTION_CW_KEYBOARD_CAPSLOCK_BEEP
// #define OPTION_CW_KEYBOARD_ITALIAN
// #define OPTION_CW_DECODER_GOERTZEL_AUDIO_DETECTOR
// #define OPTION_INVERT_PADDLE_PIN_LOGIC
// #define OPTION_DIT_DAH_BUFFERS_OFF_BY_DEFAULT_FOR_FEATURE_DIT_DAH_BUFFER_CONTROL
// #define OPTION_ADVANCED_SPEED_DISPLAY
// #define OPTION_PROSIGN_SUPPORT   
// #define OPTION_RUSSIAN_LANGUAGE_SEND_CLI
#define OPTION_DO_NOT_SEND_UNKNOWN_CHAR_QUESTION

c. keyer_pin_settings.h
/* Pins - you must review these and configure ! */
#ifndef keyer_pin_settings_h
#define keyer_pin_settings_h
#define paddle_left 2             //sbKeyer, Paddle left
#define paddle_right 5          //sbKeyer, Paddle right
#define tx_key_line_1 12       //sbKeyer, KEY(high = key down/tx on)
#define tx_key_line_2 0
#define tx_key_line_3 0
#define tx_key_line_4 0
#define tx_key_line_5 0
#define tx_key_line_6 0
#define sidetone_line 4          // sbKeyer, connect a speaker for sidetone
#define potentiometer A0       // Speed potentiometer (0 to 5 V) Use pot from 1k to 10k
#define ptt_tx_1 13                // sbKeyer, PTT ("push to talk") lines
#define ptt_tx_2 0             //   Can be used for keying fox transmitter, T/R switch
#define ptt_tx_3 0             //   These are optional - set to 0 if unused
#define ptt_tx_4 0
#define ptt_tx_5 0
#define ptt_tx_6 0
#define tx_key_dit 0            // if defined, goes active for dit
#define tx_key_dah 0           // if defined, goes active for dah
#ifdef FEATURE_COMMAND_BUTTONS
  #define analog_buttons_pin A1
  #define command_mode_active_led 9  //sbKeyer, green LED
#endif //FEATURE_COMMAND_BUTTONS
#ifdef FEATURE_SIDETONE_SWITCH
  #define SIDETONE_SWITCH 8
#endif //FEATURE_SIDETONE_SWITCH
// rotary encoder pins and options - rotary encoder code from Jim Balls M0CKE
#ifdef FEATURE_ROTARY_ENCODER
  #define OPTION_ENCODER_HALF_STEP_MODE     // Half-step mode?
  #define rotary_pin1 10                    // sbKeyer, CW Encoder Pin
  #define rotary_pin2 11                    // sbKeyer, CCW Encoder Pin
  #define OPTION_ENCODER_ENABLE_PULLUPS     // define to enable weak pullups.
#endif //FEATURE_ROTARY_ENCODER
#ifdef FEATURE_ALPHABET_SEND_PRACTICE
  #define correct_answer_led 0
  #define wrong_answer_led 0
#endif //FEATURE_ALPHABET_SEND_PRACTICE
#ifdef FEATURE_PTT_INTERLOCK
  #define ptt_interlock 0  // this pin disables PTT and TX KEY
#endif //FEATURE_PTT_INTERLOCK
#ifdef FEATURE_STRAIGHT_KEY
  #define pin_straight_key 52
#endif //FEATURE_STRAIGHT_KEY
#if defined(FEATURE_COMPETITION_COMPRESSION_DETECTION)
  #define compression_detection_pin 13
#endif //FEATURE_COMPETITION_COMPRESSION_DETECTION
#if defined(FEATURE_SLEEP)
  #define keyer_awake 0
#endif
#else
  #error "Multiple pin_settings.h files included somehow..."
#endif //keyer_pin_settings_h

FAQ
Why the Keyer has no sound output ?
Please check the sidetone mode is on or off by “\s” and use “\o” to toggle the sidetone

What happen to short-circuit the ASR pin ?
The Arduino will not be programmed. If you try to upload the compiled Sketch, it will alarm for “?” 10 times and display the programming failed.

How about to load the compiled HEX file to Arduino Nano directly ?
You can use the Xloader to work for it.

What features, options and pins assignment in the sbKeyer ?
K3NG provide different profile to work for nanoKeyer, tinyKeyer, open interface Keyer etc. You can uncomment the hardware information in “keyer_hardware.h” to work for different hardware. For sbKeyer, a Python script is provided to do the modification to the latest K3NG release. After running the Python script, the original “*.h” will move to “*.h_orig”

Why the USB link broken(COM port disappeared) sometimes with connection to the transceiver ?
You need install the latest CH340 driver to solve it.

What feature I can open in the “keyer_features_and_options.h” ?
The memory size for different Arduino-liked board are different. For Nano board, you can't open the CLI and WINKEY feature same time. With MEGA2560 or Teensy 3.2, you can open all the features, but you need check the conflict for different logger software.

How to check the CLI(Command Line Interface) ?
Use a terminal emulator program(putty or realterm). In Arduino IDE, you can use the “Tools\Serial Monitor” with setting as N81/115200 baud/CR+NL. Type “\s” to see the current Keyer setting and “\k” to enter training mode.

Where is the material for DIY ?
manual
schematic and pcb picture
Gerber files
K3NG codes and precompiled HEX file
CH340 driver

1 則留言: