How to use multiple IR avoidence sensors?

sghioto

Joined Dec 31, 2017
8,688
Correct, which is what I was referring to in my last sentence.
He could also use the Arduino and eliminate the diodes as well.
 

dendad

Joined Feb 20, 2016
4,641
An Arduino would be a fine addition as then extra functions could be added easily, like an alarm if the doors are left open, and a light timeout timer.....
It could be a good learning project.
 

wraujr

Joined Jun 28, 2022
260
Although a little bit of overkill for the TS who is looking to simply wire together some modules...
No code just screwdriver and wire cutters.
 

MisterBill2

Joined Jan 23, 2018
27,759
Do we have any information available about the output of that IR sense module? Something does not seem to be right with the problem as stated, A correct diode isolation should have worked correctly. So someplace something is not as stated. An error, in other words.
 

sghioto

Joined Dec 31, 2017
8,688
Do we have any information available about the output of that IR sense module?
That was stated back in post #33. Output is Low when the doors are closed. Problem is the relay module requires a Low input to actuate. Using diodes in this situation will not isolate the sensors.
If the TS wants to use the modules listed then an inverter ( npn transistor ), 3 diodes and possibly a resistor will be required.
 

MisterBill2

Joined Jan 23, 2018
27,759
That was stated back in post #33. Output is Low when the doors are closed. Problem is the relay module requires a Low input to actuate. Using diodes in this situation will not isolate the sensors.
If the TS wants to use the modules listed then an inverter ( npn transistor ), 3 diodes and possibly a resistor will be required.
That is not nearly enough information. Is the output sinking or sourcing, what voltage? What current capability?? High and low are only a small part of the description. With a complete description both the problem and the best solution should be clear, at least to some.
 

sghioto

Joined Dec 31, 2017
8,688
The sensor module uses a LM393 comparator and does not have the current to sink or source in order to activate a relay directly hence the need for the relay module.
 

MisterBill2

Joined Jan 23, 2018
27,759
The sensor module uses a LM393 comparator and does not have the current to sink or source in order to activate a relay directly hence the need for the relay module.
OK, the LM393 comparator is an open collector device, meaning it has an external resistor pull up. So it is possible,even likely, that any one output transistor is not able to pull down against three pull up resistors in parallel.
That would have been verified if the measurements I asked for had been provided. So it will work to provide a buffer for each sensor. Use a CD4049 for inverting or a CD4050 for non-inverting. And then diode or gate to drive the relay.
 

MisterBill2

Joined Jan 23, 2018
27,759
It would need to have three transistors because the diode OR function can not be used directly at the outputs because it does not avoid the problem described in the #48 post. Each output needs to be buffered separately, so that there is not the problem caused by three pull-up resistors against one transistor. THAT seems too be why one works but three connected does not work..
That is why I asked for more measurements instead of just guessing that "High" and "Low" were exactly what they should have been. And the IC device that I suggested draws much less input current than the transistor circuit suggested
 

Thread Starter

Fixx

Joined May 9, 2023
19
It would need to have three transistors because the diode OR function can not be used directly at the outputs because it does not avoid the problem described in the #48 post. Each output needs to be buffered separately, so that there is not the problem caused by three pull-up resistors against one transistor. THAT seems too be why one works but three connected does not work..
That is why I asked for more measurements instead of just guessing that "High" and "Low" were exactly what they should have been. And the IC device that I suggested draws much less input current than the transistor circuit suggested
I will place the setup on a breadboard and take the measurements, hopefully today.
 

Thread Starter

Fixx

Joined May 9, 2023
19
I make the circuit and take measurements:

Power supply: 5.11V

With one sensor and relay:

Sensor VCC: 5.11V
Sensor out(no obstruction): 5.11V (LED off)
Sensor out(with obstruction): 0.11V (LED on)
Relay activated when IN LOW
Relay ON IN connector: 0.25V
Relay OFF IN connector: 5V

