WIRELESS DIGITAL THERMOMETER PROJECT

By Phil Ray electron@ieee.org 1-Nov-1999

INTRODUCTION HARDWARE SOFTWARE OPERATION IMPROVEMENTS

SOURCE_CODE HEX_FILES

SOFTWARE

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.

The software is written in assembler using TAVRASM for Linux by Tom Mortensen. Tom's assembler is compatible with ATMEL's assembler.