Go Down

Topic: Is it possible to connect several PIR output to one data input? (Read 544 times) previous topic - next topic

Jenergy

Hello I am new to Arduino.

I want to connect maybe 8 PIR motion sensors to one data input, is it possible? The PIR motion sensors will have their own 5V source.

The reason is that I want every spotlight outside my house to lit as soon as any of the PIR triggers, but I do not want to use many data ports because I want to use them to other things.

I attach picture of schematics with only 2 PIR connected.

Coding Badly


All the PIRs I have are open collector so, yes, it is possible to have a shared signal.


Jenergy

Ok, thank you. I suspected it but I wanted to be sure  :)

septillion

The PIR's I have are certainly not... So that would create a dead short... You could use diodes and a pull resistor though. Depending on active low or active high a pull up or pull down resistor.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Wawa

The PIR sensors in the Fritzing picture have a ~1k5 resistor in series with a digital 3.3volt output.
You can connect them safely in parallel, but you won't have enough voltage that way to drive an Arduino pin.
Same with a diode "OR". The diode drops to much, so the Arduino pin won't recognise <3volt as a HIGH.

Can't you use one digital input pin per PIR.
It's easy to combine them in software.

if (pir1 || pir2 || pir3 || pir4 ........) { // if one of the PIR sensors fires
  // do something
}

If you run out of digital pins, use the analogue pins as digital pins.
Leo..
 

Jenergy

All the PIRs I have are open collector so, yes, it is possible to have a shared signal.
The PIR's I have are certainly not... So that would create a dead short... You could use diodes and a pull resistor though. Depending on active low or active high a pull up or pull down resistor.
I do not know if I have open collectors in my PIR's, but when I connect as the schematics in the first post (I forgot the ground to the Arduino board in the picture), then it seems to short, not dead short, but half of the voltage. The output becomes 1,5V instead of 3,3V, and so I guess this is also what Wawa talks about.

I am not sure how you mean with "diodes and a pull resistor", but I connected as the schematics I attached in this post, with two 1N4148 and one 1Mohm resistor. And it seems to work now with two PIR's.

Do you think I could do the same with all the other PIR's, eight in total, just add one diode for each PIR?
Is it possible to connect an endless array of PIR's with this layout as long as the power source manage it?

Jenergy

The PIR sensors in the Fritzing picture have a ~1k5 resistor in series with a digital 3.3volt output.
You can connect them safely in parallel, but you won't have enough voltage that way to drive an Arduino pin.
Yes, it seems to drop to 50% voltage with two PIR's connected together, is that as expected?

Same with a diode "OR". The diode drops to much, so the Arduino pin won't recognise <3volt as a HIGH.
But it seems to work with two PIR's with one 1N4148 diode in each output and one 1Mohm connected from output to ground. See the schematics in my previous post.

I will soon test with more PIR's

Can't you use one digital input pin per PIR.
It's easy to combine them in software.

if (pir1 || pir2 || pir3 || pir4 ........) { // if one of the PIR sensors fires
  // do something
}

If you run out of digital pins, use the analogue pins as digital pins.
Leo..
 
Yes, I understand, but it would be easier to connect all to just one pin, and I would have other pins available for whatever I want.

Coding Badly

Yes, it seems to drop to 50% voltage with two PIR's connected together, is that as expected?
The PIRs you have do NOT have an open-collector output.  The voltage drop is because of excessive current flow.  This is a good time to stop running that test or something will be damaged.

Someone else (e.g. @septillion or @Wawa) will have to help with a hardware solution (likes diodes and resistors).  That is above my pay grade.


Wawa

You only get about 2.75volt on the Arduino pin with an "OR" made with diodes and a resistor.
That is out of specs for the pin on a 5volt Arduino. One day it might work, another day not.

A solution is to connect your diode "OR" to the base of a small NPN transistor.
Emitter to ground, and the collector to the input pin with the internal pull up resistor enabled in pinMode.
pinMode(pirPin, INPUT_PULLUP);
Reversed logic now (HIGH when nothing detected and LOW when a PIR is triggered).
This way the pin gets a properly defined HIGH or LOW.
Lower the resistor to 100k or so for better noise imunity.
Leo..

Jenergy

The PIRs you have do NOT have an open-collector output.  The voltage drop is because of excessive current flow.  This is a good time to stop running that test or something will be damaged.

Someone else (e.g. @septillion or @Wawa) will have to help with a hardware solution (likes diodes and resistors).  That is above my pay grade.
Ok, yes, I just tested a short time, and nothing seems to be damaged as I can see :)

Jenergy

You only get about 2.75volt on the Arduino pin with an "OR" made with diodes and a resistor.
That is out of specs for the pin on a 5volt Arduino. One day it might work, another day not.

A solution is to connect your diode "OR" to the base of a small NPN transistor.
Emitter to ground, and the collector to the input pin with the internal pull up resistor enabled in pinMode.
pinMode(pirPin, INPUT_PULLUP);
Reversed logic now (HIGH when nothing detected and LOW when a PIR is triggered).
This way the pin gets a properly defined HIGH or LOW.
Lower the resistor to 100k or so for better noise imunity.
Leo..
Yes, I guess you are right, I have now 2.93V when the LED turns on, so this day 2.93volt works :)
And when the LED is not turned on, there is 0.14V in the output, which I guess is not good.

As you said it should be about 3.3V output, and are you sure I have to use transistors?

Ok, no problem for me, transistors are not so expensive either, but could you give me a schematics of what you write and what you mean? I am not so good with English (I am Swedish).

I think I understand what you mean, but it would be great if you could draw a schematics. Or if I draw a schematics of what I think you mean, and you can say yes or no :)



Wawa

Drawing is a great way of learning.
Post it, and we see if you have done it right.

You only need ONE transistor. A BC547 will do, but there are 1000+ others that also will work.
Collector to Arduino pin, emitter to ground, base to the diodes.
Leo..

Jenergy

Drawing is a great way of learning.
Post it, and we see if you have done it right.

You only need ONE transistor. A BC547 will do, but there are 1000+ others that also will work.
Collector to Arduino pin, emitter to ground, base to the diodes.
Leo..

Aha, only one transistor, and diodes to every PIR, ok, I thought there would be 8 transistors for 8 PIR's, ok then it should be a piece of cake :)

I will do a schematics tomorrow and see what you think.

Wawa

Eight transistors and nothing else is also possible.

Connect all emitters to ground.
Connect all collectors to the Arduino pin.
Connect the individual bases to the eight PIR sensors.
Leo..


Jenergy

Eight transistors and nothing else is also possible.

Connect all emitters to ground.
Connect all collectors to the Arduino pin.
Connect the individual bases to the eight PIR sensors.
Leo..


Ok, what about the 100k resistor if I use 8 transistors? I am looking for the easiest, most cost effective to connect 8 PIR's to one pin.

I have a lot of 1N4148, but also a lot of transistors.
 

Go Up