With two sensor and relay:
When Both sensor's LED off, relay is OFF, 5V
When both sensor's LED on, relay is ON, 0.12V
When any sensor's LED on, relay is ON, 0.22V

With two sensor, relay and diodes:
When Both sensor's LED off, relay is OFF, 4.70V
When both sensor's LED on, relay is ON, 0.80V
When any sensor's LED on, relay is ON, 0.88V

Relay is always OFF when reverse the diodes. When I short sensor's GND and OUT, it's LED lights up.

I can't see how a HIGH active relay solve this issue?
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,237
I make the circuit and take measurements:

Power supply: 5.11V

With one sensor and relay:

Sensor VCC: 5.11V
Sensor out(no obstruction): 5.11V (LED off)
Sensor out(with obstruction): 0.11V (LED on)
Relay activated when IN LOW
Relay ON IN connector: 0.25V
Relay OFF IN connector: 5V

With two sensor and relay:
When Both sensor's LED off, relay is OFF, 5V
When both sensor's LED on, relay is ON, 0.12V
When any sensor's LED on, relay is ON, 0.22V

With two sensor, relay and diodes:
When Both sensor's LED off, relay is OFF, 4.70V
When both sensor's LED on, relay is ON, 0.80V
When any sensor's LED on, relay is ON, 0.88V

Relay is always OFF when reverse the diodes. When I short sensor's GND and OUT, it's LED lights up.

I can't see how a HIGH active relay solve this issue?
Your sensors are 5.11V when a door is open (HIGH). You want the light to turn on when a door is open; hence you need a HIGH active relay.

In order to turn the light on when ANY door is open, you need a HIGH output when Door 1 OR Door 2 OR Door 3 OR ANY door is open. This is an OR function and can easily be done with diodes with the cathode on the light (or load) side. But the circuit that turns on the light must respond to a HIGH signal. There are two ways to accomplish this.
  1. Use an active HIGH relay or relay module
  2. Use an inverter with an active LOW relay module. This can be simple as an NPN BJT or N-channel MOSFET, perhaps with a reverse biased diode across the relay coil terminals and maybe a resistor or two
With an active LOW relay module, if you open any one door, the other sensors are outputting a HIGH signal, and either of the others will illuminate the lights (in an OR configuration).

Both methods have been suggested several times.
 

Tonyr1084

Joined Sep 24, 2015
9,744
Open collector? That means it would provide ground for the relay. From the drawing if I recall correctly you either see a "Low" or "Open". With the diodes and swapping the power connections to the relay it should work.

Here's what stumps me - the system works with a single sensor. But when multiple sensors are incorporated it doesn't. Have to wonder if there's a wiring error between the single setup and the multiple setup. If you use a pull-up resistor for each sensor then all three doors will have to be open for a true output to occur. Otherwise two doors closed will hold the relay at ground and prevent it from activating. I think the sensors are in combat mode. Each preventing the other from working unless all three sensors are in agreement.
 

Thread Starter

Fixx

Joined May 9, 2023
19
When one sensor's LED on, relay is ON, 0.88V

When I open only one door(one sensor OFF two sensors ON) how can a active HIGH relay trigger via 0.88V?
 

Tonyr1084

Joined Sep 24, 2015
9,744
Here's what I'm trying to say: (assuming a 5V relay). With open collectors you can use a higher voltage relay. But that comes with higher current and the PIR's might not be able to sink that much current to ground.
1683997073397.png

There's an easy alternative:
1683997103610.png
No sensors, no diodes, no relays. Just three parallel Momentary Open switches, 24VDC and the LED (assuming you've already dealt with current limiting for your LED's). All three doors closed then all three switches are depressed (open) and no light. Open any door or doors and the LED comes on.

Again, for those who read pictures better than words - I did not include a current limiting resistor because we know nothing of how the LED is built.
 
Last edited:
Top