21/09/2024

Digispark CW Keyer

 A small and simple CW keyer with Digispark (*** or an empty ATTiny chip)

I am a big fan of Arduino programming, but I had once ordered 5 very small CPU boards, called Digispark. They contain an 8-pin CPU of the ATTiny85 type, and cost around 3€ on Ali Express, etc. If you’re interested in more info, read this : 
https://diyusthad.com/2021/07/digispark-attiny85.html#what-is-digispark  

I never did much with these boards, other than make a small “Knight Rider” running light as a demo. 

By coincidence, a few weeks ago I found some YouTube videos by LabCat, who appears to be Tobias DL3MHT. He built a small CW keyer with a Digispark. Here is a short video showing the keyer in action : https://www.youtube.com/shorts/frkpCNYbVr8 

And a much longer video showing the complete build of the circuit : 
https://www.youtube.com/watch?v=mSMUsS8t9xk 

The code is an adaptation of the YACK (Yet Another CW Keyer) by DK3LJ (with modifications from AI4SV and WD9DMP). The final DigiSpark version can be found here : https://github.com/labcat73/ATTiny85_CW_Keyer

The only things I changed are a few of the confirmation characters, they are found in lines 67-70 of the main sketch:

const char txok[] PROGMEM = "R";
const char vers[] PROGMEM = "V0.88";
const char prgx[] PROGMEM = "C";
const char imok[] PROGMEM = "K";

Programming a Digispark board is a bit tricky, since there is no real USB interface. The bootloader emulates a USB port in the first 5 seconds after power-on, so the upload of the code must begin in those first 5 seconds. Therefore, the Digispark may only be plugged into the PC after the Arduino IDE gives a message to do so. Carefully read the instructions in the README on the github page above.

I first built a prototype "in free space" to check that the circuit worked, and it did !
Here it can be seen with a "PA0CMU" type paddle, made from pieces of PCB (a web page about this paddle is here).


Then I built it on a piece of perfboard, since this will be a one-time project. Here the simple circuit : 

(source: DL3MHT)

The only change that was made was to reduce R2 from 4k7 to 2k2, to make the keying reliable on a lower supply voltage. I power my keyer from just 1 Li-Ion cell (4.2V when fully charged).

And here is what I made of it:

The Digispark can be removed from the board for reprogramming if needed.

Tobias made some changes in the menu system of the keyer, and I changed some characters.

So I edited the standard YACK manual to reflect these changes, see below. Copy it to a text editor and print it out for reference. Check out the many settings and possibilities of this little keyer, I'm sure you will be impressed.

Still TODO : find a suitable box to put the circuit in, I will update this post when I get there ... hi.

And now the big question : does it work ? It sure does, I used the keyer in one of the last QCX QSO Parties. I put my QCX in straight key mode, and used this keyer and a leg mounted American Morse Equipment "Porta Paddle" to make 7 QSO's. The only errors that were sent were my fault ...

*** EDIT: Same code in an empty ATTiny chip.

I got a report from Vin, PE2V, that he tried this code in a Digispark, but at startup he got a strange fenomenon. The Digispark would send 10 series of four quick dots, so if a transceiver was connected he would send 10 letters H, which is not what he wants.
The culprit seems to be the bootloader in the Chinese Digispark Rev3 that he used.
My Digisparks are older, they don't have the 'Rev3' marking, and don't show this behaviour.

I did have some empty ATTiny85 chips, and tried to put the code in one of those.
I used the method found here.
It worked but the keyer was super fast ... it sent at somethoing like160 WPM instead of 20 WPM ??
This had to do with the clock speed. I did set the clock at "1 MHz (internal)", but that was not enough.

A FUSE in the chip must be changed to set a prescaler on the clock. Luckily, this is very simple, just set the clock at 1 MHz in the Arduino IDE and then execute the command 'Tools>Burn Bootloader'.
This does not really burn a bootloader, it only sets the correct fuses. Problem solved.

I built the circuit on the breadboard I used for programming, and all seems to work now. See this short video on YouTube : ATTiny keyer

Rather than built another keyer, I replaced the Digispark with a "Belgian Clone", Rev-ON7DQ.
I mounted the chip on a small piece of perfboard and wired the pins of the chip to the corresponding pins of a Digispark. It works !

Here the wiring on the underside.


And my "clone" mounted on the keyer board, replacing the Digispark.


73,

Luc ON7DQ

***************

(Manual adapted from original YACK manual, and additional notes by DL3MHT)

YACK - Yet Another CW Keyer - User Manual
Version: 0.88 by Tobias Selig DL3MHT

Hardware :
As is, the library is configured to run on a stock ATTINY45 cpu with its internal oscillator at 8MHz, prescaled to 1MHz. The ATTINY45 comes with 4KB of Flash memory and 256 Byte each for RAM and EEPROM. It can be ported to other AVR chips if these have sufficient features to support the intended application. As the library was written in C, processors without internal stack will not work with this application unless significantly rewritten.

Hardware connections are defined in yack.h

