Is it possible to connect several PIR output to one data input?

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.

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

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

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.

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..

[quote author=Coding Badly date=1493061435 link=msg=3234185]
All the PIRs I have are open collector so, yes, it is possible to have a shared signal.[/quote]

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.

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?

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.

Yes, it seems to drop to 50% voltage with two PIR's connected together, is that as expected?

Wawa:
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

Wawa:
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.

Jenergy:
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.

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..

[quote author=Coding Badly date=1495137322 link=msg=3266479]
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.[/quote]

Ok, yes, I just tested a short time, and nothing seems to be damaged as I can see :slight_smile:

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..

Yes, I guess you are right, I have now 2.93V when the LED turns on, so this day 2.93volt works :slight_smile:
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 :slight_smile:

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..

1 Like

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..

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 :slight_smile:

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

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..

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..

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.

Eight NPN transistors would be the best solution.
NO extra parts needed.

To explain further, the bases are held low via the internal ~1k5 resistor of the PIR (when inactive).
No external resistors needed.
Leo..

Wawa:
Eight NPN transistors would be the best solution.
NO extra parts needed.

To explain further, the bases are held low via the internal ~1k5 resistor of the PIR (when inactive).
No external resistors needed.
Leo..

Ok, that sounds good, thank you. I will try that later and report if it works.

Please let us know if you managed to get it working. And how.

Thanks

1 Like