Wireless Sensor Networks

The ZigBee protocol is a popular way of creating wireless sensor networks. It automatically forms networks that can heal themselves and provide routing.

Digi International manufactures a wide range of XBee-branded radios. For our sensor network, we will use the series 2 that support the full ZigBee protocol. Since we are located in Europe, 10mW is the maximum transmission power allowed per device.

ZigBee devices can be configured as Coordinator, Router or End Device, depending on their role in the network. Each network must have 1 and only 1 coordinator.  The others, depending on the topology and number of devices, will be configured as Router or End Device. In our network, we will configure the other devices as End Device and use a star-topology with the Coordinator as central hub.

An XBee can be connected to sensors and actuators. For our remote sensor nodes, we will connect a light sensor and a movement sensor (Passive Infra-Red). Furthermore, we will periodically send remote AT commands to the end devices to query their temperature (an XBee PRO feature) and their supply voltage.

EndDevice1     EndDevice2

The coordinator is connected to a microcontroller (a GHI Spider running .NET Micro Framework) that serves as the brain of the sensor network and a gateway to the internet.  End Devices are configured to periodically wake up, poll their sensors and send the data to the microcontroller. The movement sensor can also awake the XBee when movement is detected, so that the microcontroller is notified instantly.

In addition, some sensors are connected directly to the microcontroller: barometer, light, temperature and current. The microcontroller uses a WiFi module to send the collected sensor data to a repository on the web.

MCU

To access our data, we send it to thingspeak.com. For our network, we create a channel per end device. Each channel has four fields representing the four sensors of the end device: light, temperature, movement and supply voltage. ThingSpeak allows us to view our data in configurable graphs and react to certain conditions, for example send a tweet when movement is detected in a certain room. ThingSpeak functionality is also exposed by REST web services that easily integrate with your own applications.

The challenge is to make sense of it all. A huge amount of data is collected by the sensor network and simple graphs often don’t reveal useful information very clearly. New websites such as Open.Sen.se focus on creating (web) applications to process the raw data from the wireless sensor network and create new data, more useful than the raw bits sent by a sensor.

The microcontroller  uses the coordinator to send remote commands to the end devices to query their temperature and supply voltage. When actuators (switches, motors, …) are connected to the remote end devices, the microcontroller  can also control these using remote AT commands. You could, for example, use a switch in an Open.Sen.se application and when the switch is toggled, a value is written to an output feed that the microcontroller  polls using simple HTTP GET calls. When the microcontroller  notices a new value for the switch’s output feed, it sends the appropriate command to the remote end device, instructing it to change the value on the corresponding output pin.

Comments are closed.