-->
Page 1 of 2

Capacitor size for Output Pin

PostPosted: Sun Mar 17, 2019 5:23 pm
by Vudu
I am using an ESP8266 to control an 12V LED stripe.
I am using three pins to control 3 irlz34n MOSFETs which regulate the RGB-phases of the LED stripe. Both ESP8266 and LED stripe are powered by a 12V 3A power supply with a voltage converter for the ESP8266 (set to 5V).

My problem is that when I power the system, I have a short (100ms) spike on my Output pins which results in a short flash of the LED stripe. I did some research and found this article:
http://rabbithole.wwwdotorg.org/2017/03 ... -gpio.html
It explains that ESP8266 pins go to high for about 100ms after power on.

My solution to this was to add a capacitor to each outgoing pin towards ground.
I tried 100nF, 47nF, 4.7nF. All seamed to work fine and solve my problem. No more flash on power on. Everything works fine.

My question is, how do I find/calculate the correct capacitor size to use. How do I know if the capacitor is too big or small?

Thanks in advance for your help, please let me know if you need additional information.

Re: Capacitor size for Output Pin

PostPosted: Sun Mar 17, 2019 10:57 pm
by rudy
That isn't a good solution. The capacitor is basically a short circuit every time the state of the pin changes.

While it is only two pins, you can use GPIO4 and GPIO5 without the problem at startup.

A better solution is to have a gating signal that would block the pulse from the pins. But this would require more hardware.

Re: Capacitor size for Output Pin

PostPosted: Mon Mar 18, 2019 4:09 am
by btidey
The pins that pulse high during boot up are only pulled high by a weak pull up of around 36K.

If you put a pull down resistor of about 4k7 then then they will not go high until you have set the mode to output and written a high.

As you are driving MOSFETS it is good to have the pull down resistor between gate and source anyway to ensure the MOSFET is off if the GPIO is floating.

During setup for these pins you should do the digitalWrite to 0 before setting the mode to Output to ensure there is no glitch.

Re: Capacitor size for Output Pin

PostPosted: Mon Mar 18, 2019 10:46 am
by RichardS
The pull down is a good idea to keep them off at start.

RichardS