Multiple PIR sensors on one pin

Please see this topic: Is it possible to connect several PIR output to one data input? - #17 by Jenergy

The topics closed, so I couldn’t comment there but it didn’t seem to get a real resolution detailed that allowed me as a tinkerer to understand what pieces I need and how to connect them exactly. Basically I’m looking to be able to hook up two PIR sensors to one pin as that is all I have available. ALL other pins are in use by other sensors and outputs.

There is a diagram on the other post, and an explanation of what they are saying to use. If someone can link to exact pieces of hardware and a diagram of how to wire it I would be most appreciative.

I have both these PIRs (won’t let me link both because of being a new user)

AEDIKO AM312 Mini Human Sensor... Amazon.com

WMYCONGCONG 10 PCS PIR IR Module...
from Amazon

1 Like

Here is the other sensor:
WMYCONGCONG 10 PCS PIR IR Module... https://www.amazon.com/dp/B01MQQAHTB?ref=ppx_pop_mob_ap_share

Do you understand what PIR means? It means the thing is a RESISTOR. What do you get when you put two resistors in PARALLEL?


https://www.arrow.com/en/research-and-events/articles/understanding-active-and-passive-infrared-sensors

PIR yes passive infrared. I have them both configured to work if they’re both configured to different pins and then combined to a single display of movement in the code. I have an additional component to add yet so can’t use 2 pins for the PIR. I need to save a pin and better understand how to make that work with only one input. Without googling I don’t know what two in parallel do. I know when I hooked them both up my voltage when to 50% as the other post mentioned. I figured I need to block them for so only goes one direction, so I bought some of below, but try as I might experimenting I can’t figure the proper way if they are even the right component for that job.

Cafurty 1N4007 DO-41 Axial... Amazon.com

Suffice it to say I don’t know how to do it but I have an awesome esp32 configured with everything I want, but I want a second PIR on a single pin. I only know enough to be dangerous, so don’t assume I know anything. If someone can interpret what the supposed solution was on the other page that would be helpful or provide an alternative solution. They said using a NPN transistor…bases held low via internal ~1k5 resistor of the PIR when inactive. I may even have done transistors in my kit but these things are confusing as I am trying to learn. So again detailed help is greatly appreciated. Thanks!

I know how to hook up one… I want to hook up two of them with only using one pin. I already have them configured as two PIR‘s with two pins on the Arduino or more accurately the ESP32. In the project I’m making I only have one pin available and need two PIR‘s, hence the question and the problem.

show schematic of your project, we see if it possible to compress other pins.

Is it important to distinguish which sensor is giving a signal?

It is a d1mini esp8266 actually, i mentioned esp32 before, that was mistaken. I don't have pins to rearrange...need to give up the current D0 or D1 PIR sensors so I can combine them into one, i.e. D0, so I can add one more contact sensor on D1 or vice-versa. @kolaha I don't have a diagram and don't know what application your using to make the images of the diagram. Here is my pin layout.

Pins and usage:
D0 - PIR Motion - Internal LED - Can be used Input/Output
D1 - PIR Motion
D2 - Ultrasonic - Echo
D3* - Ultrasonic - Trigger
D4* - Internal LED
D5 - Garage Door Closed contact sensor
D6 - Garage Door Open contact sensor
D7 - Currently Temp/Humidity
D8* - Relay Output - Garage Button
* = Output ONLY

No I have both in code now combining to say motion active when PIR1 = ON or PIR = ON. I want to do that in hardware and not software since as I said I need the pin, so not caring which is signaling to the esp8266. As long as when motion is detected on either PIR or Both PIR at the same time the pin reads it as motion detected.

Right now, with only one device, how do you detect motion? Must be some code somewhere doing it.

I am using HomeAssistant and ESPHome which generates the code. Honestly I don’t think the code really matters right now does it? This is a hardware issue on how to connect the two PIRs and either diodes or transistors or some other hardware so the proper voltage is allowed to the single pin to be read whether one or both of the PIRs have motion triggered. “Proper voltage” being the same voltage high/low a single PIR gives, except with two of them connected to the same port, because I have them working when only one is connected. So it is a hardware question right?

This is probably so very simple but I just don’t know the physical hardware components well enough to understand which ones to use.

No, Not a hardware problem nor a software problem it is a logic problem.

I don’t know what to say to that… did you check out the original thread I linked as it had all the background info that wasn’t to be repeated here.

My code already is built to have two PIR‘s in it and it works correctly. However, I need to remove one of them so that I can turn that into a door contact sensor since as I mentioned I have one other door contact to connect and there are no pins available. Therefore I need to physically unplug one of the PIR sensors and wire the two PIR sensors into one input pin. That is why I’m saying it’s a hardware issue. The same code that reads one PIR should also read two PIRs plugged into the same pin if the proper voltage is being applied for the on and off states.

@Jenergy did you get your 8 PIR sensors working? If so, please elaborate!

@Wawa can you further explain your resolution from a few years ago on the thread in the original post linked above? I want to do similar.

I am saying it is a logic problem because you need some way to tell which PIR is sending the current signal. Right now you have not identified a way to determine that. So, you have a logic conundrum.

You might try this.  I'd prove it thoroughly on the breadboard before getting it near the Arduino.

https://electronics.stackexchange.com/questions/172730/pir-in-parallel

this two can be connect in series. garage door can't be in both position, but by using resistors it is possible to determine which one is actually touched by the door. such method is not usable for PIR output pin.
But if you decide to use IC CD4021( 74HC165) then it is nearly to uncountable amount of digital inputs possible at cost of three pins.

The "two-diode/resistor OR" from post#6 in the first link you gave is not ok with a 3.3volt PIR and a 5volt processor like an Uno, but it should work fine with a 3.3volt processor like the ESP32.
I would use Schottky diodes, like the 1N5819 (the 1N4007 is basically a mains-voltage diode with too high forward voltage), and a 100k resistor.
Leo..

Are you saying 3.3v PIR because of the voltage on the signal leg of the PIR? I ask because the PIR itself I am feeding needs the 5v. I ordered a multipack that contains the 1N5819 you suggest. Hopefully I find the right resistor you're suggesting in my kit. Need to lookup the lines and values to see if I have one. Here is the image from that previous post. I don't think the "1 Mohm" in the diagram is the size you suggested though unless I don't understand some conversion or naming issue. Also the diode image doesn't have the ends to indicate a schottky diode.

@dougp and @ZX80 thanks for the informative links. I have been trying to better understand and wrap my head around all these concepts. I found this video to be very informative for anyone else that comes across this. Diode Logic Gates - OR, NOR, AND, & NAND - YouTube