Getting as much power as possible from a 5V 100mA current limited supply - Page 1
Forum section: electronics / projects

author: luke-p
author_rank: Newbie
timestamp: October 17, 2023, 09:13:52 am
content: My goal is to power an ESP8266 from a 5V supply with a 100mA fold back current limit (when the current limit is triggered the supply basically shuts off until it recovers).The ESP draws up to 300mA in short bursts when transmitting, so the goal is 1) to smooth out current spikes and 2) to ensure the limit isn't triggered. #1 is easily done with a capacitor, #2 is what I'm having trouble with.The ESP is powered with a buck converter, and the average current (including smoothed tx spikes) is around 80mA on the 5V side, this leaves little headroom to the current limit which is why I'm looking for a circuit that limits input current to a little under 100mA.I don't have much experience with opamps/analog circuits but I came up with this:This works on a breadboard, but on the prototype PCBs I made it just oscillates. I've tried adding resistance and capacitance at various places to emulate those from the breadboard but no luck so far, probably because I don't fully understand what's happening.How do I get this to work, or is there a better solution altogether?

author: Ian.M
author_rank: Super Contributor
timestamp: October 17, 2023, 09:47:40 am
content: Of course it oscillates - the OPAMP is acting as a comparator so when it reaches the trip threshold determined by your Vref, it doesn't try to 'throttle back' gently, it tries to turn the MOSFET hard off, removing the signal that caused it to trip. The delays through the cascaded amplifiers + the limited OPAMP output current capability charging/discharging the MOSFET gate capacitance + the OPAMP's slew rate, combine to determine the frequency it oscillates at.If you want this to work to limit the current, you'll need something like a classic OPAMP + MOSFET current sink circuit (flipped, with a P-MOSFET to make a current source). Below the current setpoint the OPAMP will rail, turning the MOSFET hard on. When it reaches the threshold it will 'throttle back' fairly quickly with the delay determined by how long it takes the OPAMP to get off the rail and drive the MOSFET into its linear region (somewhere on the gate charge 'plateau').However this isn't going to help you much, as limiting the input current will cause the buck converter output voltage to collapse and brown-out the ESP8266. You might as well simply reset the ESP8266 with the output from the comparator! If you were to add a supercapacitor, charged by the current source set to let's say 90mA, you'd be in with a chance, especially if you monitored the supercapacitor voltage to allow you to put the ESP8266 into a low power mode *before* it browns out.

author: luke-p
author_rank: Newbie
timestamp: October 17, 2023, 10:21:44 am
content: Quote from: Ian.M on October 17, 2023, 09:47:40 amI've already tested with a supercapacitor, that part works well - average power consumption is low enough for this to work.Quote from: Ian.M on October 17, 2023, 09:47:40 amI looked at doing something like thisbut couldn't figure out how to get a stable reference voltage a few hundred mV below V+ which has a bit of a range (4.9-5.5V)

author: magic
author_rank: Super Contributor
timestamp: October 17, 2023, 10:31:44 am
content: Connect the TL431 to the positive rail with pulldown to ground and divide its output with resistors towards the rail. You will need a rail to rail input opamp with low offset voltage, or retain the differential amp from the current design.An alternative idea which may or may not be practical: maybe a boost converter with programmable peak current limit could be tricked to keep the input current <100mA. The higher voltage produced by the boost would store more energy in lower capacitance. The buck would take care of making 3.3V from it.editI don't know about TLV431, but FYI you should never put 100nF on the output of ordinary TL431 because it's about the worst capacitive load for its stability. Besides, you don't need a capacitor here.

