0
\$\begingroup\$

I have a circuit running on 12v 8mA and I want to get a signal to a GPIO of an esp8266 when current is running. So for that I tried to use a 2N2222 transistor with vcc of the circuit going to the base and vcc and gpio of the esp connected to collector and emitter. Unfortunately it seems current is not high enough to trigger the transistor. How I can proceed to make it work ?

\$\endgroup\$
  • 6
    \$\begingroup\$ Welcome to SE.EE! Better draw a schematic as it is more clear than words. Preferably by using the tool this site provides. \$\endgroup\$ – Huisman Oct 9 at 20:09
1
\$\begingroup\$

Ouch. It sounds like you may have fried the input pin of the ESP8266 by applying 12V to it through the BE junction of the 2N2222. If not, you were saved by the fact that the current is limited to 8 mA.

Anyway, your question is ambiguous, so I'll give two answers.

If you just want to sense the presence of +12V, a single transistor and a couple of resistors will suffice:

schematic

simulate this circuit – Schematic created using CircuitLab

On the other hand, if you want to sense whether a load is drawing 8 mA of current from your 12 V source, you'll need a second transistor:

schematic

simulate this circuit

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot ! I hope I didn’t fried the gpio like you said. \$\endgroup\$ – Dragouf Oct 9 at 21:03
  • \$\begingroup\$ Thanks again ! I tried and it works ! \$\endgroup\$ – Dragouf Oct 9 at 21:26
  • \$\begingroup\$ Glad to help. Just out of curiosity, which circuit did you need? \$\endgroup\$ – Dave Tweed Oct 9 at 21:27
  • \$\begingroup\$ I wanted to detect current drop of my apartment intercom. It happen when someone is ringing. Like that I can send it other internet. Btw, is it ok if I keep the transistor base with 12v until someone ring or it may damage it on long term ? \$\endgroup\$ – Dragouf Oct 9 at 21:30
  • \$\begingroup\$ Nothing will get damaged in these setups. \$\endgroup\$ – Dave Tweed Oct 9 at 21:31

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