0

This question already has an answer here:

I have a device that is running on a Pi Zero W. I have another device that outputs 3.5 volts from a pin and I would like to use the Pi to detect if the devices is on or off.

Is there a way to send that voltage to the pi so that it could be read like a switch from the GPIO? So that if the voltage is applied, it reads 1 and when no voltage is applied it reads 0?

marked as duplicate by Milliways, Ghanima Jun 4 '18 at 23:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

That is a 5v logic level one. Anything above 3.3v above the official limit for a Raspberry Pi GPIO pin.

You could use a resister bridge to lower the power, but it would be better to use a voltage level shifter which is designed for this.

You could use a normal level shifter like the 74LVC245 which will shift 5V signals down to 3v signals.

You could use a bi-directional level shifter like the TXB9194 where the signals can travel both ways. This shifter is suitable for I2C.

0

Connect the 3V5 device output to a Pi GPIO. Also connect a ground from the device to a Pi ground.

An optional safety extra is to add a series resistor between the device and the GPIO, say something between 1 to 10k ohm.

Set the selected GPIO to be an input. I would also enable the internal pull-down on the GPIO.

It will read 1 when the device output is 3V5 and 0 when the device output is off.

Not the answer you're looking for? Browse other questions tagged or ask your own question.