0
\$\begingroup\$

I am trying to detect when a switch is closed. The device connected to the switch is out of my control, but I have access to the wires feeding it. One side is ground and the other is -1.5v. (the -1.5v wire goes to 0v when the switch is closed)

I would like to get 3.3v on the GPIO input pin when the switch is open, and 0v when the switch is closed. (vice versa is okay also, because software). The input pin can be pulled up or down. Because I'm using the ESP32, I can't give the GPIO anything outside of 0-3.6v.

I'm pretty new to electronics so I dont have a lot at my disposal. I would like to do this with resistors and transistors if possible. I also have access to 5v (not in the diagram)

diagram

\$\endgroup\$
2
  • \$\begingroup\$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. \$\endgroup\$
    – Community Bot
    Commented Feb 1 at 22:46
  • \$\begingroup\$ Using an optocoupler will be easier, more reliable, and less expensive, electronics.stackexchange.com/q/701903/117785 \$\endgroup\$ Commented Mar 1 at 4:46

1 Answer 1

1
\$\begingroup\$

Since you did not mention what is the impedance of input signal when is at -1V5 rather use high base resitor like 100k.

If the input inpedance is low enough you can use lower base resistor. You have to try.

enter image description here

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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