Panasonic PIR Sensor AM12111 Output problem

hi i'm having trouble interface with this panasonic pir sensor according to the datasheet

Remark: Circuit stability time: 30s max. While the circuitry is stabilizing after the power is turned on, the sensor output is not fixed in the “on” state or “off” state. This is true regardless of whether or not the sensor has detected anything.

this sensor output is 1 1 1 0 0 0 1 1 1 0 0 0 when not detecting anything , but when it detect me , the output is 1 1 1 1 1 1 1 1 1 1 1 my led blinking when it detect nothing , and turn on when detect me

i wonder how to fix it up , i want my led turn off when the sensor detect nothing , and turn on when detect somebody


ps : panasonic datasheet

According to the data sheet, this device has both an analog output and a digital output.

It sounds like you are trying to use the analog output of the PIR, to a digital input of the Arduino.

my panasonic sensor is digital type ,
i wonder how to use it
so confusing >.<
maybe cause i’m totally new in this field…

I had a similar problem with a PIR sensor I bought from rapid.

I decided to plug the signal from the PIR into an analog in pin then using analogRead and Serialprint I had a look at the data from the PIR. I found that when it detected motion the reading would be between 0 and 10 so then set a rule saying if the analog value is less than 10 then do whatever...

I'm new to arduino so this might be a sloppy way to deal with the problem, however it seems to work. If you're still stuck on this I can post some code this weekend, i'm working to a deadline right now so very busy.

What a neat little device! Where did you get it? Cost? Can a hobbyist buy just one or two? I don't want to order 50 from Panasonic!

The good news is: You should be able to hook it up okay to the Arduino. I know you said you have the digital type... I'll come back to that in a moment.

For other readers of the post, who don't want to go off to the datasheet:

This is just the "heart" of a PIR detector, but with some on-board smarts. Connect Vcc (4.5-5.5 suits either digital or analog) and ground. The only other connection is the PIR's output.

In the analog unit, this output comes from an op-amp, and goes directly to anything like the Arduino analog inputs. The voltage varies with how much movement the detector sees.

The output from the digital unit comes from a device I don't know the name for... scr? triac? (There's a note which suggest it may be a comparator.) Anyway... the "suggested circuit" diagram shows that it should not be asked to source or sink more than 100 uA... shouldn't be a problem if the device is connected to an Arduino digital pin, and that pin is set for input... input to the Arduino, output from the PIR. (Yes, I know... some of you understand that, but it is a real pain for new electronics hobbyists, remember?)

So, Lycrois, why isn't it working for you??

If you have a voltmeter, try monitoring the voltage on the output while everything is connected up. It should swing most of the way to zero or most of the way to 5v, depending on whether the PIR is seeing movement. (Put it under a ceramic coffee mug or something when testing for the "no movement" situation.) The voltmeter will TELL you want the Arduino is "seeing", and any bugs in your monitoring code can be worked out after you get the electronics right.

Be sure you've put...


... in your setup function... even though it should be INPUT unless you make it OUTPUT... but be sure you DIDN'T do that!

If the output, while connected to the Arduino, is always around 5v, try connecting a pull down resistor. (More on this in a moment.) If it is always zero volts, try a pull up resistor. (There's a clever way to avail yourself of a pull up resistor inside the Arduino, but that's a luxury for later!)

Pull up/ down resistor.....

Some devices, maybe the PIR is one of them, are good at making one of their outputs "high" or "low", but not good at making them the other state. Such devices need help.

That help comes in the form of a largish resistor... I'd try 10k, other readers may be able to give you more informed guidance on a suitable value... just don't make it too low! I wouldn't go below 1k, and maybe some kind reader will jump in and discuss "too low" further...

ANYWAY... connect the resistor between the data line (the output/input) and either 5v (for a "pull-up" resistor) or zero volts (for a "pull-down" resistor.

Like that, you should see the voltage on the data line go high or low (or is it the other way around?) when the PIR sees/ does not see movement.

Once the voltage is doing what it should, then you can start working on the software in the Arduino to "do things" with the information!!

=== Footnote: If you don't have a voltmeter, the following is so simple that it MAY not have problems to haunt you, mislead you....

Start with an Arduino set up with one LED, one switch. The switch connected to a digital input.

Write a little program to turn the LED on when the switch is closed, off when the switch is open.

Be sure that is working properly.

When it is, change JUST the connection of the switch. Connect the PIR where the switch was previously connected. Just the PIR (it being connected to Vcc and ground, too, of course) and see what you see. If LED always on or always off, try a resistor. You can connect it as a pull-up or a pull-down, and if it doesn't work one way, it might the other... but should not... in the instance we're discussing... do any harm if not too small and connected the "wrong" way at first.

@liveofdave : so i need to connect the PIR digital output to analog input ? i'll try that , and i'll post the result thanks

@tkbyd :

it cost around US$ 3 each here in indonesia , mine is slight motion detection , it has range 2m with 100 degree angel i connect the power supply and connect the output from pir to arduino digital input 4 , i wrote the program , to write text " ON and OFF " everytime this arduino in High or Low states when it detect nothing , it show ON ON ON OFF OFF OFF ON ON ON OFF OFF OFF , sometimes 4 times ON 4 times OFF , but when it detect somebody pass by , it show ON ON ON ON ON ON ON ON ON ON ON maybe because i'm not using resistor ? i have trouble when this sensor detect nothing , how can i make it fix off , according to datasheet it has no fixed state and if i connect this sensor to arduino using 1mm single cable with about 50M lenght , do i need to amplify the signal ? if it need , how to do it ? thanks

I've created a motion sensing system with AMN34112(10m detect, digital out type) once before. NaPiO is extremely useful, reliable and easy to use. As tkbyd said, the NaPiOn's output terminal must be pulled down with a 10k or a 100k resistor.

And the "detected" HIGH signal sustains only about 1000 msec, we should execute analog read or digital read command with a period of about 500 msec.

it cost around US$ 3 each here in indonesia

I'm jealous! It costs around US$ 20 or $ 40 in Japan :'(

From what Takasaki said, and from your...

when it detects nothing , it shows ON ON ON OFF OFF OFF ON ON ON OFF OFF OFF

... I would guess that my guess (!) was right...

The device probably is okay to pull the Arduino input high, but it is not "sinking enough current" (to use the technobabble) when in the low state.

Try the pull down resistor, and all may be well.

If I'm right, it isn't really "showing" the values you see. The highs are false highs which are happening because "the input is floating", i.e. in effect it isn't connected to anything, and the Arduino "gets confused". Again... remember that this is only one POSSIBLE explanation. But whatever is going on, a 10k pull down resistor won't break anything (unless you have that pin configured for output from the Arduino... and even then, you'd probably get away with it.)

@tasasaki what ? US$ 20 for this tiny device ? =.= , that's quite a lot but i don't know cause yours is 10M detection type , mine is Slight Motion Detection Type with digital output - only 2M range @ 0 degree.

@tkbyd & tasasaki : thanks for advice , i'll get slider resistor / potentio trimmer tomorrow , let see how it works ^^

If using a variable resistor to test things out, add, in series with it, at least 1k... preferably 5k, so that the minimum resistance between the output of the sensor and either....

1) the 5v "rail" (wire), or...

2) resistance to ground

... (pull-up or pull-down alternatives) that minimum is always at least 1k.