I have pi 3 and I want to use one of the pin as an input. It will be connected to tapped off wires from a switch that has 2 volts going through it when it is closed. So I want to feed this 2 volts as an input to the pi gpio pin specifically gpio pin 2. Can this be done without pi sending its own voltage interrupting the tapped off button function. If gpio pin 2 is bad to be using for this purpose, can suggest another gpio pin that I can use as an input.
-
Voltages do NOT go "through" switches or pins. A potential may be present and current will flow. GPIO detect voltages; generally LOW if <0.8V, HIGH if >2.2V.– MilliwaysSep 2 at 22:33
-
You need to explain (preferably with a schematic) what is connected.– MilliwaysSep 2 at 22:36
2 Answers
GPIO 2 and GPIO 3 have pull-ups to 3V3 fitted. Probably best to choose any other spare GPIO.
The Pi will probably see 2V as high. You will have to confirm by experiment. Note that you must also connect the external ground of the switch to a Pi ground.
In addition to the other answer & comments, I wanted to remind you that GPIO pins do not accommodate analog signals. IOW, they will only reliably interpret logic HIGH (3.3V), and logic LOW (0.0V) as inputs. You may get a high or a low with 2V, but it's probably not something you want to rely upon.
If you are trying to sense the state of a switch, suggest you use a pullup resistor to 3.3V, the other side connected to the switch, and the other side of the switch connected to GND. REF schematic below.
simulate this circuit – Schematic created using CircuitLab