author: Ian.M
author_rank: Super Contributor
timestamp: October 17, 2023, 10:33:44 am
content: You don't *need* a stable reference voltage as long as the supply voltage droops before it enters foldback limiting. Simply use a potential divider to set the reference proportional to the nom. 5V supply. If you go for 92mA at 5.5V, it will drop to about 82mA at 4.9V, which is slightly above your average current consumption.N.B. reduce the current sense resistor to 0.1 ohms as you can't afford extra voltage drop.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: October 17, 2023, 10:47:41 am
content: I would probably keep it very simple. Just add a current limiting resistor in front of the big capacitor, especially for a one-off home project.I also wonder why the average current is so high. I'm not intimately familiar with the ESP32, but most micro controllers run quite happily on just a few mA, and below 1mA (on average) when they sleep often and long enough. That leaves only how often, and how much data you send, and WiFi is a power hungry radio. Wifi also needs a lot of current to build up a communication. I don't exactly know what it does. Exchanging encryption keys or something I suppose.There is also a protocol for the ESP32 radio's that does not use WiFi at all, but it's a mesh network. I think it's called ESP-now and I assume it uses much less power on average.

author: luke-p
author_rank: Newbie
timestamp: October 17, 2023, 11:00:44 am
content: Thanks for the suggestions, I will go build some circuits and report back.Quote from: Doctorandus_P on October 17, 2023, 10:47:41 amThe ESP8266 is not a very efficient microcontroller in the first place and this one is running arduino based software written by a web dev. When I asked about low power modes the reply was pretty much a shrug, but I decided not to get involved in the software for this project.

author: Ian.M
author_rank: Super Contributor
timestamp: October 17, 2023, 12:39:56 pm
content: If you aren't willing to dig into the firmware your only option if it repeatedly hits your current limit would be to drop the ESP8266 supply voltage (which can work down to 2.5V) to reduce power consumption. This will of course also reduce WiFi range, and if the signal is weak, paradoxically increase power consumption by causing more retries so increasing the WiFi transmit duty cycle. If the switching regulator's feedback pin is accessable, sense the voltage on the supercap and if its below lets say 4V, drive a small proportionately increasing current into the feedback pin to make it think the output voltage is too high thus reducing it.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: October 17, 2023, 01:09:35 pm
content: Apart from software (which is probably prefered) or a big buffer with charge current limit resistor (simple). If you want to continue on the circuit you already have, then:The combination of an INA180 (does it amplify 100x?) and an opamp gives a lot of amplification. On top of that, there is no need for a big accuracy here. I would probably remove the TLV431 and replace it with a silicon (or scottky) diode directly from the positive supply. That would give a reference that is one diode drop below the supply. You can use a pot or two resistors to get an even lower reference voltage, and then compare this directly with the voltage over the shunt. Then turn the opamp into a slow integrator to drive the gate of the mosfet.But limiting the current to the ESP will always reduce in a voltage drop, and the ESP may brown out.Another option is to add a battery and charge it every now and then (circuit controlled by the ESP).

author: luke-p
author_rank: Newbie
timestamp: February 19, 2024, 12:59:22 pm
content: Update:Took me a while to get back to this project but thanks to the suggestions I've found a solution that works. Honestly not sure why I didn't realise sooner I could reference things to the positive rail.The circuit:This limits current into the supercap to 95mA, I did end up using the TLV431 because a resistor divider alone would end up with a 85mA limit in a worst case scenario. I didn't lower the shunt to 100mOhm because I'm not sure what opamp limitations I might run into at those small voltages. The regulator(not pictured) has a somewhat high UVLO with hysteresis and PG tied to the ESP32 reset circuit to prevent any kind of boot loop due to brownout.R4 with the mosfet are to relax the current limit when powered from USB but not remove it entirely to protect the supercap.I thought I'd share my solution in case it helps someone who finds this topic in the future. And any suggestions to further improve the circuit are welcome too!

author: Haenk
author_rank: Super Contributor
timestamp: February 19, 2024, 01:45:49 pm
content: I'm not sure if running the PSU at 100% and repeatedly overdraw it into shutdown is such a great plan. Time will tell, but I would rather go with a PSU that runs at 75% max, so more like 500mA. Which also saves the hassle of buffering. USB chargers come with (usually) 2A or more, and they are not huge in size either.Isn't that an option?