Tuesday, August 20, 2013

Arduino: Motion sensor, making it work

I had some problems getting this PIR motion sensor, which I'm pretty sure is the same as this working well, connected to either an Arduino Duemillanove or a Teensy 2.0 micro. It seemed to trigger randomly or not at all. Based on a clue from the Sparkfun comments on the item: provide the sensor with it's own or extra power as the micro board might not be providing enough volts to drive it properly.

This approach seems to provide the answer: power the PIR sensor with the positive side of a 9v battery, (disconnecting it from the micro board's power), whilst leaving the rest of the circuit (like this) in place.

In hindsight, I'm assuming the problem I had stemmed from the Arduino itself using up all the juice available from the USB connection to the computer. Powering the board from a DC adapter with current to spare would help too.

With a movement/presence detector like this, adding a big LED or a buzzer to your circuit and sketch, indicating when the sensor detects movement will help a lot when testing.


dual-powered: the PIR sensor connected to a Teensy. 9V battery for the sensor, an old phone charger provides +5v via the Teensy's mini USB connector.

No comments: