Programmable CW Morse Keyer / beacon

Mini USB dongle with STM32F0xx is suitable many for simple, mini projects. I attached speaker to Timer14 PWM output (Pin PA6) and LED (or optocoupler connected to PTT) to GPIO pin PA0:


The provided software is based on USB Virtual Com Port (VCP) device. The setup is done with command line interface using terminal from any PC. The setup is stored in the internal flash and PC is not required for normal operation. The mini beacon keyer can be used when powered with 5V.

For proper operation VCP driver is required. It can be downloaded from or local copy: VCP_V1.4.0_Setup After installation connect the device, use terminal and have fun.

OK, not so quick. The microcontroller must be reprogrammed first. Every STM32F0xx come with USB bootloader from the factory. After assembling the single sided PCB, double checking all components, the real fun can start:

  1. Download and install DfuSe from
  2. Start DfuSe and update firmware with the following DFU file
  3. Restart the device and install VCP driver
  4. Connect the device and find which COM port has been assigned to the device
  5. Start your favorite terminal program
  6. Setup the device with provided commands
  7. Repeat step 6 if neccessary, store the setup(s)
  8. Enable one of the setups for autorun operation

Now the device can be used without PC. Power it with 5V, wait 10 seconds to start the autorun operation and make some “beaconing” online.


The source code is provided on GitHUB>>>

The device can be re-programmed with any SWD debugger (ulink, jlink, stlink, …)

Commands reference will be provided soon. Stay tuned.

Command line interface

Different sets of commands are provided for adjusting the operation of the device: audio settings, timing running and repetition, message entry and controlling settings storage in internal flash.

When invalid command is entered, the device displays brief help:

 MSG ...Text...
 DEL x
 ID ...Text...


Audio settings

Audio output is generated using internal timer programmed into PWM mode. The PWM width can be adjusted from 0 to 50% and frequency of the PWM can be set between 100Hz and 10kHz. All audio parameters are set with the command

AUD <V|R|F|C|[D]> <Vol>|<1|0>|<Freq>|<1|0>

Audio Volume

Audio volume is adjusted by changing PWM ratio between 0 and 50%. The volume parameter is 0 to 100%, where 100% volume sets the PWM to 50%. The command syntax is:

AUD V <Vol>

Where <Vol> is between 0 and 100.

Example: To set the volume to 5% enter command


and press enter.

Audio Frequency

Audio frequency is entered in Hz and sets the audio PWM to required frequency. The frequency can be set between 100Hz and 10kHz. The command syntax is:

AUD F <Freq>

Where <Freq> is between 100 and 10000.

Example: To set the frequency to 500Hz enter command

AUD F 500

Hear (Run) audio generator

Audio generator can be run manually to check the settings. The command syntax is:

AUD R <1|0>

Example: To start audio generator enter command


Frequency and volume can be altered when audio generator is active.

Enable audio signals during CW

Audio output should be enabled when required for generating CW beeps (“Dits” and “Dahs”). The command syntax is:

AUD C <1|0>

When enabled with AUD C 1 the tones will be heard during the CW.

Example: To disable audio signals for CW enter command


Display audio settings

Audio settings can be displayed when AUD command is entered without parameter or “D” parameter is used.  The command syntax is:


CW Message settings

The message is generated at selected speed and repetition timing and counting. Main timing unit is dot time. All times are integer multiplications of this:


Not all characters are allowed. The device will display warning when invalid character is entered. At current version only alphanumeric characters are allowed:
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,:?’-/(){}[]”@= and space.
More characters will be added with future versions of the software.

Enter CW message

The message is entered using MSG command:

MSG <Text>

Where <Text> is any sequence of valid characters with maximum length of 64.



Special chars:

Two specal chars are available: “<” and “>” (brackets).  Left bracket < changes the character spacing from 3 “dits” to one “dit”. Right bracket > restore normal operation. This is usable for entering special sequences:

