Hardware and software requirements
For this first project, we will need Arduino boards, PIR motion sensors, and some XBee modules and XBee shields, depending on the number of sensors you want to have in your system. For just one sensor, you will need the following components:
- Arduino R3 board (https://www.sparkfun.com/products/11021)
- PIR sensor (http://www.adafruit.com/products/189)
- Series 1 XBee module (https://www.sparkfun.com/products/11215)
- Arduino XBee shield (https://www.sparkfun.com/products/10854)
Note that I added the link to the components I used for this project as a reference, but you can also choose to use other components.
The motion sensor needs to have three pins: two for the power supply and one signal pin. It should also use a 5V voltage level to be compatible with the Arduino Uno board that also operates at 5V.
For the XBee module, I used a Series 1 XBee module, 1mW, with a trace antenna (which means it doesn't require any external antenna). You could also use a module with an external antenna, but you would then have to connect the antenna to the module. I used Series 1 XBee modules for this project as they are easier to use than Series 2, which have functionalities we do not need for this simple project. This module has a range of about 100 meters without obstacles.
You will also need to connect your XBee module to your Arduino board. For that, each of my motion sensor modules will use an Arduino XBee shield from Sparkfun, but you can use other brands as well. It just needs to make the connections between the XBee module and the Arduino board.
Finally, you will need a way to communicate with these XBee modules from your computer. I used another XBee module (also Series 1, 1mW, with a trace antenna) connected to an XBee explorer board from Sparkfun, which is basically a USB interface board where you can plug any XBee module. I used the following components for the module connected to the computer:
- XBee explorer USB (https://www.sparkfun.com/products/8687)
- Series 1 XBee module (https://www.sparkfun.com/products/11215)
On the software side, you need to have the latest version of the Arduino IDE installed on your computer. For this project, the Arduino IDE 1.0.5 was used.
You will also need the aREST
library for Arduino. You can find this library at the following link:
https://github.com/marcoschwartz/aREST
To install the library, extract all the files in a folder named aREST
(or create this folder if it doesn't exist yet). Then, place this folder in your /libraries
folder inside your main Arduino folder. You will also need to have a web server installed and running on your computer so that you can use the web interface that we are going to develop at the end of this chapter.
To configure your XBee modules, you will also need to have the XCTU software installed. You can find it at the following URL:
http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/xctu