need help on wireless PIR motion sensor project

Hi there, I am new to Arduino. My project is to turn on a servo motor once a motion sensor detects a nearby person. I’ve done my homework to search similar project tutorials like http://www.openhomeautomation.net/wirel … r-arduino/ and http://www.instructables.com/id/Cheap-W … or-Device/. I am kinda confused cos they are using different Arduino boards and electronic components.

But based on these tutorial, I figured out that this project needs a PIR motion sensor, wireless transceiver (a pair of transmitter and receiver), a servo motor, and of course two Arduino boards.

The two modules:

  1. A PIR sensor >> Arduino_1 >> Transmitter: this is the motion detection module, which produces and sends RF signals to the second module

  2. A receiver >> Arduino_2 >> A servo motor: this is the servo motor control module. the size of the second module should be as small as possible as I am going to fit the whole thing in a tiny space. There are many Arduino boards to choose from (e.g. Arduino Uno R3, Pro, Due, Fio, etc.), I want to know which two Arduino boards should I buy.

Do I need a sensor shield and a motor driver shield?

I know my questions are silly, but it will be great if someone give me a list of required electronic components that I can get from SparkFun. I literally have nothing to start with, so some accessories like jumper wires are also needed.

Thanks a lot.

You almost certainly don’t need an Arduino on the transmitting side. But let me ask … What kind of coverage are you expecting the PIR to have ? How far is it from sensor to servo ? Do you have a direct line-of-sight, could the link be IR ? Why not wired ? What’s the servo supposed to do ? Does it have to point something ? If so, to how many different positions ?

Can you give us some better idea of the ‘big picture’ ?

Mee_n_Mac:
You almost certainly don’t need an Arduino on the transmitting side. But let me ask … What kind of coverage are you expecting the PIR to have ? How far is it from sensor to servo ? Do you have a direct line-of-sight, could the link be IR ? Why not wired ? What’s the servo supposed to do ? Does it have to point something ? If so, to how many different positions ?

Can you give us some better idea of the ‘big picture’ ?

Thanks for your reply.

PIR is positioned close to the servo and receiver, say 1.5 meters.

PIR should be mounted on a wall, and detect anyone who enters the room from entrance (the room has no door).

there is no direct line-of-sight, so IR is not acceptable in this project.

two modules are not wired, because I want module 1 mounted on a wall, and module 2 fit in a tiny space (100 mm x 100 mm x 100 mm).

the servo supposed to control a shaft to turn 45 degree once the receiver got RF signals. there is only one position required, turning 45 degree slowly and then turn back slowly to initial its position.

please let me know if you have any further question.

There are multiple ways of going about this. Most PIR sensors I’ve seen have an open collector type output. So w/a pullup resistor they produce a low pulse of some sort upon detection. Others are low and go TTL high upon detection. I might use a 555 timer as an oscillator (astable mode) and feed that into a cheapie AM x-mitter. The 555 would be set for something btw the min and max baud rates (1200 - 4800 Hz) and 50% duty cycle. Thus the RF is 100% binary AM, a string of 0’s and 1’s for some period of time. The PIR is holding the 555 in reset until a detection occurs. Upon detection you get a burst that AM RF.

The receiver output goes into your MCU, an Arduino if you want. These cheapie AM receivers are noisy, producing all sorts of garbage at their output. Your code should reject that noise and only when it sees a bitstream of 010101…01 at about the expected rate, and for some long enough period of time, would it recognize that the PIR had detected something. Then it commands the servo to move. You’ve not said when the servo should move back or what happens if the PIR keeps detecting more people or just the one person moving about.

You’ve also not said how you’re going to power these devices. That actually impacts what I’d choose for parts.

An alternate to using the cheapie AM pair would be to use an XBee. Then you could tie the PIR directly into the XBee And use it in it’s ‘virtual wire’ mode. The receiver would be another XBee. You loose the 555 and it’s circuitry, the cheapie AM pair but gain the more expensive XBees and their regulator board and likely a shield, which then dictates an Uno-like MCU.

Another alternate would be IR. You’ve not made it clear to me why, being 1.5m apart, the sensor part couldn’t ‘talk’ to the brains part via IR, like a TV remote. In this case the 555 is set to run at 38 kHz and 33% DC. It directly drives the IR LED, no X-mitter needed. The brains end substitutes an IR receiver module for the AM receiver but basically performs the same processing. Less $$s and trouble all around.

