logo


Simple Morse beacon keyer

***DRAFT***

This is a work in progress, documentation of a current project that will change, a 'living' document.

This article describes a simple beacon keyer with a range of speeds, including QRSS rates, and configurable beacon message.

With the growing use of synthesisers based on very high stability standards (eg Rubidium, GPS) for both transmitting and receiving stations, the prospect of receiving low speed Morse transmissions in very small bandwidths opens up new possibilities.

The implementation comes in two platforms:

In both cases, a range of speeds is available based on three speed select pins. In the case of the ATtinyx4, a selection can be made from up to 8 stored messages. The ATtinyx5 platform will suit where only one stored beacon message is needed.

Message content is stored in EEPROM, and is field upgradeable using an inexpensive AVR ISP programmer.

The chip provides both a KEY output to key a Morse code transmitter, and an auxilliary output which can be used for a square wave 800Hz audio sidetone output.

The circuit is intended for use on a nominal 12V supply but will operate directly from 5V down to 3V if the series regulator is bypassed (ie R1=0, D1 not fitted).

Fig 1:

Fig 1 shows the circuit diagram using an ATtinyx4(A) chip. The chip pinout is different for an ATtinyx5, see Table 1.

Table 1: AVR pinout
MCU ATtinyx4(A) ATtinyx5 Comments
Vcc 1 8  
GND 14 4  
/RESET 4 1  
Speed[0] 13 6  
Speed[1] 12 7  
Speed[2] 11 2  
AUX 5 5  
TX 3 3  
Msg[0] 10    
Msg[1] 9    
Msg[2] 8    

Internal weak pull-ups are used on the Speed and Msg input select pins, a switch or shunt to ground will control these pins.

The AUX output pin can be used to drive a speaker through a 500/8 transformer, or a PCB speaker such as the StarMicronics QMB-111PC, see the options settings.

The KEY  and AUX outputs are intended to drive a 2N7000 driver for a /KEY output (ie ground for key down condition) and /AUX when the chip is operated from 4.5 to 5V. A bipolar transistor could be used with a 1k series resistor (R2 ,R3) to the base for operation on lower voltages. If the module is to drive other TTL / CMOS loads, the driver transistor can be omitted and a wire link inserted from gate to drain, changing the sense of the output pins to KEY and AUX.

Table 2: Components
Component Value Comments
C1  1µF   
D1  1N751   
IC1  ATtinyx4x   
J1 2x6 shrouded HDR ISP jack.
Q1 2N7000  Alternative bipolar eg BC337, BC548.
Q2 2N7000  Alternative bipolar eg BC337, BC548.
R1 470R R1=(Vdc−5.1)/10kΩ.
R2 0R0 2k2-1k0 if bipolar used for Q1.
R3 0R0 2k2-1k0 if bipolar used for Q1.
TB1 Terminal block 5.08mm pitch  

Table 2 is the component list.

Table 3: TB1 pinout
Pin Use Comments
1 GND  
2 +12V  
3 /RESET  
4 /AUX  
5 /KEY  

TB1 pinout is shown in Table 3.

EEPROM

EEPROM holds the configuration data, including the messages. The EEPROM image is field replaceable.

Developing the EEPROM image

The EEPROM data structures are moderately complex to provide for flexibility, present and future, in use.

The EEPROM image is created using the following online generator.

EEPROM hex file image generator

Message texts can be inserted into the form below to generate an Intel Hex format EEPROM data file for download for a device programmer (eg AVRDUDE).

Up to 8 messages can be specified. The first blank message ends the message set. The skip variable sets the number of characters in the message to skip when not performing the periodic full speed ID. If you specify skip greater than message length, it will be set to 0.

Note that the 8 pin ATtinyx5 series chips can only access message 0, there are no message select pins.

Table 4: Options bits
Bits Description
0 invert msg and speed selection pins
1 disable periodic high speed ident
2:3 0: AUX pin is square wave audio out;
1: use AUX pin to indicate high speed ident in progress;
2: reserved;
3: reserved.
6:4 Time in minutes between full speed ID, 0=10min.

Above is a definition of the options bits. The options bits are specified as a four character hex string.

Invert facilitates use of DIP switches from select pins to ground, and if inverted, switch ON means logical 1 in terms of the inverted bits used to select a speed or message.

