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

Automation, sensing and robotics • Re: Wiring multiple photoelectric sensors to RPI 4

$
0
0
Thanks for that suggestion! I did so and it looks like my sensors were broken (they were being run at 48V for a short time before and I think the resistor inside them doesn't work anymore). I replaced them with new ones.

Now my issue is that when I read the sensor output with a multimeter, I get 4.6V for a hit, and 5V for a no hit with the 4k7 pull-up resistor attached. I get 0V for a no hit, and 4.66V for a hit without a resistor attached. You mentioned that going above 5V will damage the pins - do I need to get a level shifter? Or was the pull-up resistor supposed to take care of that?
STOP!

Don't connect 5V to a Pi GPIO pin.

You should connect the pullup between the GPIO input pin (where the sensor output connects) and the 3.3V rail of the Pi.

The sensor output is open collector. It can pull the voltage down when active. When not on the pullup pulls the input voltage up to 3/3V. Neve higher than that.
Note that the pullup is not between the sensor output and GPIO input.

Here's a generic circuit. The transistor with terminals marked B,C,E is the output inside your sensor. C is the output wire that connects to the GPIO input.
E connects to the GND line. B is only inside the sensor.
Vcc, that the pullup resistor connects to, will be the 3.3V line on the Pi.
You may have a different voltage supply to the sensor. Don't connect anything else to that. In particular, if the sensor is powered from 5V, or higher, don't connect the pull-uo to that.


Image

Statistics: Posted by PiGraham — Thu Mar 14, 2024 3:36 pm



Viewing all articles
Browse latest Browse all 5375

Trending Articles