Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5107

General discussion • Re: Wiring multiple photoelectric sensors to RPI 4

$
0
0
When I wire 1 sensor (+V to an external power source, -V to an external power source, Light ON to GPIO, Dark ON to GPIO) it works perfectly fine and I can read the output (I am only using the Light ON, so I technically don't need the Dark ON. But I've noticed I only get outputs with both plugged in...? Leaving only one connected to the RPI gives me no signal). However, when I wire both sensors up in the same manner (2 outputs to RPI), I don't detect any output from either sensor. Does anyone have a suggestion or know how I should be wiring up the sensors to the RPIs? Do I need to somehow connect the dark ON wires together?

Here is a link to the photoelectric sensor I'm using. The electrical schematic is on page 10 in the top right corner: https://www.onlinecomponents.com/en/dat ... -49373297/

Thanks! Any advice would be greatly appreciated.
I've attached a picture as requested!

Here is my code. I don't think it's the problem since when I only use 1 sensor at a time, it works great.
Image
I don't see any common ground connection on the diagrams. That combined with needing both ON and OFF signals connected to get a readable signal from one sensor suggests that is the problem. The Pi GPIO input reads the sensor signal as a voltage relative to the GND wire. If you haven' connected that between sensor of Pi GPIO the input doesn't see a voltage. connecting both sensor outputs could be enough to reference the inputs through internal pullups to affect the other input to the point that it reads the state, This is not a good situation and you can't rely on it.

Try connecting 0V sensor wire to Pi GND on the GPIO header (one of those black circled pins on the diagram.

Statistics: Posted by PiGraham — Wed Mar 06, 2024 9:06 am



Viewing all articles
Browse latest Browse all 5107

Trending Articles