Last alternative is 1.5m of wire. Somehow power has to get to both parts. That’s either batteries to be replaced or some wallwart power source. If you have power wires running up the wall, why not wire the PIR directly to the MCU ? If you don’t like the look, bury the wires in the wall. Then again some people aren’t handy in that area.

Some potential parts …

https://www.sparkfun.com/products/8630

https://www.sparkfun.com/products/10535

https://www.sparkfun.com/products/10534

https://www.sparkfun.com/products/10533

https://www.sparkfun.com/products/10532

https://www.sparkfun.com/products/10266

https://www.sparkfun.com/products/9349

https://www.sparkfun.com/products/8554

https://www.sparkfun.com/products/11215

https://www.sparkfun.com/products/10854

https://www.sparkfun.com/products/11373

https://www.sparkfun.com/products/11098

http://www.adafruit.com/products/1501

Mee_n_Mac:
There are multiple ways of going about this. Most PIR sensors I’ve seen have an open collector type output. So w/a pullup resistor they produce a low pulse of some sort upon detection. Others are low and go TTL high upon detection. I might use a 555 timer as an oscillator (astable mode) and feed that into a cheapie AM x-mitter. The 555 would be set for something btw the min and max baud rates (1200 - 4800 Hz) and 50% duty cycle. Thus the RF is 100% binary AM, a string of 0’s and 1’s for some period of time. The PIR is holding the 555 in reset until a detection occurs. Upon detection you get a burst that AM RF.

The receiver output goes into your MCU, an Arduino if you want. These cheapie AM receivers are noisy, producing all sorts of garbage at their output. Your code should reject that noise and only when it sees a bitstream of 010101…01 at about the expected rate, and for some long enough period of time, would it recognize that the PIR had detected something. Then it commands the servo to move. You’ve not said when the servo should move back or what happens if the PIR keeps detecting more people or just the one person moving about.

Thanks for providing these options. I want the servo turn 45 degree slowly when it received the signal, then (say after 5 seconds) turn back slowly to its initial position. If PIR kept to detect people motion, no matter one or more than one people, this servo will do this repeatly.

Mee_n_Mac:
You’ve also not said how you’re going to power these devices. That actually impacts what I’d choose for parts.

I am going to use battery to power these devices, which means I need two batteries for the two modules as they are not wired together.

Mee_n_Mac:
An alternate to using the cheapie AM pair would be to use an XBee. Then you could tie the PIR directly into the XBee And use it in it’s ‘virtual wire’ mode. The receiver would be another XBee. You loose the 555 and it’s circuitry, the cheapie AM pair but gain the more expensive XBees and their regulator board and likely a shield, which then dictates an Uno-like MCU.

the XBee draws more power when compared with RF module. Since the system is powered by battery, so....and another issue is it costs more than RF module does.

Mee_n_Mac:
Another alternate would be IR. You’ve not made it clear to me why, being 1.5m apart, the sensor part couldn’t ‘talk’ to the brains part via IR, like a TV remote. In this case the 555 is set to run at 38 kHz and 33% DC. It directly drives the IR LED, no X-mitter needed. The brains end substitutes an IR receiver module for the AM receiver but basically performs the same processing. Less $$s and trouble all around.

There is no direct line-of-signt between two modules, that's because I'm going to put Module 2 inside a small box. In this case, IR module cannot work for me.

Mee_n_Mac:
Last alternative is 1.5m of wire. Somehow power has to get to both parts. That’s either batteries to be replaced or some wallwart power source. If you have power wires running up the wall, why not wire the PIR directly to the MCU ? If you don’t like the look, bury the wires in the wall. Then again some people aren’t handy in that area.

if I can use wire, the project will be a lot easier, I guess. but sorry, no wire.

so, I am going to use cheap RF module. Here is my list for this project:

1). 2 x arduino boards (need you advice, I do want one of them is as small as possible for Module 2, which one should I buy)

2). 1 x cheap RF 315MHz module pair

3). 1 x PIR motion sensor

4). 1 x small servo motor

5). 2 x bread boards for testing

6). some jumper wires

7). 1 x multimeter

8). 2 x Li-on battery

Did I miss anything?

Thanks again for your input.

Since this is to be battery powered you need to figure out what voltage each device needs and it’s current draw to size up the battery and determine if you need any voltage converters. IE - a single cell rechargable Li battery poduces 4+v when fully charged and drops to perhaps 2.8v before you should stop using it. Is this range of voltage compatible with all your devices; Arduino, servo, transmitter, receiver and PIR ? Can you find devices that are or do you need so stepup/boost converter ? Would you be better off using multiple batteries in series to get a higher, but even more variable, voltage ? And then use a voltage regulator ?