AA,New line “.-.-“
AR,End of message “.-.-.”
AS,Wait “.-…”
BK,Break “-…-.-“
BT,New paragraph “-…-“
CL,Going off the air (“clear “-.-..-..”
CT,Start copying “-.-.-“
DO,Change to wabun code “-..—“
KN,Invite a specific station “-.–.”
SK,End of transmission (also “…-.-“
SN,Understood (also VE) “…-.”
SOS, Distress message “…—…”

To enter sequence for AR (end of message), simply enter <AR> into the message. It is even possible to insert any sequence of “dits” and “dahs” by simply insert sequence of E and T within brackets.


The message:

msg <tete> c <tete> c <eee> s <ttt> o

will emit for time “C”, two times “S” and to times “O”, because <tete> is equal as C.

Timing mode

Timing mode of the message is set with MODE command. There are two modes for calculating the duration of the dot time. Entered numbers are converted to milliseconds. All stored values for dot time are in milliseconds. Two modes for entering the dot time are possible: Normal and Slow.

When specifying speed in Normal mode, the unit is Word Per Minute (WPM), calculated from standard word PARIS, with the duration of 50 dots when PARIS is converted to dots, dashes and pauses using scheme indicated in the picture above. The formula for calculation from WPM to the duration of the dot in milliseconds is therefore DotTime = 60.000/(50 WPM).

For Slow mode, the unit is millisecond. Dot time in Slow mode can be from 1000ms to 100000ms.

Mode command syntax is:

MODE <N|S> <t>

Where <t> is time entered in WPM for Normal mode and milliseconds for Slow mode.

Example for setting the CW speed to 15WPM:


Example for setting the CW speed to QRSS with 3 seconds dot time:

MODE S 3000

Message timing mode is displayed when MODE command is entered without parameter or parameter “D” is used.

Repetition settings

Message generation can have two parameters set: the period of the message (marked with blue line) and number of repetitions. cq1

Number of repetitions can be set to some integer number or zero for repeating message infinitely.

The syntax of the RPT command is:

RPT <T|N|[D]> <Period>|<Num>

Message period is specified with the T parameter. Units are seconds between 1 and 60.000s. Example to set 1 minute period:

RPT T 60

Note! When specified period is shorter than complete message duration, the next message will follow after 7 dot time units. This is the same when period parameter is 0.

Message repetitions are specified with the N parameter. The number of repetitions cam be from 1 to 65536. When 0 (zero) is set, the beacon will repeat message infinitely. Example to set 10 repetitions:

RPT N 10

Note! When repeat number is set to >0, the device will stop generating morse code when specified number of repetitions are reached. To restart the sequnce, the device should be restarted using power cycle or reset signal.

Output signal settings

One output signal is audio described above. Second output signal is digital output pin. The pin can be programmed for high or low polarity and enabled during CW. The OUT command syntax is:

OUT <P|C|[D]> <1|0>

The polarity of the output signal is set with the P parameter. The polarity can have value 0 or 1. When set to 0, the idle mode is Low. When value is set to 1, the idle mode is High: pol

Example to set output signal “0” polarity:


Output is enabled for CW with the “C” parameter. To enable output pin, enter following command:


Run the sequence with current settings

When all required parameters are set, the sequence can be tested or run with the RUN command. The command doesn’t require any additional parameters.


If repetition is set to 0 (infinite), the device will continue emitting signals forever. To stop the running sequence enter command:


Note!  Settings can be altered when generator sequence is running, but it is highly recommended to stop the execution when changing the message and then run again.

Internal storage commands

Internal storage has room for storing up to eight settings. Before storing the current setup, some identification must be provided. The ID command is used to set the identifier to the current setup. The setup will be stored and cataloged under the name provided with ID command. The catalog is displayed with CAT command. Storing and loading the settings to /from the storage is done with STORE and LOAD commands, respectively. Individual settings can be deleted with command DEL. And finally, the settings can be marked for auto-run after power-up with the command START. All commands except ID and CAT accept numeric parameter from 1 to 8 indicating location from 1 to 8 within internal storage.

Name the current setup

Current setup is named with the command ID. Identifier maximum length is 8 characters. Longer identifiers will be truncated during storage to internal flash memory. Syntax:

ID <Identifier>

To name the current setup e.g. “DEMO 1” enter following command:


Display catalog of the internal storage

The catalog is displayed with the command CAT without any parameters. Example (with listed catalog):

1:   DEMO 1 -  a.V=50%  a.f=800Hz CW.t=80ms  CW.msg :'CQ CQ S54MTB'  Out.p=0
2:  <Empty>
3:  <Empty>
4:  <Empty>
5:  <Empty>
6:  <Empty>
7:  <Empty>
8:  <Empty>


Store settings

Settings are stored to one of 8 locations with the STORE command:


Where <n> is number of the storage location from 1 to 8.

Load settings

Settings are loaded from one of 8 locations in non-volatile storage to current setup with the LOAD command:

LOAD <n>

Where <n> is number of the storage location from 1 to 8.

Delete settings from internal flash storage

Any of the 8 locations in non-volatile storage can be deleted with DEL command:

DEL <n>

Where <n> is number of the storage location from 1 to 8.

Mark settings for auto-start during power-up

Any of the 8 locations in non-volatile storage can be marked for auto-running after power-up with START command:


Where <n> is type of autorun option. “0” denotes no autorun, “1” is for unconditional autorun and “2” is for selectable autorun. There are three input pins (PA1, PA2 and PA3), which can be set to 8 different combinations. When this combination match the catalog number-1 and the option “2” is set at the same time, the settings will be loaded from the storage and run accordingly to stored parameters. When optin “1” is selected, the first entry in the catalog having optino “1” set will be loaded and run during startup.

The selected autorun option will appear with the indicator “AR!” for option “1” or ” SAR! ” for option 2 in catalog:

1:  <Empty>
2:  <Empty>
3:  <Empty>
4:  <Empty>
5:  <Empty>
6:  <Empty>
7:  <Empty>
8:  <Empty>
id 1
store 1
Backup... status 0
Writing... status 0
id 2
start 1
store 2
Backup... status 0
Writing... status 0
id 3
start 2 
store 3
Backup... status 0
Writing... status 0
1:        1 -  a.V=0%  a.f=0Hz CW.t=0ms  CW.msg :''  Out.p=0
2:        2 -  a.V=0%  a.f=0Hz CW.t=0ms  CW.msg :''  Out.p=0  AR!
3:        3 -  a.V=0%  a.f=0Hz CW.t=0ms  CW.msg :''  Out.p=0  SAR!
4:  <Empty>
5:  <Empty>
6:  <Empty>
7:  <Empty>
8:  <Empty>

Here is PDF document with the operation maual and detailed instructions for driver installation:

Mini CW Keyer


  1. teodoro jaramullo says:

    Cingrats on great device for Ham abd oher uses

    Requesting a quote for a coupleofunitts for RADIO BEACONS needed baadly
    here in Ecuador south america,,,,


    Please HElp if you canto this cause and Radio beacins in Ecuador,


    Teodoro Jaramillo

  2. Jacky Agoyer says:

    Or find the address to buy the mini USB dongle with SMT32F0xx and facility of this element instructions.
    For amateur radio application.
    Thank you in advance.
    sorry i am not good in English…

Leave a Reply