Mopheus:
Hi everyone, I have a simple question but after some research online I can't still figure out the solution. Sorry for my bad english. It's quite simple, I'm using this very easy circuit to control an IR led, but when I connect it to GPIO0 or GPIO2 on my ESP, it doesn't work. While it works on GPIO3 (RX)... so, I think it's because for some reason, when connected to GPIO0 is pulling up (or down) the pin and going into FLASH mode. Is it possible ?Can someone help me understand how to change this circuit to work with GPIO0 (is the one I need to use actually).
Thanks.
Several things:
- How are you determining that the IR LEDs are not working? You do realize that IR LEDs are not visible, right [unless you're a snake, or a very unusual human]? Is it that you have an IR receiver, and it isn't registering? Also, a quick way to verify that the IR LEDs are lighting up [or not] is to use a Digital Camera [can be on a Cell Phone]. Most digital cameras will show IR as a "color" [usually a pinkish white]. First, power up an IR LED using a DC voltage and a resistor [run it at 20mA, unless you know for sure it is rated to run at a higher continuous current]. Then, using the camera, peer down at it from the top. If you see a glow, then you have verified that your camera can, indeed, "see" IR. Then, do the same with the IR LEDs you are driving with the 2N2222.
- You show 50mA as the current at the collector. Using an LED forward voltage of 1.1V, I get more like 79mA:
[5V - 2(1.1V) - 0.1V]/34Ω = 79.4mA where: 1.1V is the IF of each LED and 0.1V is the VCE(sat) of the transistor.
BUT, that's assuming a VCE(sat) of 0.1V. Even if the VCE(sat) is more like 0.3V, and each LED VF is more like 1.3V, I still get around 62mA:
[5V - 2(1.3V) - 0.3V]/34Ω = 61.8mA
So, are you over driving those LEDs. And could that have fried them?
- Are the LEDs being held on for too long? Typically, such high currents are meant to only be applied for short periods, with a small duty cycle. Have you consulted a datasheet, and are you driving then correctly? This could be another reason the LEDs could have fried.
- If you have a scope, take a look at the is happening across the Collector-Emitter junction. Do you see it toggling? If not, do you see a signal at the Base of the transistor? If not at C-E, then suspect the transistor. If not at the base, consider an open circuit somewhere, or even a short! Check to see if you see a signal at the GPIO output. If that's missing, it might be shorted, or the pin might be bad, or the sketch might not be written correctly.