The AVR Beacon Super Keyer

By Murray Greenman ZL1BPU

Description of an HF beacon keyer with telemetry.
What makes the keyer rather different is its versatility -
it is a multi-mode unit, with ASK and FSK modulation, sending
Feld-Hell and Morse on command.

What the Keyer Does

It acts as a signal source for radio propagation test transmissions, typically on HF.

It monitors and report voltages, currents, temperatures etc relating to its environment.

It sends Morse Code and Hellschreiber at any or all of four speeds, on-off keyed or FSK.

It is able to key both audio and PTT, so can control CW, MCW, AM, FM and SSB transmitters.

Connected to a TNC, it can also send its data via 'packet radio' as a UI or APRS frame.

Transmission can be externally inhibited, e.g. if the frequency is busy, or there is a fault.

Morse code is an obvious choice for a beacon, since is is universally understood,
provides good performance at low power, is simple to transmit and to understand.
But why Hellschreiber (Feld-Hell)? Well, Hell is also a very simple mode, since it
is also on-off keyed like Morse. Hell is also "human readable", but by eye rather
than by ear.

With Hellschreiber it is also possible to monitor the signal for long periods without
effort, and record the data as a graphics file. Hellschreiber is also very robust
and works well in noise at relatively low power. The transmissions are only about
250 Hz wide.

The keyer will send both "Normal" and "DX mode" Feld-Hell, at the standard
122.5 bits/second, as well as half-speed, quarter-speed and eigth-speed. The slower
speeds are less affected by multi-path, and are also less affected by noise, which
is helpful when low power transmissions are involved. Slow speeds
are no problem for normal beacon use, since little data is sent. PC software is
available to support reception of all these modes.

Morse code mode also has four speeds, about 20 WPM, 10, 5 and 2.5 WPM. These speeds
were chosen for an important reason - they are "Hell compatible", in that the time
of one dot is the same as the time for one column of Hell data. This means
that the Morse can be "read" off the screen visually (it looks like a bar code), and it also means that the
timing of the Hell mode is preserved, so the phase of the Hell text either side of a
Morse sequence remains the same. The lower speeds can be read with great sensitivity
by using a spectrogram technique, ideal for LF operation.

The single message can have a mix of all these modes, and telemetry can be sent in Morse
as well as in Hellschreiber, and modes changed during the message. Outputs can also be
controlled by the message, and used to change transmitter power or perhaps a
choice of antennas or operating frequencies during the message. The message can be
any length up to 255 characters (including commands), which is about three lines of text
and data, or the "quick brown fox" sent four times! With such a large message memory, and
the multiple mode message flexibility, it is easy to create several messages to be sent
in a sequence in different modes.

The message can be changed at any time, by removing a link and rebooting the beacon
processor (momentarily removing power). Once the new message has been "learned",
which takes just a few seconds, the keyer will start again, and once the link is
restored, will remember the message forever, even if power is lost.

The telemetry is transmitted in any format the user wishes, so for example only
some channels can be used, they can be reported in any order, and with any associated
text, for example: "BATTERY 13D HEATSINK 0A8 AMBIENT 054". High resolution is provided,
almost as good as a typical digital voltmeter (0 - 1023 rather than 0 - 1999).
The readings are reported in hexadecimal,
so the three digits need to be converted to decimal, using the formula:

Decimal reading = D1 x 256 + D2 x 16 + D3

where Dn are the three HEX "digits" from left to right. Of course HEX
counts "0123456789ABCDEF", so in the above formula use A=10, B=11 and so on.

The message can contain a mixture of text and commands, which are two character
combinations starting with "$", for example "$1" is Hell mode (the default mode), $B sends the least
significant "digit" of the data for A-D channel 0, and $7 turns on a
digital output. And yes, "$$" sends the "$" character! Here's a typical message:

which sends a message like the one shown further down the page.

Specifications

Block Diagram

