Temperature Example: XBee Zigbee Cloud Kit

Table of Contents

  1. Introduction
  2. Assemble the Parts
  3. Configure the Radio
  4. Wire up the Circuit
  5. View it!
  6. Use it!

1) Introduction

Measuring temperature is a popular way to get started with analog sensing. This example uses the TMP36 low-voltage linear temperature sensor that is included in the XBee Zigbee Cloud Kit. The TMP36 is very easy to set up. It doesn't require any complicated circuits or tricky calculations to determine if it's hot or not.

The sensor generates a voltage output output that is directly proportional to the Celsius temperature. The hotter it is, the higher the voltage that is passed to the XBee's analog-to-digital converter (ADC). This reading is then sent via Digi Remote Manager to the XBee Zigbee Cloud Kit's online dashboard application where you can monitor the temperature right in your web browser.

2) Assemble the Parts

To hook up a temperature sensor you'll need:

*...or a powered XBee Zigbee with breadboard and jumper wires.

3) Configure the Radio

You'll configure the radio using your free Device Cloud account. (Note that radios can also be configured using XCTU.)

NOTE: If your radio was recently configured by the XBee Zigbee Cloud Kit then the sampling rate and pin settings are already set. You can safely skip these steps.
  • Log in to Device Cloud.
  • Select Devices under the Device Management tab.

  • Select the XBee Gateway's radio that you are configuring, then select Properties or double-click to open the Properties window for that device.
  • Select Configurations, then Input and Output Settings, then confirm that DIO2/AD2/SPI_SCLK is set to Analog Input.

  • On the same page, confirm that Sample Rate is set to 5000 ms which will take a sample every five seconds.
  • Save your changes!

4) Wire up the Circuit

You will build this sensor circuit using the XBee Development Board. It's a good idea to unplug the USB power before working with the electronics.

  • Plug in the temp sensor into three separate rows on the breadboard as shown. With the flat side facing you, the pins are numbered 1 to 3 from left to right.
    • Connect a red jumper wire from a socket in the same row as pin 1 of the TMP36 to 3.3 volts power.
    • Connect a black jumper wire so that pin 3 of the TMP36 is connected to GND (ground).

  • Plug in the four resistors to separate rows of the breadboard as shown. They will form a chain with the each resistor connecting to one end of each resistor on either side and scale the input down from 3.3 volt input to the 1 volt maximum of the XBee Zigbee's ADC.
    • Connect a blue (or any other color) jumper wire so that the middle pin (2) of the TMP36 is connected to the open end of the first resistor.
    • Connect one end of a yellow (or any other color) jumper wire to the row where the first and second resistors meet. Connect the other end of this wire to to the XBee's AD2 pin.
    • Use a black wire to connect the open end of the fourth resistor to GND.

  • Set the DIP switch for AD2 on the PCB to OFF to disconnect the soldered-on component.

  • Here's what everything should look like, with the power plugged back in:

5) View It!

You will use the XBee Wi-Fi Cloud Kit's web application to configure a widget for viewing the temperature readings from your sensor.

  • Log in to the XBee Zigbee Cloud Kit web application: https://xbeegateway.herokuapp.com/#/login

  • Use the Add Widget button to create a new display widget

  • Choose Gauge Widget for the widget type.
  • Add a label such as "Temperature."
  • Choose your XBee Zigbee device by its ID.
  • Select ADC2 as the input stream and check the device configuration to make sure it is configured properly.

  • Enter "((value/1023)*1200)*3/10-50" to transform the input from millivolts to degrees Celsius*.
  • The calculation takes the input value, scales back by 1/3 from 3.3 volts to the 1.2 volt maximum that the ADC input on the XBee can handle
  • (value/1023)*1200) takes the reading from the XBee radio and converts it back to the millivolt reading at the ADC pin.
  • We then multiply this value by 3 to reverse the effect of the voltage divider and return the value to the millivolt reading at the center pin of the tmp36 sensor.
  • We then take this product (the actual output in millivolts from the sensor) and divide by 10 and subtract 50 to convert to degrees Celsius as per the data sheet.
  • The TMP36 data sheet is the source for this info.
  • Add a name for the Units such as "°C"
  • Set a low value of 0 and a high of 50 to see a reasonable Celsius temperature range displayed

  • Save the changes to see your new Widget on the home screen.
* If you want to use Fahrenheit, then the calculation is "(value/0.75/10-50)*1.8+32." Don't forget to change the label and value range to reflect the new unit of measure.

6) Use it!

Now you can see the temperature using the analog input of your XBee Zigbee! Try getting data from various locations, like outside on your patio or inside your freezer. You can also add a graph widget to examine data over time. Log the changes in your office to see temperature shifting from day to night. Finally you'll have the documentation to convince your boss to buy you a blanket!

Remember that this temperature sensor is designed to produce stable readings, so it may take a few minutes for the sensor to fully reflect changes from its environment. If you want to experiment with rapidly changing sensor data try building the light sensor.