Arduino with motion sensor

Overview

In this post I will share my findings with cheap PIR motion sensors. I ended up using more expensive motion sensors that you use with a security alarm. If you are only interested in connection the security motion sensor to the Arduino, you can skip down to “Using house alarm motion sensor“.

Initial approach with cheap PIR sensor

I have recently started a home automation project for myself that measure temperatures, humidity etc. I also wanted to monitor for motion and bought 2 of these cheap PIR motion sensors you can find on many local auction and tech shops online. Connecting them to the arduino was simple enough: you only need to connect 5v and ground, along with an extra pin that the arduino can monitor for motion based on a HIGH or LOW value. Initial tests inside my room worked fine, I had very little false positives, and the sensitivity was exceptable for me.

Taking it to the garage

After some wireless sensor network setup, I got the node as part of a network of nodes and it was ready to take to the garage where I wanted the motion sensor. Once in the garage, I had A LOT of false positives, it would trigger every few seconds throughout the day. Some googling suggested that there might be RF interference with PIR, so I moved the sensor further away from the RF24 module. But still, a lot of triggers for no apparent reason. It’s like the PIR is seeing ghosts! It could just be that I had a really bad set of sensors. Maybe some cheap Chinese clone? I only paid R40 for them, so they can’t be the best thing ever…?

More research

Doing some more googling, I found that there are different types of motion sensors. Some only use PIR which is really cheap. It uses heat radiation from objects to detect movement. Because of this, changes in air temperature moving in front of the sensor could cause a trigger. Because air moves past the sides of my garage door, I suspect that might be my problem. Also the wind slightly moves my garage door when the wind blows, causing more or less sun to shine in.

More expensive motion sensors, use a combination of PIR and Microwave sensor (no not the one in your kitchen). The Microwave sensor is a bit more expensive, and uses a more power. The microwave (to explain it simple) is like a radar which detects when something is passing through the radar microwave. This is what you would typically find in a security alarm for your house. The PIR can be used for the initial detection, which might have some false detect. When the PIR does detect something, the Microwave sensor can kick in. If both of them detect motion, only then does the alarm trigger. This combination reduces the amount of false positives while still staying energy efficient.

Using house alarm motion sensor

After browsing around online and asking some friends, I finally go 2 sensor from a friend who has his house alarm updated. I wanted to try these out instead of my cheap PIR sensors I bought online. My first concern was, these sensors run on 12Volt… Is it save to plugin the trigger pins to my arduino? Is it going to send 12v to my arduino’s input pin and burst into flames like a Ford Kuga? Using a multimeter I tested the pins, for its relation ship between the power source, and the trigger pins. I didn’t find any connection between the power and the output pins. (Please check your own sensor before connecting wires to your precious arduino!)

The trigger pin is by default shorted (normally closed). As soon as movement is detected, the trigger circuit it open. This serves as a double alarm! If there is motion detected, the controller board (in your case a arduino) can detect the open circuit. Also when someone cuts the cable to the sensor, the circuit will be open triggering the alarm.

Wiring it all up

Requirements

  • 12V power for the sensor
  • 10K Ohm resistor
  • Wires between your arduino and the motion sensor

Connections

  • 12V to the power input of the sensor
  • Data pin to 5V via 10K resistor (to pull it high when circuit is open)
  • Sensor Trigger pin 1 to ground of arduino
  • Sensor Trigger pin 2 to the digital pin (which is also connection to the resistor)

Leave a Reply

Your email address will not be published. Required fields are marked *