The keyer is really simple. As shown in the diagram below, it consists of a micro controller,
a regulator chip, input and output connectors and some simple interface circuits to protect
the micro. The crystal oscillator in the micro uses a readily available
3.58 MHz crystal, which could
also (with suitable buffering) act as the reference for an 80m QRP transmitter. This frequency
was chosen because it allows accurate timing of Hellschreiber elements.

The Analog and Digital Inputs can be to screw terminals, or whatever is convenient.
The Radio Port can also be screw terminals, although most transceivers will require
some extra circuitry, such as a pot to attenuate the audio, a receiver audio detector
to inhibit transmit, and so on. The simple RS232 port is only used to change the message,
and consists of two bipolar transistors.
The picture below shows a typical telemetry message mostly in Hellschreiber mode.
Can you read the Morse code at the end? (Hint -
enlarge the image!)

A typical telemetry message

Keyer Applications

The keyer has been designed primarily as an LF - HF telemetry beacon primarily for the bands
160 - 30 metres. It is already set up to allow flexible messaging and data
reporting, and to provide switchable antennas, frequencies or transmitter power
levels. It has also be used quite satisfactorily with VHF beacons including one with
awitched power levels. With some adaptation (different software) it could be used for:

S/MT-Hell transmissions for weak signal FFT reception

QRSS (very slow Morse) for LF applications (note - it can send FSK)

A remote weather station

General Description

The keyer is based on an AVR AT90S4433 processor running at 3.58 MHz.
Take a look at the Schematic,
and see the Specifications for more detail.

Port C of the micro is used for analog inputs which are reported as telemetry in the
beacon message, and can be configured for a range of sensors.

Port B is used to program the micro, and to drive the Radio Port (connects to the rig).
U3 is the PTT driver. PTT and start of message can be
inhibited by an external input, and then latched low by the micro. The audio output
at the Radio Port is AC coupled from
the micro, and has two resistors holding an average DC level. When the audio tone stops the output
is set tristate, and so no click or thump happens.

Port D is used for the serial control (programming) port, provides two general purpose outputs which
can be script controlled, as well as four digital inputs which can be read and report via the
telemetry message. U4 and U5 form a simple host-powered RS232 interface.

The message script is stored in EEPROM, and is independent of the program. The message can be up to
255 characters long, including text and commands, and can be changed
any time using an RS232 serial cable and a terminal program. Messages can easily be
hand typed, or can also be stored on disc and downloaded.

Any mixture of Morse and Hell modes can be used in the message. The format of
the telemetry is completely free form. This is achieved through the use of a
"command interpreter" which checks each character of the message for commands.

While the message is being transmitted, the same message appears at the RS232
port. Since the message on this port is terminated by &LT;CR&GT;&LT;LF&GT;, the
RS232 cable can be connected to a Packet Radio TNC so that the telemetry message
is relayed by packet on VHF as well!

The font used is the ZL1BPU MOSAIC
II 7 x 5 font, as can be seen in the following example. The slant is due to the 1%
error in the micro reference oscillator frequency at the time of recording.

The ZL1BPU AVR Keyer in action

Keyer Commands

A simple yet comprehensive set of text-based KEYER COMMANDS
allows the mode to be changed,
telemetry and text to be transmitted.

Character Sets

The following characters are supported by the keyer:

(space) ! " # $ % & ' ( ) * + , - . / : ; < = > ? [ \ ] ^ _

Lower case letters and punctuation above 0x5F (if placed in the message memory) will be converted
to upper case and the corresponding symbols by subtracting 0x20 (32) from the ASCII value.
The Tilde "~" cannot be sent, as it is used to define the end of the message in record mode.

Morse Mode
Letters and numbers, plus the following punctuation and prosigns:

(space) " $ ' ( ) + , - . / : ; = ? _

The prosigns are + (end of message AR), - (Dash DU),
= (Pause BT), and _ (Underline IQ). As with Hell, letters and
punctuation above 0x5F will be converted within range where possible. Unsupported
characters do not send anything, but will incur a two dot-element delay.

Message Programming

