Hi,
my custom PCB is sourced with 12V and I have 3.3V voltage regulator on it.
I have a requirement, that the ESP32 needs to stay energized for 1sec after the source voltage was cut off, so that there is some time, to write data to flash.
Current consumption is about 0.25A
Could someone please help me to choose the right capacitor ?
Many thanks!
Capacitor for custom PCB
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: Capacitor for custom PCB
Easiest is to put the cap on the 12V side, that means that your ESP has time to do its thing until the capacitor discharges to 3.3V plus whatever overhead the LDO requires. Assuming that is 1.2V (which is typical for a LM1117), your device will still work when your cap discharges from 12V to 4.5V.
The capacitor equation is I=C(dv/dt), the current is the capacitance times the change in voltage, in volts per second. The change in voltage here is (12-4.5=)7.5V, and we want this to happen in 1 second (the time the ESP needs to stay alive). The current is 0.25A. In other words: 0.25A=C*7.5V/s meaning C is 0.25/0.75=33000uF.
Note that this assumes a LDO, which would burn away a fair bit of current. You could get away with a smaller cap if your circuit uses a buck converter. In that case, the current on the 12V side isn't constant, as the buck converter varies it to make sure the power on the input is the same as the power on the output, minus losses. Assuming losses are like 20% or so (most buck converters are more efficient), your ESP will pull (0.25A*3.3V)/0.8=1W on the 12V side of things.
According to here, the capacitor needed in this case is C=(2*P*t)/(V0^2-V1^2), which here comes down to (2*1W*1sec)/(12^2-4.5^2)=16000uF.
Note that it's a bit hard to find capacitors that high, but you can parallel up capacitors and add their capacitance. For instance, you could get two 10000uF/16V capacitors and parallel them up. Do note that a capacitance this high may lead to inrush current issues when the 12V is turned on, you may need to take measures for that.
The capacitor equation is I=C(dv/dt), the current is the capacitance times the change in voltage, in volts per second. The change in voltage here is (12-4.5=)7.5V, and we want this to happen in 1 second (the time the ESP needs to stay alive). The current is 0.25A. In other words: 0.25A=C*7.5V/s meaning C is 0.25/0.75=33000uF.
Note that this assumes a LDO, which would burn away a fair bit of current. You could get away with a smaller cap if your circuit uses a buck converter. In that case, the current on the 12V side isn't constant, as the buck converter varies it to make sure the power on the input is the same as the power on the output, minus losses. Assuming losses are like 20% or so (most buck converters are more efficient), your ESP will pull (0.25A*3.3V)/0.8=1W on the 12V side of things.
According to here, the capacitor needed in this case is C=(2*P*t)/(V0^2-V1^2), which here comes down to (2*1W*1sec)/(12^2-4.5^2)=16000uF.
Note that it's a bit hard to find capacitors that high, but you can parallel up capacitors and add their capacitance. For instance, you could get two 10000uF/16V capacitors and parallel them up. Do note that a capacitance this high may lead to inrush current issues when the 12V is turned on, you may need to take measures for that.
-
- Posts: 1729
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Capacitor for custom PCB
You may also want to include a mechanism to quickly detect the loss of 12V power, e.g. via a falling edge GPIO interrupt. In response to that event, the ESP can immediately shut down non-essential peripherals; stopping WiFi and Bluetooth significantly reduces current consumption and with it the required size of the capacitors.
Re: Capacitor for custom PCB
@ ESP_Sprite
Many thanks for that awesome post and support!
@ MicroController
I am already reading the source voltage, so that I can react to a shutoff.
Thanks for the hint with shutting down not needed stuff like wifi etc! Didn't consider that.
Many thanks for that awesome post and support!
@ MicroController
I am already reading the source voltage, so that I can react to a shutoff.
Thanks for the hint with shutting down not needed stuff like wifi etc! Didn't consider that.
Who is online
Users browsing this forum: Baidu [Spider] and 46 guests