Pin 1 : PB5 - RESET (Can be used for additional button)
Pin 2 : PB3 - DIT (towards GND, buffer with 10nF cap)
Pin 3 : PB4 - DAH (towards GND, buffer with 10nF cap)
Pin 4 : GND
Pin 5 : PB0 - TX key line (polarity configurable)
Pin 6 : PB1 - Sidetone (Connect a piezo disc)
Pin 7 : PB2 - Command button (towards GND)
Pin 8 : VCC (5V)

Usage
After reset in default mode, the keyer operates as regular IAMBIC keyer in IAMBIC B at 12 WPM (words per minute = 60 CPM). The sidetone generator operates at 800 Hz.

Speed Change : speed can be changed py pressing and holding the command key while operating the DIT and DAH paddles. DIT reduces speed while DAH increases speed. The keyer plays an alternating sequence of dit and dah while changing speed without keying the transmitter.

Command mode
Pressing the command button without changing speed will switch the keyer into command mode. This will be confirmed with the '?' character. Another press of the same button takes the keyer back into regular keyer mode and will be confirmed by a "C".

During command mode the transceiver is never keyed and sidetone is always activated. Further functions can be accessed by keying one-letter commands as listed below.

A - IAMBIC A
Keyer sets IAMBIC A as permanent keying mode. Request is answered with "R".

B - IAMBIC B
Keyer sets IAMBIC B as permanent keying mode. Request is answered with "R".

C - Callsign trainer
The keyer plays a generated callsign (sidetone only) and the user must repeat it. If it was repeated correctly, "R" is played and the next callsign is given. If a mistake was sensed, the error prosign (8 dots) is sounded and the current callsign is repeated again for the user to try once more. If nothing is keyed for 10 seconds, the keyer returns to command mode.

D - DAH priority mode.
In squeezed state a sequence of DAHs is sent.Some of the first generation keyers exhibited this behaviour so the chip can simulate that.

E, I , T, M - Play back internal messages 1, 2, 3 or 4
The stored messages 1 - 4 are played back with keying enabled (if configured). A press of the command key immediately returns the keyer to keyer mode so a QSO can be started.

I - TX level inverter toggle
This function toggles wether the "active" level on the keyer output is VCC or GND. This setting is dependent on the attached keying circuit. Request is answered with "OK".

K - TX Keying toggle
Toggles the setting of the TX keyer output. In default state the keyer switches the output line when it is in keyer mode. Toggling this setting enables or disables that function. NOTE: Keying is always off in Command mode. Request is answered with "OK".

L - Ultimatic
Sets the keyer into ULTIMATIC mode. In Ultimatic mode always tha last paddle to be touched is repeated indefinitely when paddles are squeezed

N - Automatic Beacon
The keyer responds with "N" after which a number between 0 and 9999 can be keyed. After a 5 second timeout the keyer responds by repeating the number and "OK". Once the keyer returns to keyer mode, the content of message buffer 2 is repeated in intervals of n seconds. The setting is preserved in EEPROM so the chip can be used as a fox hunt keyer.
Returning to command mode and entering an interval of 0 (or none at all) stops beacon mode.

P - Pitch
Allows modifying the sidetone pitch to a higher or lower level. This function implements pitch change mode. A series of dots is played and pitch can be adjusted using the paddle levers. Once 10 dots have been played at the same pitch, the mode terminates.

R - Reset
All settings are returned to their default values except for the stored messages in the message buffers. Restored settings include speed and pitch, Paddle Swap, TX level inversion, sidetone and TX keyer settings.

S - Sidetone toggle
The builtin sidetone generator setting is toggled (ON -> OFF or OFF -> ON). NOTE: This setting is only of relevance for regular keying mode. Sidetone is always on in command mode. Request is answered with "OK".

U - Tune mode
The transceiver is keyed for a duration of 20 seconds for tuning purposes. Tuning mode is aborted once either DIT or DAH paddles are touched or the control key is pressed.

V - Version
The keyer responds with the current keyer software version number

W - Query current WPM speed
Keyer responds with current keying speed in WPM.

X - Paddle swapping
DIT and DAH paddles are swapped. Request is answered with "OK".

Z - Set Farnsworth pause
Allows setting of an extended inter-character Pause in all sending modes which makes fast keying easier to understand. Note that this of course only influences RECEPTION, not TRANSMISSION. If you desire farnsworth mode in transmission, please manually pause during characters.

0 - Lock configuration
The 0 command locks or unlocks the main configuration items but not speed, pitch and playback functions.

1, 2, 3 or 4 - Record internal messages 1 or 2 or 3 or 4 – BEACON message is message 2
The keyer immediately responds with "1" or "2" or “3” or “4” after which a message up to 100 characters can be keyed at current WPM speed. After 5 seconds of inactivity the message is stored in EEPROM. If entering message is interrupted with command button, keyer returns "R" and stays in command mode.  Memory is unchanged. Choosing "1" or "2" or “3” or “4” but not keying a new message deletes the chosen message buffer content.


No comments:

Post a Comment

All reactions will be moderated. Publicity or links to other sites are not allowed.