A Simple Low Cost Digital Wireless Thermometer
By Phil Ray  (phil@colint.com)   October, 1999


0  INTRODUCTION:

This simple circuit is designed to report the temperature via any standard
FM broadcast band radio at regular intervals. It was constructed with an
ATMEL AT90S1200 fitted to a Dontronics SimmStick model DT-104.

Commercial wireless thermometers are usually sold with only one
receiver/display unit, and thus are limited to monitoring at only one
location. My design allows any inexpensive FM radio to be used to monitor
the temperature. Any number of monitoring locations can easily be set up.
The unit transmits the temperature reading in the form of a tone sequence
which can easily be interpreted by a human. Or, by plugging the output of
the FM radio into the sound card on a PC and running a program which I am
developing, temperature data can be logged for later display/analysis.


1  HARDWARE OVERVIEW:

The following paragraphs describe the various circuits used by the project.
With the exception of the FM transmitter circuit, (which was purchased in kit
form and built with the included components) component values were chosen
mostly based on what I had on hand. Other values can be substituted- within
reason. Note that the interface is simple enough to be constructed with
point-to-point wiring in the prototype area on the DT-104 SimmStick board! 

Refer to figure 1, the schematic of the thermometer interface.

The audio interface is designed to couple a portion of the 0-5v
square wave generated on PD6 into the audio input of the FM transmitter.
C101's purpose is to block DC from flowing through the voltage divider
composed of R101 and R102. R102 provides a way of setting the modulation
level to a comfortable level and allows plenty of adjustment in case another
transmitter design is substituted.

The power interface, which allows the '1200 to switch the FM transmitter on
and off, consists of a single 2N3906 transistor (Q101) and a 110k ohm
resistor (R103) to limit base drive current. A relatively high value of base
resistance was chosen to reduce power consumption when the transistor is on.
Note that a logic LOW on PD5 turns on the PNP transistor and allows current
to flow to the transmitter. The software design takes this into account and
sets PD5 HIGH soon after a reset on the micro-controller is received. The FM
transmitter circuit used in this project draws only a few milliamps when
powered up, so a power transistor is not required.

Interfacing the DS1620 is a simple matter of connecting the DQ
(bidirectional serial data), CLK (clock), and /RST (reset) pins to PD2, PD3,
and PD4, respectively, on the '1200. The chip draws its power from the
system's regulated 5v supply.

Figure 2 shows the modifications made to the Velleman K1771 "FM Oscillator"
kit to allow it to be used with this project. The PC board contains a
microphone amplifier which was not required. Other kits or prebuilt
transmitter units could be easily substituted.


2  SOFTWARE OVERVIEW:

Refer to the comments in the included source files for an in-depth
description of the programs' operation.

The "beacon-1.0.asm" source file was used to design and test the interface.
After some setup, it turns on the transmitter, plays a few tones through the
audio interface, turns off the transmitter for a few seconds, and repeats.
The program also tests the macros in the "tone_lib-0.1.asm" library file.

The source file "thermo-1.0.asm" is the actual thermometer application. Like
the beacon-1.0.asm test program, it too does some setup upon starting and then
enters an infinite loop. However, unlike the test program, more emphasis is
placed on low power operation. The analog comparator is shut off to save
power and sleep mode is used to power down part of the CPU when pausing
between temperature "broadcasts". The timer/counter is used to wake up the
'1200 at the end of each sleep period. Unfortunately, the 8 bit timer/counter
does not provide enough counting range to allow the '1200 to sleep for the
full sleep period, even when using the highest divisor ratio (clk/1024) and
a 500kHz clock. So, twice each second the CPU is briefly awakened to
decrement a sleep counter. When the counter reaches zero a temperature
transmission is carried out. The sleep counter is then reloaded for another
sleep period.

The temperature output from the Dallas DS1620 thermometer chip is in binary
format. In order to convert it to a format that can be transmitted a digit
at a time, the program tests, and if the output is larger,  subtracts off
powers of ten starting with 100. If the temperature output is less than 100,
10 is repeatedly subtracted off until the remainder is less than 10. At this
point, the remainder is transmitted. Finally, the LSB of the temperature
reading represents one half of a Celsius degree. It is output as either a
"0" or a "5".

