Monday, January 12, 2009

My Arduino Sensor Network

Alright, now has come the time to start discussing the meat of my development projects, which is a very simple sensor network linked via Zigbee radio. In itself, this isn't really terribly useful. All it does is record outside temperature and light levels and then display them with a serial-LCD display by my desk. You could do most of this with a simple wireless indoor-outdoor thermometer from Canadian Tire! However, what I am really building towards is building the control system for a solar pool heater for next summer's pool season so I don't have to faint from hypothermia every time I go for a swim.

Here is a diagram of the current system:

The three components are - each will be discussed in their own posts:

  • Gumstix webserver & data logger - This uses a Gumstix Linux box and a simple RS232 link to talk to an Xbee Zigbee radio from Digi (formerly Maxstream). Click here for more info on the radios.
  • Indoor display & indoor temp sensor - This displays the indoor temp from a local sensor and the outdoor temp from the remote.
  • Remote light & temp sensor - I will discuss this in more detail next.

Remote Sensor unit:

This is probably the most critical unit. It contains:
  • A DS1820 OneWire precision temperature sensor
  • A photoresistor light sensor
  • The on-bard Arduino LED connected to digital pin 13 shows whether the light level has crossed a threshold
  • The other LED is to test sending commands over the Xbee
  • It can optionally have a moisture detector, but I have taken this out for now
  • Power regulators for 5 VDC (for the Arduino) and 3.3 VDC for the Xbee
Here is a rather idiosyncratic schematic (click to see full size):




Here is a view showing the layout of the components when it was using my Arduino Nano:


And here is a more resent shot showing it with my new DuinoStamp installed:






Good heavens I do sloppy breadboard installations! The plastic food container idea comes from Tom Igoe's excellent Making Things Talk, which is definitely the first book to buy if you are interested in this stuff. The box is reasonably weatherpoof and I have had this running outdoors for quite a while with no problems.

The firmware for the remote is reasonably simple, it checks the state of the two sensors (three if the moisture detector is installed) and the values received via the Xbee serial link. If a "g" character (ASCII 103) then the Arduino pushes out the values of the sensors and the state of the two on-board LEDs out over the Xbee. If an "h" is received (ASCII 104) then the Arduino turns on LED 2 connected to digital pin 7. If an "l" is received (ASCII 108) then the LED is turned off.

For those who absolutely have to see the source code, it is posted here. There is a lot of material related to the OneWire digital temp sensor that, frankly, I don't understand, but I borrowed from here.

That should be enough for now. Next up will be the Gumstix webserver & data logger.


2 comments:

  1. I cannot believe you're allowed to use the good Tupperware for this stuff :)

    ReplyDelete