Passive IR - SE10 sensor Query


I am trying to interface the SE-10 PIR sensor to a simple ATMEGA 328P, and visualise the response (detection)
to a RGB LED. When movement is detected, light up the blue pin of the LED. Otherwise LED is not used.
Simple enough. The sensor is powered from the power supply (9V) and not from the VCC line (5V).

I soldered a 10kohm resistor between the +ve (red wire) and the signal output (black).
So that when the sensor detects motion, the black pin voltage drops to zero (also connected to port C1 of the ATMEGA 328P).
Otherwise, the black wire continues to read 5V. The operation is correct and was verified by a multimeter and Oscilloscope
from the sensor output end.

It is not working from the controller interface end. However, before I delve into anymore detail,
can I read this sensor as a digial input instead? I used analog becuase the examples I found on the web used analog.

According the tutorials and other projects out there on the web, everyone seems to be reading this sensor from an averaged
analogue approach. Take 20 samples, average them and test the output to see if it below 10 say (to pick up any transients from the sensor).
Can anyone explain why this might be the better way to go. And if so, which analog function would you suggest from the AVR library?

Also, if I wanted to initiate an action based on movement being detected, can I enable a global interrupt for port C1? Or is there
another IO pin to use that would be more suitable. The idea was to make my robot reach to human presence.

Any answers would be much appreciated.



A digital input is fine for reading a sensor value that is either 5V or 0V. In fact, that is exactly what it is intended for.

This sounds like a prime candidate for my favorite debugging method - Simplify your System! You have a sensor that supposedly outputs 5V or 0V. So remove the sensor from your circuit and just connect C1 directly to 5V or 0V and see what you measure. If the value is wrong in one case or the other, reduce your program to the simplest possible thing that demonstrates the problem (ideally just five or six lines of code) and post it here, along with a complete description of all of your connections.


Hi Paul,

I finally managed to test the motion sensor.

The “reference link”
did not work, with a much simplified system. I wonder why this website did not recommend a digital interface instead.

Anyway for the digital interface approach it worked right the first time I compiled the code and run it. A simple digital input
code did the trick quite well. It was necessary to add a delay (in the scanning loop) of 800mS as the output tends to flicker at the a certain detection distance where the sensor is near/at hysterisis.

The sensor works well at 7.2V (battery). In my application (indoor) it had sufficient sensitivity to pick up activity within a 3.6 x 3.6m room. Flourescent lights dont seem to affect the sensors performance at all, which is a great. Obviously, it has a better increased detection distance at 12V but using a higher voltage was taxing on 328’s voltage regulator.

Great sensor and I recommend it to anyone. Sensor interfaced to a 328P and 324SVP.

Thx for the advice.
Happy New Yearfor 2011!