Negative temperatures are a special case in that they are reported in twos
complement format and need to be converted before the binary to BCD process
can be carried out.


3  OPERATION:

Operation consists of applying power and tuning the unit to any unused FM
channel. The 5v regulator used in my prototype can accept any DC voltage
between about 5.5 and 12 volts. I chose to use a 9v transistor radio
battery. I have found that it is easier to set the receiver to the desired
station and rotate the tuning control on the unit (with a screwdriver) until
a transmission is heard. It is also necessary to set the modulation to a
level that does not over-modulate the transmitter and cause "splatter".
Transmissions are short (a few seconds) and occur at 15 second intervals on
my prototype, so tuning may take a minute. Also, the first transmission
occurs 15 seconds after power is first applied, so don't panic if you don't
hear something when power is first applied.

When tuning is complete, the matter of "decoding" the tone pattern comes to
mind. The table below describes a very simple tone signaling scheme that can
convey the digits 0-9. I thought about using Morse code numerals, but mine
seemed a little easier to learn and more intuitive.

<L> = low tone, has a value of "1"
<H> = high tone, has a value of "5"

DIGIT PATTERN               HINT
  0   <H> <H>               Special case, 5+5="0" (carry the 1)
  1   <L>                   These next four
  2   <L> <L>                     are pretty
  3   <L> <L> <L>                 straightforward, just
  4   <L> <L> <L> <L>             count the number of "1"s.
  5   <H>                   This is the "5" tone by itself
  6   <H> <L>               Once again, start adding "1"s until
  7   <H> <L> <L>                 you get to
  8   <H> <L> <L> <L>             nine, which is
  9   <H> <L> <L> <L> <L>         just "5+1+1+1+1"

Some things to keep in mind when interpreting the output:

  1. The readout is in degrees Celsius.

  2. The last digit is always either a "0" or a "5", indicating ".0" or ".5"
     degrees, respectively. There is no decimal point. The last digit is
     assumed to be behind it. Thus, "2..7..5" is 27.5 degrees.

  3. Positive temperatures do not have a leading zero. For example, 31.0
     degrees would be reported as "3..1..0". Negative temperatures are
     reported with a leading zero. For example, -12.5 degrees would be
     reported as "0..1..2..5".

 
4  IMPROVEMENTS:

Below are some additions to the basic design presented here. Unfortunately,
most, if not all, of them would further complicate the interface circuitry
which now conveniently fits within the prototype area on the DT-104 board.

1. LOWER POWER OPERATION: As with any battery powered device, longer battery
life is a primary concern. I don't know of any further power saving
techniques which could be written into the current software that would
significantly prolong battery life. However, some long-range micro-power
timer circuit might replace the sleep mode counter loop employed by my
software. The CPU could be awakened by a reset from the timer, output a
temperature reading, and then go into complete power down mode and await
another reset.

2. FAHRENHEIT OUTPUT: This is an obvious addition to the software. However, a
switch or jumper (and possibly a resistor or two) would need to be added to
the interface. I decided not to implement this feature in my first version
of the software because such a conversion could easily be done in a PC
program, 

3. "TUNE" FUNCTION: Tuning the prototype's transmitter to the desired
frequency can be difficult because the transmissions are short and
infrequent. A useful improvement might be to turn the transmitter on at
power-up and leave it on until after the first temperature reading. The user
would then have about 15 seconds for tuning purposes.

4. SELECTION OF MY SIGNALING SYSTEM OR MORSE CODE: This could be done at
power-up, but would require a jumper or switch for selection purposes.

5. SPEED SELECTION: Power savings would result from speeding up the
signaling speed because the transmitter would not need to be energized for
as long. A moderate increase in speed would still allow human readability.

6. RS-232 INTERFACE: Since the DT-104 SimmStick has provisions for an RS-232
interface on-board, adding this feature to my prototype would be relatively
easy. A computer interface would make selection of options and additional
features very easy. Some method of powering down the RS-232 interface when
not in use would need to be devised


EOF: Readme.txt
