Low Power Wireless Temperature Sensor
PROJECT BOARD

This was the first time I attempted a very low power battery powered project.  I had built several temperature sensors using the DS18B20 but this time I wanted an outside sensor and I didn't want to run a lot of wire thru the walls of my house.  So the software to obtain the temperature using the DS18B20 is pretty much the same as the earlier projects.  What is different is the necessity to minimize power use.

The MC9S08QE8 was touted for ultra-low-power so I chose it as the MCU.  I found the stop mode a little tricky to set up but I worked it out.  The XBee wireless modules from Digi are wonderful short range wireless transceivers.  This project uses them in only their most simple mode but they have many complex networking possibilities.  You need two XBee's, of course.  Right now I have one in the outdoor sensor board and the other in a USB Sparkfun module connected to my PC.  Use a program from Digi called X-CTU to set the source and destination addresses of the XBee.  To make it simple I set the source address to zero and the destination to one on the transceiver connected to the PC.  The XBee in the outdoor sensor has that reversed.

At this point the project sends the data out to my PC.  In future enhancements the data could be used in a graphing program or it could be used by another microcontroller to log the data and/or display it on a display perhaps like my LED Dot Matrix Display Board.

 
Click for a large view You can buy a blank pcb like the one to the left from
BatchPCB

If you would rather not program the MCU yourself you can get it pre programmed.  Check my ordering page.

Put the project board and batteries in a suitable enclosure and put it outside in the shade, perhaps on the north side of your house, a few feet off the ground where there is good air circulation.

You may wish to drill a small hole and run the sensor through it for faster temperature response.  In my case I just left the sensor inside the enclosure.

Low Power Wireless Temperature Sensor schematic

R1 is the pull-up for the off board DS18B20
R2 and the six pin header is for the BDM used to program the MCU.
R3 and the LED are for debugging; leave them off for longer battery life.
IC1 is the MCU
IC2 is a LM2936Z-3.0  This is a low dropout 3 volt regulator that I am using with a three cell AAA battery pack.  You could skip the regulator and use a two cell battery pack or other 3 volt source.  I felt that this would give me the longest time before having to change batteries.  Only time will tell; come back in a year.

This is about five minutes of data from shortly after sunrise when it was warming up quickly.

Assembly language software for MC9S08QE8

First establish a connection with your PC.  After you install the USB module determine the COM port and open your favorite terminal program with that COM port number.  Set the baud rate to 9600.  Then install the batteries.  The project board should send a wake up message to the terminal program.  You can test the DS18B20 by typing the command: TEMP.  The MCU will respond with the temperature and the serial number of the DS18B20.  If it does, everything is working as it should be but the XBee transceiver is still powered and using 50 ma.  Now type the command: SLEEP.  The XBee will go into hibernate mode and use less than 10 µ amps.

When the MC9S08QE8 goes into stop3 mode the supply current drops to less than 1 µ amp.  In stop3 mode all the clocks and peripherals become inactive except the very low power Real Time Clock.  I have programmed the RTC to awaken the MCU ever 20 seconds.  At that point it takes a temperature reading and checks the Vdd voltage.  This takes about 3/4 of a second; then it wakes the XBee and send out the data, maybe another tenth of a second then everything goes back to sleep.

For BDM's

  Lowest cost.

The 9S08 family is programmed using a Background Debug Module and Code Warrior.  CW can be downloaded from the Freescale website.

 

Roger's Embedded Microcontrollers Home Page     


This page written by Roger Schaefer. Last updated December 13, 2010