0
\$\begingroup\$

I am trying to build a project (almost done !!!) I just need to be able to gnd GPI02 when I get 12VDC on other circut. I don't know if I need a opticoupler or what I need. I'm NOT trying to close the 12 VDC circut with the ESP8266, I'm trying make GPIO2 go low when 12vdc is applied on the other side of the circut.

WWould it be better to use a solidstate relay or reed switch?

Anyone have a suggestion? Thanks in advance for the help.

My ESP8266 project

\$\endgroup\$
1
  • \$\begingroup\$ sounds to me like an inverted buffer and some voltage translation (with a voltage divider resistor pair) is all you need \$\endgroup\$
    – KyranF
    Jan 3, 2016 at 4:28

2 Answers 2

1
\$\begingroup\$

A single N-MOSFET should suffice. Drain to pullup/GPIO2, gate to 12V via gate resistor, and source to ground. The popular 2N7002 would be appropriate.

\$\endgroup\$
1
\$\begingroup\$

An opto would work, if wired correctly. A simple transistor would work as well if you don't need the isolation.

schematic

simulate this circuit – Schematic created using CircuitLab

Left circuit for the optoisolator, right for a simple transistor.

R1 should be sized for 12V and the optoisolator's led forward voltage and current.

The right circuit needs to have a common ground, so you need to tie the 12V system's ground to the 3.3V system's ground. R5 is simply to prevent the transistor's base from floating if the 12V is missing.

\$\endgroup\$
1
  • \$\begingroup\$ I ordered a 4n35, going to try the circut on the left, I will let you know how it works. Thank You \$\endgroup\$
    – hallcs
    Jan 4, 2016 at 14:06

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.