ArduinoGeneral

PIR Motion Sensor

userHead jalhey 2015-12-28 07:34:05 3201 Views3 Replies
Hi,
I'm new to the arduino world, and I thought that a small and simple project would be a good startup for me.
So I bought a PIR Motion Sensor and a Wave shield from Adafruit and started playing to make a sound machine that would play a random file when there is movement.

The audio is working fine, and now I'm having problems with the sensor.
I followed what is written here, except for the pins :
http://www.dfrobot.com/wiki/index.php/P ... KU:SEN0171

I used the pin A0 for signal, +5V, and for the ground I chose the pin next to the 5V, the first following pin. Is that correct?

Using the provided code on the page, I always get "No one!" in the console.
I don't understand why. There is movement in front of the sensor and it doesn't react.

Also, is there a way to adjust the threshold?

Thank you very much
2015-12-29 04:31:45 The only reason why I use analog pin is because I don't have headers left to solder to digital pins. I ordered some...

Also, I get some false positive from time to time, when I unplug the ground, but most of the time it works well
userHeadPic jalhey
2015-12-29 04:13:10 Hi,
Thanks for your answer.

In fact, on this page, it says that all analog pins can work as digital too :
http://forum.arduino.cc/index.php?topic=99378.0

I plugged it to digital 12, changed the code, but the behavior is the same.

One strange thing I noted though, is that if I unplug the ground, the sensor begin to react as it should...
userHeadPic jalhey
2015-12-28 12:13:02 Hello there jalhey, thanks for your post.

The code is designed to use a digital input which has 2 values (0, 1, i.e. off or on) and you are using an analog pin (which has a wide range of values), therefore the microcontroller isn't getting the correct info from the sensor.

Try using digital pin 2 (or another digital pin) for the signal from the sensor to your microcontroller. (If you use another pin, make sure it is properly assigned in the code).

FYI the connections for the sample code should be:
S - D2 (or another digital pin if you choose - change code if so!)
Vcc - +5v
GND - GND

Give this a try and if you have any other problems come back and we'll try and help.

Good luck!
userHeadPic Maht