Sunday, 15 April 2012

ProBee Based Home ZigBee Network - Part 2 - Temperature Reporting End Node

Overview
Welcome to part 2 of the ProbBee based home Zigbee network. In this part of the series I will be detailing how to setup, configure and test a temperature reporting end-node. We will follow these steps:
  1. Design and build the circuit.
  2. Configure the ProBee module to periodically report the temperature and enter a low-power sleep mode.
  3. Configure the network co-ordinator.
  4. Test the system using a terminal app, such as putty or hyperterminal.
and require this hardware:
  1. Breadboard with jump-wires.
  2. ProBee-ZE20S module for the end-node.
  3. A ProBee-ZU10 usb dongle as the co-ordinator.
  4. The ProBee manager software, to configure the end-node and co-ordinator.
  5. A ProBee expansion board, which will allow us to mount the module onto a breadboard. Please contact me if you need an expansion board as I have some spare ones.
  6. A TMP35 temperature sensor in DIP package, used for sensing the room temperature. These are extremely easy to use, for more info please look at ladyada's great overview here.
  7. A DIP LED used for indicating the status of the ProBee module.
  8. A power circuit for regulating our battery power supply to the 3.3 volts required by the ProBee module and TMP36. Alternatively, the easiest thing to do would be to get a Breadboard Power Supply like this from Sparkfun: Breadboard Power Supply 5V/3.3V, it won't be the most efficient approach, but will be fine for what we need.
Circuit Design
The following is my 'back-of-cigarette-packet' style circuit diagram:
Temperature Sensor Circuit Diagram
You can see the main components: the ProBee module, TMP36 temperature sensor and status LED. For an excellent tutorial on the TMP36, please see LadyAda's page here. Note that I have connected the output of the temperature sensor to PB_5/ADC0 pin of the ProBee module.

My ZigBee Temperature Monitoring Node
We can see from the above picture I have chosen to use a regulator circuit on the board. If you are very new to electronics I'd suggest to make life easier and purchase the previously mentioned Breadboard Power Supply 5V/3.3V.
Also from the picture above you can see that I have the ProBee module pugged into an expansion board so the board can be plugged into a breadboard. I have several of these boards spare and will happily post them to any reader for only the cost of postage.

Configuring The ProBee Modules
First of all make sure your ProBees are using firmware v1.5 or higher.
Secondly, I'm not going to delve too deeply into the config of the sensor node and co-ordinator. Programming the ProBee modules is very straight forward, Sena have some good documentation on their website here. I would highly recommend reading the ZigBee Network Configuration section of the ProBee-ZE20S User Guide!

I have created two configuration files that can be programmed into the ProBee modules using Sena's ProBeeManager application:

  • Our Zigbee temperature sensor node. This configures the ProBee module to sleep for 5 seconds, wake up, take samples of it's digital/analog I/O ports, transmit this to the co-ordinator and go back to sleep (see section
    3.4 Setting up ZE20S as a Sleepy End-Device of the user manual)Probee_SED_Blog_150412_115200baud
  • The ZigBee co-ordinator (program your ProBee usb dongle with this): Probee_ZC_Blog_150412_115200baud

Note the serial interface baud rate for both configurations is set to 115200 baud.

Testing
Connect the Co-ordinator (ProBee usb dongle) into a usb port on your computer and open a serial connection to it using your favourite terminal application. If you are using my config files above, ensure you have the baud rate set to 115200.

Now power on your sensor node. You will notice that the status led flashes on briefly every 5 seconds. This is the ProBee waking from sleep node and transmitting the sample of the analog and digital IO.

Looking at the Co-ordinator's terminal output, you can see the messages coming from the sensor node:
Messages received by the co-ordinator from the sensor node

Each line represents a single message received by the co-ordinator from the sensor node. We are interested in the field reading 1C3F, this is the hexadecimal value for the Analog sample of ADC0 port (which the TMP36 is connected to) on our sensor node.

Decoding the Temperature
There are two steps to the decoding of the actual temperature. First we need to get the measured voltage (TMP36 output voltage):
Vadc = AdcValue * 0.1

Then to get the temperature:
Temperature (Celsius): (Vadc - 500) * 0.1

Therefore:
Vadc = 0x1c3f * 0.1 = 723 mV
Temperature = (723 - 500) * 0.1 = 22 Deg Celsius

Note that the ProBee devices can read in a voltage range of 0 to 800mV!

Next
So, we now have a working ZigBee temperature sensor node! Next up is to do something with the raw text that is outputted by the co-ordinator over the serial interface. In Part 3 we will be using emoncms to display the temperature data on a web page.

An example Emoncms widget
This series:

3 comments:

  1. Daniel, any suggestions for a packaged zigbee temperature sensor, to avoid one having to roll your own using the TMP36? The Digi units look rather expensive (retailing for $100). I found an alternative for $65, here: http://goo.gl/Oyt72

    Alternatively, I wonder if there's a potential benefit in using the ProBee-ZE20S, in that we could connect up multiple temperature sensors to it. I see from the docs it lists 6 analog inputs...

    ReplyDelete
  2. Thank you for a great tutorial! I've started my own project based on the ZU20S, however, I can't find any sourde of the expansion board. Could you please let me know where to find it?

    ReplyDelete
    Replies
    1. Hi Arvid,
      I got those boards made myself. I have some spare, if you would like me to post one to you, please email me (donal.morrissey[a_t]gmail.com).
      I could also post the PCB layout files on the blog if that would help.
      Cheers,
      Donal

      Delete