A Wireless Motion Sensor Array – Part 1

The goal of this project is to create portable battery powered motion sensors that I can use around my house and office with multiple receivers (one in my office, one in my electronics workshop, one up in the bedroom for night security). I’m even going so far as to put one on my front porch so I quit missing UPS and FedEx from not being able to hear the doorbell.

I’ve been tinkering with Arduinos on and off for about a year now but this will be the first project I’ll design and build from scratch. I’m excited because I actually want to use this thing!

First a word on the confusing title of this post. These sensors aren’t “motion sensors” but that’s what everyone calls them. Technically they are Passive Infrared Sensors, or PIR sensors for short. These are the same sensors you can buy attached to outdoor lights that turn the light on as you walk by. They don’t detect motion, though, they detects differences in infrared radiation. That sounds complicated but it isn’t – it essentially means that they see heat and when they see something hot that wasn’t there before, they “alarm”. This means that cars, animals and  anything warmer than the ambient temperature can set them off. Yea, I guess it is less confusing to just call them motion sensors 😉

The shopping list / parts list :

  1. Arduino. I’ll prototype using 2 Arduino Duemilanoves (one for a sensor, one for the receiver).
  2. A PIR sensor – preferably one from Adafruit – don’t forget to check out their PIR Sensor Tutorial. I recommend against using the PIR Sensor Sparkfun sells – I found the 3.3v ones to be much more reliable and easy to work with.
  3. A set of 315MHz or 433MHz transmitters and receivers. Don’t mix and match. I chose the 315MHz ones because they’re slightly cheaper and I already had them. You can get them at Sparkfun or Seeedstudio (you’ll get it cheaper from Seeedstudio but since they ship from China directly, you’ll wait longer).
  4. The VirtualWire library for Arduino.
  5. A Buzzer so the receiver makes a little noise to get our attention when one of the sensors sends an alarm.

Here we go.

The first step is to work out the RF. I need to make sure I can make a transmitter talk to a receiver. I’m going to make the transmitter just send an bit of data every second and make sure I can read it on the receiver side.

Grab your transmitter Arduino, plug the USB cable in and upload this sketch to it :

All that sketch does is send our alarm data (“A1” in this case), every 2 seconds.

Now wire up the transmitter Arduino like this :

  • Transmitter VCC pin to the 3v3 pin on the Arduino.
  • Transmitter GND pin to Arduino GND
  • Transmitter Data pin to Arduino digital 12.
  • Transmitter ANT pin to a piece of wire, a jumper wire will work for now (that’s the antenna).
  • Stick an LED at pin 13 (long lead to pin 13 socket, short lead to the GND pin right next to it). Remember that the Arduino already has a resistor at pin 13 so it’s ready for an LED. The Duemilanove has a surface mounted LED attached to that pin as well.
  • PIR Sensor VCC pin to the 5V power on Arduino
  • PIR Sensor GND pin to GND on Arduino
  • PIR “out” or “data” pin (the one in the middle), to digital pin 2 on the Arduino

It should look something like this :

RF Transmitter & Arduino

Test transmitter done. On to the receiver.

Grab your receiver Arduino and load this sketch :

The receiver sketch listens for data coming through the RF link and makes sure the first character of the message is “A”.

Wiring the receiver is a little bit more complicated because I had to use a breadboard but it isn’t that bad. Wire up the receiver Arduino like this :

  • Buzzer GND to breadboard GND
  • Buzzer + to digital pin 4 on the Arduino
  • Receiver GND pins to GND rail
  • Receiver ANT pin to a piece of wire about 3-4 inches long.
  • ONE receiver +5 pin to the power rail, tie the other one in to the first (that’s the brown jumper coming down the breadboard).
  • ONE data pin to digital pin 2 on the Arduino
  • Leave the 2nd data pin unhooked.

It should look something like this :

RF receiver & Arduino

That’s it! Plug the USB or power cable in to both and you should heard that buzzer go off one time every 2 seconds. If you hear nothing, check all of your wires.

Why do all of this? I initially did it because I’d never done any RF stuff with the Arduino and I wanted to make sure I could get that part working before moving on to tying in the PIR sensor.

There is a great Jumper Wire Kit from Sparkfun that makes breadboarding much more tidy!

Part 2 coming up. I’ll attach the PIR sensor and modify the transmitter sketch to only send the alarm when the PIR sensor gets tripped.

3 comments to A Wireless Motion Sensor Array – Part 1

  • […] more information about this project, click here. And for more, we’re on twitter and Google+, so follow […]

  • Harry Vaughan

    Really like your project. Keep up the good work. Just found one problem. In the receiver code the led will not light unless you make pin 13 for output. Thank you for the great code. What is your next project?
    Thanks Again
    Harry Vaughan

    • Hi Harry — sorry it took me months to reply! Who knows what my next project will be. I found that documenting and writing about most of them took more time than the project itself so I’ve really not done much more reporting. I might be able to get back in to it this year…

      As far as pin 13 goes — I’ll have to look back and see what the problem was. Thanks!

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">