Book Image

Building Wireless Sensor Networks Using Arduino

By : Matthijs Kooijman
Book Image

Building Wireless Sensor Networks Using Arduino

By: Matthijs Kooijman

Overview of this book

Table of Contents (13 chapters)

Creating a standalone relay


In addition to reading the input pins remotely, you can also control them remotely. All the XBee modules support a digital output (low/high) and some also support PWM output (pulse width modulation, as used by analogWrite in Arduino).

This section shows how to use a digital output pin to control a relay, letting you make a simpler version of the remote relay that you saw in Chapter 4, Controlling the World. Obviously, the wiring will be different as there is no Arduino involved anymore. The coordinator sketch will also need some modifications as the XBee module needs a different kind of a message to change its output pin.

When using the recommended hardware items, this example should look as follows:

Connecting things

Most of the wiring is the same as with the window sensor. You will need some kind of a breakout board and power supply. The relay module can be wired up by connecting GND and VCC/5V to the power supply and the relay control pin to the DIO1 pin on XBee...