The message is made up using text and commands,
(see KEYER COMMANDS) and stored as a file. The programming mode
has no error correction, so if something goes wrong, or a bad command is sent, the
process will need to be restarted. The file can be sent to the keyer using Windows Terminal
or almost any other terminal program that supports 300 baud, no parity, 8 data bits (300N81).

There is no handshaking between the computer and the keyer. Communication is slow
so that each byte can be programmed before the next byte is received. This avoids the need
for a message buffer and the complex timing of programming and serial communication at the
same time. Programming is reliable when the message is hand sent, or if it is
preassembled and sent from the terminal program at full speed.

The PB5 input to the micro (Port B, bit 5, pin 19) has been selected to
indicate when message recording is required. (This is one of the pins in the programming header). Normally this pin is held low by a jumper.
If the micro is powered up with the link to ground in place,
the micro interprets this as normal mode, and will start as a beacon when power is applied.
If the PB5 pin is left open when power is applied, the beacon goes into record
mode, and stays there until it receives a "tilde" command (~), when it reverts to
normal mode. If a mistake is made during programming,
remove power from the keyer to allow the micro to reset. If you end up in programming mode
inadvertently, the first character of the message will be erased, so you will need to
send the message again.

As each character is sent and recorded, it is echoed back to the computer. Control characters
will be stored and echoed to the computer during record, but are not sent by the beacon.
Thus you can embed sequences which will not be transmitted.
When the message is complete and tilde (~) has been
detected, the keyer will send "73" as it reverts to normal mode. If the "73" is not received, the
tilde was not detected. The tilde is stored as an end of message marker, but is not
transmitted with the message.

Once the message is complete and the tilde received, the beacon will start. At this point, check
that the message is correct, and if you are happy with it, place a jumper from PB5 to ground,
then remove and reapply power to check that the beacon operates correctly and has remembered
the message.

Message recording only affects the user message, which is stored in electrically
eraseable reprogrammable memory (EEPROM) in the micro. It has no effect on the
microprocessor instructions, which are stored in the microprocessor program memory,
and can only be changed with a special programmer. The Hell and Morse character sets
are also stored in the program memory, in a 512 byte table.

Application Examples

The Analog Inputs are quite versatile, so can be connected to many different voltage
or resistive transducers. Here are a very few examples.

TEMPERATURE Use a 100k NTC thermistor, connecting it between +5V and the Analog Input,
and a 100k resistor from there to ground. This will give a useful range of about 0°C to 70°C.
For a higher range, use a lower resistor, and vice versa. You will need to calibrate the
input, although with a data sheet for the thermistor it will be possible to generate an accurate
conversion chart using a spreadsheet. Useful for shack temperature or transmitter heatsink monitoring.

VOLTAGE Obviously any voltage from 0 to +5V can be read directly. To read the power
supply voltage, set up a range 0 - 16V using a 220k resistor from supply to input, and a 100k resistor
from the input to ground. The MSB and MIDDLE digits of the reading will be directly in volts,
for example 12.0V will read 0x0C0. Remember the A-D is 10 bit, so a low voltage range,
0 - 1.25V can be achieved by ignoring the MSB digit. The resolution is about 5mV.

LIGHT LEVEL Connect an LDR up in much the same way as the thermistor, and you can
measure ambient light level from bright sunlight all the way to dim moonlight! I don't know why
you would want to, but it's easy to do. Use the LDR from the input to +5V, and a 100k
resistor to ground.

UNUSED INPUTS The A-D inputs are very high impedance, and should be shorted to ground
if not used. The digital inputs have weak pullups and can be left unconnected (they will then report "1").

Software Development

If you are interested in developing your own beacon, consider adapting this design. The AT90S4433 processor is now difficult to find, but the ATMEGA8 is code and pin compatible, and the design is easily adapted to similar
devices.
The development tools for the AVR family are very good, and are mostly FREE!
Make sure you have the latest versions for use with the AT90S4433 or ATMega8.

Where to get the Firmware

It is possible to purchase just the executable code, or both the executables and source code.
See the Micro Page
for details. The Keyer Schematic can be download here.