Also how are you going to recharge whatever batteries you get ? (I assume recharging) How long must the system run before battery swapping or recharging ? Can it be down while recharging or do you need a spare set of batteries ?

What you’re missing is a design. You need that before ordering parts or you’ll be reordering more parts shortly.

Mee_n_Mac:
Since this is to be battery powered you need to figure out what voltage each device needs and it’s current draw to size up the battery and determine if you need any voltage converters. IE - a single cell rechargable Li battery poduces 4+v when fully charged and drops to perhaps 2.8v before you should stop using it. Is this range of voltage compatible with all your devices; Arduino, servo, transmitter, receiver and PIR ? Can you find devices that are or do you need so stepup/boost converter ? Would you be better off using multiple batteries in series to get a higher, but even more variable, voltage ? And then use a voltage regulator ?

Also how are you going to recharge whatever batteries you get ? (I assume recharging) How long must the system run before battery swapping or recharging ? Can it be down while recharging or do you need a spare set of batteries ?

What you’re missing is a design. You need that before ordering parts or you’ll be reordering more parts shortly.

Hi, I checked SparkFun Store and selected some basic elements in this project.

[Module 1]

Arduino UNO R3 7-12V https://www.sparkfun.com/products/11021

PIR sensor 5-12V https://www.sparkfun.com/products/8630

Transmitter 315MHz 5V https://www.sparkfun.com/products/10535

[Module 2]

Arduino Pro Mini 5-12V https://www.sparkfun.com/products/11113

Receiver 315MHz 5V https://www.sparkfun.com/products/10533

Mini Servo motor 4.8-6V

How do you think? are they suitable for my purpose?

The most I care about is the Arduino Pro Mini in module 2, whether it can process the received RF signal and drive the servo.

Also, what kind of battery should I buy? I need the battery to run for 10 hours/day as we only use this device in day time. so that we can recharge the battery during night hours.

bomiao.li:
How do you think? are they suitable for my purpose?

The most I care about is the Arduino Pro Mini in module 2, whether it can process the received RF signal and drive the servo.

Also, what kind of battery should I buy? I need the battery to run for 10 hours/day as we only use this device in day time. so that we can recharge the battery during night hours.

For Module 1:

The datasheet (you need to become familiar with them all) for the AM transmitter actually says it will accept 3 - 12v for a power supply and draws 8 mA (left unstated is whether this rises when transmitting). So it may be that a 2 cell (in series) LiPo may be a good power source w/o any other components. Are you planning to take out batteries to recharge them or recharge them in place ? How sure are you that 315 MHz is OK to use in your area ? That you won’t interfere w/anyone else or they w/you ? What’s the purpose of the Uno ? Might a simpler, smaller, less $$ Trinket from Adafruit (link in my post above) do just as well ?

For Module 2:

The Arduino Pro Mini might be overkill (vs a Trinket) but otherwise seems OK. How are you going to program it ? That boards doesn’t have a USB connection. You need a USB-TTL Serial converter to go btw it and the PC. The same 2s LiPo should work here as the Arduino’s 5v regulator should reduce the 6+ v down to 5v for the Arduino and receiver to use. The regulator may not have enough capacity to also drive a servo, but if it’s just a “weak” servo … you may be lucky. If not you’ll need another regulator for the servo. Just how much torque must the servo exert to push the lever ?

If each module uses (swag) 50 mA then 10 hours means a 500 mah battery. Get 2x that. That is a ‘7.4v’, 1000 mA LiPo for each module. Read all you can about LiPo’s. They can burn-up, catch fire when mistreated.

https://www.sparkfun.com/tutorials/241

https://www.sparkfun.com/products/11855 ???

Note: Care should be taken not to short circuit or overtax these batteries because they don’t have any built-in protection circuit.

Place RF modules as far as possible from servo motor, as DC motor can generate a full spectrum interference especially at high load ( current ).

The receiver part you mentioned is a super-regenerative module, while using superhet ones will achieve better performance.

Some links that might help.

http://www.kerrywong.com/2012/01/26/a-s … reduction/

http://blog.solidremote.com/post/tackle … otors.aspx

http://www.practicalmachinist.com/vb/tr … em-174179/

The transmitter module is without encoder, I would suggest you choose module with hardware encoder equipped ( the most popular is 2262 etc ), and just write corresponding decoder program to communicate.