Arduino Xbee Howto

wireless data collection with xbee and arduino

an example of a zigbee star network where remote sensor endpoints wirelessly push data to a central coordinator node. the central node can then communicate this data over a usb to serial connection to a visualization on a personal computer.

you dont really need an arduino between the xbee and the computer in this example, but this network setup is more flexible as it would also allow you to use the central arduino to control actuators, or even to send messages to remote nodes with actuators.

  • flash coordinator xbee node for net <i> (0 <= i <= 9) with x-ctu:

function set - coordinator api
- pan id = 444<i>
- node identifier = MASTER_<i>
- api enable = 2

  • flash xbee sensor endpoint nodes <j…> for net <i> with x-ctu

function set - end point api
- pan id = 444<i>
- node identifier = DAEMON_<i>_<j>
- api enable = 2

arduino sketches for master and daemon nodes:

the daemon node is attached to one or more sensors. it samples them and maps their values to the range from 1-255 (so they fit in one byte). it builds a data packet with a zero to indicate the packet starting and then the sensor values listed in order, and sends it to the coordinator (master) node (which has the address 0, 0 on any zigbee net).

daemon node arduino sketch

the master node listens to the xbee on the hardware serial port and uses newsoftserial to talk to the processing visualization. it pulls each packet off of the zigbee stack and writes the data values to the software serial port as raw bytes.

master node arduino sketch

processing sketch for visualization:

the processing sketch looks for data packets (starting with a raw zero) and then redraws the visualization with the new sensor data

processing visualization sketch

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License