Download the AVRStudio assembly source
(HTML format):
morbcna.html
Download the AVRStudio Hex (Intel Intellec 8/MDS format):
050219A.hex
Project
Overview
Photo 1. The Low Cost Telemetry Device is composed of an ATMega8, a
serial interface, and some decoupling components. A crystal is not
needed.
OVERVIEW
The Low Cost Telemetry Device (LTD) provides a low cost, minimal parts
count Telemetry keyer using an Atmel's ATMega8 Microcontroller. The LTD
sends data by measuring voltage levels of up to four analog channels
via its on-chip 10-bit Analog to Digital Converter (ADC) and converting
them to numbers and sending the measurements via Morse Code. There are
two signal outputs - one is a binary Morse Code signal such as would be
used to key a Continuous wave (CW) transmitter, and the other output is
tone modulated and could be used to drive a small speaker to the audio
input of a transmitter.
Options allow setting code speed to 25, 10, 5 or 1 word per minute, 1
kHz or 500 Hz tone, and measuring 1, 2, 3, or 4 analog channels. The
options maybe set with jumpers or with and EIA-232 terminal, and in the
case of setting it up with a terminal, a text string of up to 80
characters maybe sent along with the data. Terminal settings are 9600
Baud, no parity.
Thoroughly Modern Morse
Morse code , now over 150 years old, has long since faded from use by
Coast Guard, Navy and other Military Services in favor of modern
communications
modes usually carried over microwave or Satellite links.
So one must ask , why use Morse code when we have things like Bluetooth
or 802.11 to send data? The answer is simplicity and reliability. When
Samuel Morse demonstrated the Telegraph to Congress in 1844 it was
clear that one of the key features of his device was simplicity. Only
later would the use of RF demonstrate it's robustness in poor RF
conditions. Besides it's reliability, good signal to noise ratio and
simplicity factor, Morse code has one more feature that makes it
thoroughly modern: the ability to be decoded by human ear.
Morse Code still has millions of Amateur Radio fans around the world
who swear by it's ability to "get through" when RF conditions are poor.
Although no longer used as the defacto communications mode it is still
required knowledge by military Special Forces and some Amateur Radio
Operators licenses.
In the special case of Amateur Radio use, the data identification
string can be programmed into the controller to provide proper ID or
other supplemental information when using the device as a repeater
controller or automatic keyer. For example, Amateur Radio Operators can
use the LTD as a Contest Keyer by turning the analog to digital
channels off and entering a text "CQ" message.
The range of uses also includes amateur rocketry and unmanned balloons,
repeater station operating parameters, manufacturing process
parameters, or liquid levels such as those in fuel tanks or water
courses.
Teaching a
Micro to Tap Dance -Hardware Overview
As mentioned above, the simplicity of hardware was a prime concern for
this project, so naturally a single ATMega8 Microcontroller would do
the honors (see figure 1). This chip was turned into a smart Morse code
operator while making use of the chips Analog to Digital conversion
feature. For this project the 28 lead PDIP version of the device allows
for 4- channel 10-bit ADC input operation as easy prototyping.
Figure 1. Functional block diagram of the LTD. All blocks except the
optional EIA-232 buffer are on the ATMega8.
The controller firmware, which is described in a separate section,
contains routines to scan from one to four 10-bit analog input channels
and send the measurements by Morse Code as determined by either jumper
settings, or parameters set with a serial terminal and the parameters
stored in the chips internal EEPROM. When the parameters are set with a
serial terminal, a text string of up to 80 characters may be optionally
sent along with the measured voltages.
If operation is not set up with a serial terminal, operation is
determined by the setting of hardware jumpers to ground (the chip has
internal pull-up resistors of about 50k Ohms.), and one special jumper
will force the jumper selections to override any previous setup
information stored in the on-chip EEPROM.
Here are the jumper selectable settings.
Default Operation (PDIP Pin 11)
When this pin is grounded, operation is determined solely by the jumper
configuration, meaning that all parameters stored in EEPROM will be
ignored, though those parameters may still be edited if an EIA-232
terminal is connected.
Tone (1 Khz.500 Hz) select (PDIP Pin 5)
The state of this pin determines whether the Morse Code Tone output
frequency is 500 Hz or 1 kHz.
Open = 1 KHz tone
Grounded = 500 Hz tone
ADC channels selection (PDIP
Pins 4 and 5) The states of these pins in
combination determine whether 1,2,3, or 4 ADC channels will be measured.
Pin 5 Pin
4 Channel(s) measured
Open
Open Channel A only
Ground Open
Channels A and B only
Open
Ground Channels A, B, and C only
Ground Ground
Channels A, B, C, and D
Morse Code Speed (PDIP Pins 27
and 28).
Pin 28
Pin 27
Morse Code Speed
Open
Open
10 Words per minute
Open
Ground
1 Word per minute
Ground
Open
5 Words per minute
Ground
Ground
25 Words per minute
The 1 word per minute code speed is intended for very low speed
computer-to-computer radio
communications where the signal-to-noise ratio is very poor.
Note that grounding Pin 11 and leaving the other pins floating will
result in only analog channel A being repeatedly measured and sent at
10 words per minute, with a 1 kHz tone.
The Circuit
Figure 2. Adding only a power supply and the optional EIA-232 buffer
allow all of the chips features to be used.
The LTD circuit is pretty much an ATMega8 running with its internal 4
MHz clock, along with a power supply and an optional EIA-232 buffer. In
the simplest implementation, the EIA-232 buffers may be omitted and
operation set only by grounding selected pins.
Unused inputs on the ATMega8 are held high by the chips internal
pull-up resistors to prevent the pins from floating between logic
levels, thus potentially saving a few milliwatts of power dissipation.
The RXD input also has an internal pull-up resistor, so that if a
discreet transistor EIA232 buffer is used instead of the MAX32, a
pull-up resistor would not be needed on the RXD input.
Construction
The LTD was wired and soldered on a pad-per-hole perforated prototyping
board made of
AVR2004 Entry A3692 Page 6 of 62
FR-4 epoxy, using simple point-to-point wiring techniques. All
semiconductor devices are socketed except for the 7805 5-volt regulator.
A 9 volt Bunny battery supplies DC for the device. Several two-position
PC board terminals provide the 4 analog inputs, the battery DC input,
and the regulated 5 volts DC for connection to off-board devices. A
DB25 (25 pin D connector), which is the interface for the serial
terminal, is elevated above the board using standoffs. See Photo1.
Example
Application
This Project demonstrates LTD in a practical application using a
Temperature sensor , the LM34Z. This device provides Precision
Temperature to voltage conversion for input into the LTD.
Figure 3. Block diagram of simple stand-alone Morse Code thermometer.
The temperature voltage converter, made with a National Semiconductor
LM34 and a National Semiconductor LMC7111 operational amplifier provide
the LTD with a voltage proportional to current. Every several seconds,
the LTD measured the analog voltage and sends a signal in Morse Code
that corresponds to the air temperature. For example, an air
temperature of 23.1 degrees centigrade would result in 232 being sent
in Morse Code. A block diagram of the demonstration system in shown in
Figure 3, and a photograph of it is shown in Photo 2.
A example of how to use the KEY output of the LTD to drive a SAW-based
transmitter is shown in figure 4.
Photos 2. The temperature sensor circuit board only requires three
conductors to connect to the LTD board -+5 volts, the sensor output,
and ground.
Figure 4. Example of drivinga SAW-based transmitter.
Endless Opportunities
An option that could be added is a squelch function, by which, channels
below some preset threshold would not be sent.
A real time clock could be added so the LTD would send data at specific
times, or allow for conditional telemetry, or to time-stamp for logging
purposes. One could imagine an application in which the LTD is
connected to a door switch, and upon opening the door, the LTD would
send the Morse Code message: DOOR OPENED AT 10:15 PM.
Firmware
Overview for Low-cost Telemetry Device
The firmware allows the operation of the chip (number of channels to
scan, code speed, etc.) to be determined by either setting it up via an
ASCII terminal that stores operating parameters in the ATMega8s on-chip
EEPROM,. or by jumper selection. In the case of jumper selection, an
additional jumper allows the jumpers to override any setup information
stored in EEPROM, thus assuring that the chips operation can be
programmed without the use of a terminal, even if it had been
previously set up using a terminal.
After power-on reset or after being restarted, the chip detects the
presence of valid terminal
setup information in the EEPROM (The initialization sequence is
illustrated in the Start flowchart, above). If valid setup information
is present, it runs a program that controls the operation of the chip
based on that setup information. If valid setup information is not
present, it runs a program that repeatedly scans the jumpers and
controls the chips operating sequence based on the settings of the
jumpers.
Above is a screen shot showing the ASCII output during startup. The
firmware version (morbecon040516D) is displayed, followed by the setup
parameters stored in EEPROM, followed by the first analog measurement.
If a text string had been programmed, it would have appeared just
before the first analog measurement. The text string, if present, and
the analog measurement (C200 in the example above) were also sent in
Morse Code.
The program that controls chip operation based on the jumper settings
(this program is illustrated by the Default Main Loop flow chart,
above) runs through sequence of checking the jumper settings and
setting up the selection of A/D channels, the Morse Code speed and tone
pitch, then measuring the A/D channels with 10 bit resolution,
converting the analog data to decimal and then sending the data as
Morse code and also to the serial output as ASCII data. Once each
cycle, the UARTs receiver buffer is inspected then
emptied. If an carriage return (ASCII $0D) is found in the buffer the
analog polling and sending cycle in stopped and control is passed to a
program that allows setup by the ASCII terminal.
The program that controls chip operation based on settings stored in
the on-chip EERPOM (this program is illustrated by the Main Loop for
Programmed Operation flow chart, above) runs through sequence of
setting up the operating parameters, measuring the analog channels that
are to be measured, and sending the measurement results. Similar to the
default program, the Main Loop for Programmed Operation also checks for
a carriage return in the UARTs receive buffer and switches control to a
program that allows setup of chip operation by the the ASCII terminal.
The measurement of up to four analog channels, based on settings store
in the EEPROM is illustrated in the MeasureAndSendProgVolts flowchart,
above. The process for settings stored in EEPROM differs from the
analog scanning and output under control of the jumpers in that when
using EEPROM stored parameters, any of the four channels can be
arbitrarily enabled in any combination, while under jumper control,
only one of the following combinations are allowed, according to the
following table:
Bit 3 Bit 2 Measure
1 1 Channel A only (ADC 0)
0 1 Channels A & B (ADC 0,1)
1 0 Channels A,B & C (ADC 0,1,2)
0 0 Channels A,B,C & D (ADC 0,1,2,3)
A simple editor allows editing of operating parameters, as shown in the
flowchart above (titled Options Editor) and the screen shot at the
startup of the editor, below. All commands are a single character in
length. Text strings of up to 80 characters may be entered using a
simple line editor.
(Above) Screen shot of menu in editor.
The flowchart, SendMorseASCII illustrates the process by which ASCII
characters are converted to Morse Code. The hex value $31 is subtracted
from the ASCII character to create an index into a table. Thus, the
index created from ASCII A ($41 hex) would be $11 hex. Some ASCII
characters do not have Morse Code equivalents, and are silent. Silent
characters are coded as 0b00000001, which results the sending loop
terminating before sending any Morse Code.
The Morse Code is bit-banged out of PORTB, bit 3 and the tone modulated
code is generated by toggling PORTB bit 2 during interrupts. The
toggling that generates the tones is gated by an internal flag that is
set during a dot or dash. The code the bangs out the Morse Code is
illustrated in the flowchart titled SendCodedCode.
The basic unit of Morse Code timing is a dot period, and all other
timings -dashes, inter symbol , inter character and inter word
intervals are multiples of the dot period. The dot period is timed by
the firmware by setting the 16 bit timer and waiting for it to
overflow. The reason the timer is used to time the dot period rather
than using a timing loop is so that the interrupts for the tone (which
can occur at either 2,000 or 1,000 interrupts per second) do not affect
the dot period.