So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Bringamosa
#80865 Hi all,

I was wondering if anybody here could help me out. I want to switch 3 LEDs from a 12v strip with the esp8266 running its server.

I got the code running, when giving the commands on the website I can measure the GPIO2 pins voltage, 3.3 at high and 0 at low.

Next step is to incorporate the transistor part. I have the 2n2222 transistor. Collector to the 12v side, base to gpio2 with a 220ohm resistor in between, emitter to ground.

See attachment for the schematics.
[img]here[/img]

However when I plug in the esp8266, it won't go true it's usual cycle. The red powered goes on, but also the blue led stays on.
When I remove the connection to the gpio2 pin it will boot normally.

Anybody any idea? If code is needed I can post that too.

Kind regards.
You do not have the required permissions to view the files attached to this post.
User avatar
By schufti
#80883 main problem: gpio2 is pulled low via b-e of transistor. With gpio2 low, esp wont boot user code.
fix: place resistor between gpio2 and base of transistor.
good practise: use pull-up on gpio0, gpio2, rst for stable operation.

for your set-up 1k pull-ups und 4k7 between gpio and base should work,
depending on led-current and beta of transistor (est. 100).
User avatar
By Bringamosa
#80886 Thanks for the fast answer.

I want to switch only 3 leds, in total consuming 40mA. With the help of some other people we came to the conclusion that 220ohm is good to switch.

So knowing the problem now I have installed a momentary nc switch between the resistor and 2n22222 base. When booting up I press the button and break the connecting between base and gpio pin. This works for now.

However I prefer not to use the button so a 1k pullup would be nice. Please forgive me for the noob question, will this resistor go between gpio pin and ground, or vcc?

And, the resistor between 2n2222 and base, you suggest is now 4.7k because of the pullup resistor it changes so much? Also very new to transistors, calculating the resistance is still a bit magic for me.