Insert message details here:
MsgNo Message text (max 50 symbols) Skip
0
1
2
3
4
5
6
7

Options:

Permitted characters are alphabetic, digits, space and the symbols @ , ? : .'-/()"=+ from ITU-R M.1677. Additionally _KU and _KD can be used for 10s of key up or key down condition. The character | will stop sending and put the MCU to sleep requiring a reset or power off/on cycle to restart the keyer. Messages can be up to 50 Morse symbols, _xx sequences occupy 1 symbol. Leading and trailing spaces are significant.

It is also possible to encode an arbitrary symbol of up to 7 elements by inserting the sequence \hh where h are hex representation of an 8 bit word. The format of the word is as follows: from MSB to LSB, padding 1 bits, a 0 bit, followed by the Morse Code representation of the character in, with a 0 indicating a dot element and a 1 indicating a dash element to make 8 bits in total. For example \C8 (1100 1000) would represent the AS (wait) pro-sign.

This generator is a support tool for this specific project. It does not do a lot of checking of input data, if you get garbage out, check your input.

EEPROM usage is 3 bytes, plus 3 bytes per message, plus one byte per symbol in each message. Restrict each message to no more than 50 symbols, and the total configuration to fit in available EEPROM (128 to 512 bytes, depending on the chip size chosen).

Programming the chip

There are many programmers available for the AVR microcontrollers. This section describes an inexpensive and easily obtained programmer, free software, and a programming example.

Fig 2:
 

Fig 2 shows an example inexpensive implementation of a 5V/3.3V USBASP programmer for AVR chips. A R0 link at the lower edge of the underside can be removed for 3.3V operation instead of 5V. Some implementations have a link to enable powering the target from USB, the one pictured above does not and the track should be cut adjacent to pin 2 (labelled VCC above) of the 10 pin connector OR no connection made to pin 10 on the target board if you do not want to power the target. It is a good idea to NOT power the target from the programmer without good reason.

These type of programmers can be found on Ebay for less that $4 including a cable and post. The programmer plugs into a USB port and a 10 pin ribbon cable connects to the in system programming connector on the target. If the target uses a 6 pin ISP header, 10/6 pin converters are available on Ebay. If the target uses a 3.3V supply, configure the programmer for 3.3V (usually a link or solder bridge, see the programmer documentation). Don't supply power from the programmer to the target (again a link on some programmers, see the programmer documentation).

Adapters from 10 pin to the newer 6 pin ISP configuration are readily available at low cost on Ebay.

@echo off
if *%1==* goto usage
set id='$Id: prg.bat 679 2011-12-12 06:00:52Z owen $';

echo Processing %1
echo.
set PRG=usbasp
set PORT=usb
set OPTS=-B 5
set DEVICE=t44

if *%2==* goto eeprom
echo program flash (%2.hex)...
avrdude %OPTS% -c %PRG% -P %PORT% -p %DEVICE% -U flash:w:%2.hex
sleep 1

:eeprom
echo program eeprom (%1.hex)...
avrdude %OPTS% -c %PRG% -P %PORT% -p %DEVICE% -U eeprom:w:%1.hex 
sleep 1

if not *%3==*fuse goto lock
echo program fuses ...
avrdude %OPTS% -c %PRG% -P %PORT% -p %DEVICE% -U hfuse:w:0xD4:m -U lfuse:w:0x62:m 
sleep 1

if not *%4==*lock goto cleanup
:lock
echo program lock (after everything else) ...
avrdude %OPTS% -c %PRG% -P %PORT% -p %DEVICE% -U lock:w:0x0:m 
goto cleanup

:usage
echo usage: prg eepromfile flashfile fuse lock
goto end

:cleanup
:end

Above is a batch file (prg.bat) to program an ATtiny44 using AVRDUDE. Though this is a Windows batch file, the programmer and AVRDUDE work also on Linux.

Getting the QrssKeyer

The flash memory code can be downloaded for both chip types from links below.

The EEPROM contents are created using the conversion tool in this article.

Links

Changes

Version Date Description
1.01 03/02/2012 Initial.
1.02    
1.03    
1.04    
1.05    

 


VK1OD on the 'net. I appreciate feedback, click on the ... in webm...@vk1od.net for my email address.

© Copyright: Owen Duffy 1995, 2011. All rights reserved. Disclaimer.