How to connect a curtain PIR with arduino board

Hi all!

I’m looking for how to connect my curtain PIR (http://www.securame.com/detector-pir-infrarrojo-hm802c-cortina-p-1125.html) with arduino, the sensor has a relay output that should be connected with my arduino board.

But the main question is how should I do this? Which connections should I do? Should I use analog or digital ports?

I attached the images that shown the relay output of PIR sensor and the adapter with a relay output too.

Thanks so much for help guys!

Connect to a digital Pin with internal pullup, and to a Gnd pin. When the relay closes (or, opens), the pin will go LOW and HIGH. Put a meter on the output pins and figure out which pair is the relay contacts. Or, read the manual.

What do you mean exactly with “internal pullup”?

The PIR sensor has 6 outputs; two for the alimentation (+12V and GND), two for the alarm and the others two for the tamper. I found this information (image attached), but there is no more info on the manual.

So, which of these ports should I connect to the digital pin on the arduino board?

I only have clear how to connect the alimentation (+12V and GND ports) because I have the adapter to current.

Thanks so much!

1.png

Connect the left Alarm pin to Arduino Gnd pin. Connect the right Alarm pin to Arduino pin 2 for example:

byte alarmPin = 2;

void setup(){
pinMode (alarmPin, INPUT_PULLUP);
Serial.begin(9600);
}

void loop(){
if (digitalRead(alarmPin) == LOW){
Serial.println("no alarm"); // these may need to swapped
}
else {
Serial.println("ALARM!"); // these may need to be swapped
}
delay(200); // check 5 times a second
}

That works!

But, I noticed that after any detection, the relay is closed for 3 seconds more or less (screenshot attached), is it possible avoiding this delay? Because I would like to detect faster without this time of delay because the relay is closed.

I think that it’s possible to do putting the alarmPin to HIGH, after the first detection. Maybe with the digitalWrite?

Don’t worry if you don’t have the solution, you helped me so much. I’ll keep investigating and if I find the solution, I’ll share it for all of you.

Thanks!

Bob1: But, I noticed that after any detection, the relay is closed for 3 seconds more or less (screenshot attached), is it possible avoiding this delay? Because I would like to detect faster without this time of delay because the relay is closed.

The problem with the 3 second delay is due to the PIR sensor. All the Arduino sketch is doing is reporting when the relay contacts are open/closed. To reduce the time the relay contacts are closed for during a detections would need doing in the PIR module (If it is at all possible to adjust).

EDIT: Looking at the image you supplied of the PIR internals and it looks like you can only adjust the relay delay time between 3 or 30 seconds.

Damn... you are right! It's not possible to avoid this delay with this PIR.

Do you know which curtain PIR should I bought? I would like have a system that it can make detections very fast with IR technology. So, I need a low delay.

Thanks! :)

Bob1: Do you know which curtain PIR should I bought? I would like have a system that it can make detections very fast with IR technology. So, I need a low delay.

To have a chance of giving a good answer we need to know... what your trying to detect how fast it moves over what area of detection what budget?

Bob1:
Damn… you are right! It’s not possible to avoid this delay with this PIR.

Do you know which curtain PIR should I bought? I would like have a system that it can make detections very fast with IR technology. So, I need a low delay.

Thanks! :slight_smile:

re-phrasaed :
it is not possible to avoid ‘by using the circuitry provided on the PIR circuit board’
the black device next to the screw terminals is the relay.
that gets a signal to open and close from a transistor.
that transistor is signaled from the comparator if this is all hard wired. I did not see a blob to indicate there is a micro on-board.
using my crystal ball, the transistor is being feed with signal that charged a cap. once that cap is charged, it holds the transistor high and as the cap discharges, the voltage will drop and the relay will change state.
there are a lot of ways to do this. could be a 555 chip that times out for 3 seconds after the last reading from the actual sensor.
if you can post some photos of the board that are focused, we may be able to show you how to alter the circuit board to make it work faster.
also, there are 3 jumpers. notes look like you can choose 3 seconds or 30 seconds. if that is the case, you should be able t figure how what that jumper does and alter that circuit for your needs.

dave-in-nj: I did not see a blob to indicate there is a micro on-board.

I think the 14 pin chip is an MCU. One leg of all the configuration jumpers come back to this chip and looking at where power/gnd connect it could be a PIC16F688 or an ATtiny84.

I think the 8 pin chip is the comparator and the 14 pin is a timer. you could be right. of the 4 jumpers, one offers what appears to be a single pulse or a double pulse. one is 3 seconds, 30 seconds (probably in hardware such as a micro or a timer) relay NO or NC. (love that option) not sure what it inverts. but leans more towards a micro.

focused photos will help us know.

that means that the raw signal may be the only way to get the instant on/off

Excuse me, I did not explained the scenario.

I would like counting people that cross my entrance, something like this (http://www.blueeyevideo.com/img/door-counting.png), I believe that’s easy to do with Arduino if we have the correct PIR sensor.

I just need a curtain PIR with a small angle of detection (for distinguish if there is only one person crossing the entrance or maybe two persons enter, one behind the second) we got detect this with a small angle on PIR, no problem :slight_smile: And if the curtain PIR has a relay output we can connect it with arduino.

But, I didn’t expect the big processing delay of these PIR sensors. Now, the small angle is useless because we can’t distinguish the samples, because we are waiting 3 seconds until the relay is closed. So, I cannot distinguish if there is one entry or two.

I attached a new photo of sensor that I bought.

Do you know any curtain PIR which could be useful for this scenario? Or can I use this one? Because, I think we need samples in 500 ms or less, so the velocity of processing should be faster.

I’m motivated to do this project with arduino.

Thanks!

need a photo that is in focus and shows the part numbers on the chips

How will you know only one person is crossing beam at time of detection and how do you know if they are entering/leaving?

If you cannot get a good photo then maybe write out the numbers on the chips. The one near the sensor looks to start with UTC but write out all the lines. The other (14 pin chip) does not look to have a part number or it's poorly etched and the camera cannot pick it up.

what happens when you remove the jumper for the 3/30 second delay ?

I’m guessing the 8 pin is a comparator.

LM393 ???

or LM350 VR ?

dave-in-nj:
need a photo that is in focus and shows the part numbers on the chips

Here is the photo with the numbers of all chips

Riva:
How will you know only one person is crossing beam at time of detection and how do you know if they are entering/leaving?

If you cannot get a good photo then maybe write out the numbers on the chips. The one near the sensor looks to start with UTC but write out all the lines. The other (14 pin chip) does not look to have a part number or it’s poorly etched and the camera cannot pick it up.

I believe I can detect the direction of people if I install two lines of these PIR sensors, should work. What do you think?

Or maybe with this lateral instalation http://www.visit.fi/sites/default/files/pictures/products/visit-counter-photocell-fiilis-l.jpg, in any case, we need a fast processing on the curtain PIR, enough to detect two persons crossing one behind the other.

dave-in-nj: what happens when you remove the jumper for the 3/30 second delay ?

I tried to do it and the result was the 3 seconds of delay (the minimum)

I believe that the PIR will react at the speed you want.

it appears that the board circuitry controls the on/off time. and is not what you want. for you to get that the on-board control, you will need to poke around a bit more. the photos are not very clear and not well lit.

if the LM358 is being used to send the signal out, you might be able to tie into that output. trace out the output traces to see where they go.

also, check the traces from the relay/transistor to see where that signal comes from. ditto the pins from the jumpers.

looks like you might be able to use the raw sensor and may be able to alter the circuit board to get what you need. I Would also monitor voltages from the bits to see what is going on as regards timing.