Just to clarify one thing first: I'm not trying to smooth the output voltage from a PWM signal - I would just use an appropriate capacitor for that purpose.

So, I have made some heated insoles for my wife (she struggles with chilblains, and nothing on the market kept her toes sufficiently warm). The insoles generate heat using Nichrome wire and are powered by a USB battery pack. Each insole draws about 1.2A at 5V, which the battery pack is quite happy with and lasts a few hours.

The insoles work great but sometimes needed to be turned down a little bit, so I used a cheap PWM LED dimmer to control the heat output. This works great except when reducing the heat output, the battery pack shuts off after a while.

My USB battery pack shows a 2.1 amp mode and a 1 amp mode on its display. When on full power, it automatically switches to 2.1 amp mode. When on a lower power, it automatically switches to 1 amp mode. My current theory is that the battery pack has a resettable fuse inside, which breaks the circuit because I am actually still drawing 1.2 amps during the PWM cycle.

Here's a diagram of my circuit so far: Circuit Diagram

My question is: How can I "smooth" the current that I am drawing from the battery pack so I don't draw more than 1 amp on the lower PWM settings?

  • 3
    \$\begingroup\$ Can you show the schematic of the dimmer you used please? I mean, without it it's just guesswork as to whether adding an output inductor will cause the dimmer to fail. What PWM frequency does it use? Please provide technical details of the battery. \$\endgroup\$
    – Andy aka
    Feb 15, 2023 at 12:00
  • \$\begingroup\$ That's a good question @Andyaka. As with these cheap imports, it doesn't come with much documentation. I did pull one apart and it has a 13.52127Mhz crystal oscillator on it and some mysterious unlabelled ICs. I suspect that it uses a microcontroller for switching a MOSFET to generate the PWM, although the PWM frequency is unclear, which isn't very helpful I know! \$\endgroup\$ Feb 15, 2023 at 12:20
  • \$\begingroup\$ I also don't have much on the battery itself, but I would prefer it if the solution didn't rely on specific details of the power source (i.e. I should be able to safely swap out the battery pack or use a USB wall adapter) \$\endgroup\$ Feb 15, 2023 at 12:29
  • \$\begingroup\$ You could try a capacitor across the input to the PWM module. USB spec apparently says 10uF is maximum allowable but you could try higher (eg. 100uF electrolytic capacitor). \$\endgroup\$ Feb 15, 2023 at 13:43
  • \$\begingroup\$ @SpehroPefhany I think the dimmer might already have input capacitance and this could cause the battery to shutdown, so more ripple isolation might be required as per user4574's answer \$\endgroup\$
    – tobalt
    Feb 15, 2023 at 16:28

3 Answers 3


The battery pack shuts off after a while.

It may be because of an "auto shutdown feature." Most power bank system chips come with a no load detection system which measures the output current. If it is below a certain threshold (~ 50-100 mA) then system assumes no load and shuts down the supply and goes to sleep mode. They usually wait a certain amount of time before that (about 15-30 seconds.)

You could check if your power-bank shuts off automatically when the consumed current drops. You could use a simple LED and resistor at the power supply output and monitor the change.

  • \$\begingroup\$ I've found this when running LED bike lights off USB battery packs. The lower the LED brightness (by PWM) the sooner the battery pack shuts off, but there's a significant random factor on at least one pack I have. I've started to wonder whether the battery pack is polling the current at low frequency and shutting down if it detects a (near-)zero current a few times in a row, rather than high frequency and averaging (the low frequency could equally be a beat between the current measurement frequency and the PWM frequency). \$\endgroup\$
    – Chris H
    Feb 15, 2023 at 20:41
  • 1
    \$\begingroup\$ I suspect that this is the case. Had a problem when most powerbanks but the cheapest ones refused to power ESP32 (which was the only load), because it did not draw enough power. \$\endgroup\$ Feb 15, 2023 at 21:05
  • \$\begingroup\$ This is a solid theory. I'm curious about the simple LED and resistor setup. I can see when my insoles switch off already, so I'm wondering how I can use the extra LED and resistor to test this theory? \$\endgroup\$ Feb 16, 2023 at 16:00
  • \$\begingroup\$ @ Jack Harrison, first disconnect your driver ckt and place a 220Ohms (or < 1K resistor) and led to output of your power-bank also connect an ammeter in series turn on power bank ( if it won't turn on automatically ) and measure the current. case1: led will glow till some time as mentioned above for some time and power bank will auto shut down, if this happens then the reason is same as i mentioned. and you would have to maintain the minimum current requirement of chip to keep power bank on. \$\endgroup\$
    – Chr_arj
    Feb 18, 2023 at 10:51

“High frequency” PWM is the problem. Due to thermal mass, the heater can be PWM-Ed at say 10Hz. This will present full load current to the pack repeatedly and prevent it from going to sleep. No other filtering is needed: you want the full-current low frequency periods so that the sleep circuit detects them and doesn’t power down the output nor change modes down to 1A.

I’ve faced the same problem, just in a different USB-powered heating application. Running the PWM at a couple to couple dozen Hz made it work with all power packs I had handy.

If you have a USB-C power pack then you can switch the heater to a USB-C connector, and a PD power sink chip/module in the heater to identify yourself as a 3A 5V load. The battery pack won’t shut down then as long as the power contract is active.

  • \$\begingroup\$ It sounds like you have some experience in this field. I was hoping not to have to create my own PWM circuit (I'll never be able to make it as small as the AliExpress imports and it wouldn't be remote controlled). I don't have a battery pack with a 3A 5V setting, but perhaps this would work nicely with a different battery pack. \$\endgroup\$ Feb 16, 2023 at 16:27
  • \$\begingroup\$ Are you saying that I could run an unfiltered PWM load if I got a simple USB PD decoy (such as this one and a suitable battery pack? \$\endgroup\$ Feb 16, 2023 at 16:32

If the PWM frequency is high enough, just put a pi-filter between the PWM load and the battery pack.


simulate this circuit – Schematic created using CircuitLab

R1 is optional to prevent resonance. It can be omitted if there is enough resistance elsewhere in the circuit.

Pick L annd C such that the cutoff frequency is several times lower than PWM frequency. Ignoring resistance, the cutoff frequency is calculated as...

$$f = \frac{1}{2\pi\sqrt{LC}}$$

For example, for 100k PWM you might pick. C = 100uF and L = 1uH, which gives a cutoff frequency of 15.9KHz and would give you about 39:1 attenuation.

The resistor R1 should be chosen such that ...

$$ R1 + Capacitor\_ESR + L1\_ESR \ge \sqrt{\frac{4 * L}{C}}$$

In the case of 1uH / 100uF you need at least 0.2 ohms total between the capacitor ESR, inductor ESR, and the resistor R1.

You will want to avoid having too much ESR in the capacitors or it will hurt the performance of the filter.

  • \$\begingroup\$ In principle this. But instead of a series R, which wastes loads of power, you place a snubber in parallel with C2 to damp possible resonances (usually Al electrolytic capacitor) \$\endgroup\$
    – tobalt
    Feb 15, 2023 at 15:59
  • \$\begingroup\$ @tobalt I agree with your statement about using a parallel snubber. But practically speaking, for 5V/2A and using small electrolytic capacitors and a small inductor, the ESR by itself might fulfill the damping requirements either with none, or a very small resistor. Whether one wants to include the extra snubber depends on how much they want to optimize the design. \$\endgroup\$
    – user4574
    Feb 15, 2023 at 16:06
  • 1
    \$\begingroup\$ This isn't the correct solution. More likely the power bank is shutting down due to very low load detected. It'll shut down even after adding this 'filter' \$\endgroup\$ Feb 15, 2023 at 16:22
  • \$\begingroup\$ Yes you are right, with something like 0.1 ohm, one seems to be set, but in general don't recommend an extra series resistor. Especially not when using batteries \$\endgroup\$
    – tobalt
    Feb 15, 2023 at 16:23
  • \$\begingroup\$ @Kripacharya How much "more" likely ? If you dim only a "little" (as stated by OP), the current is likely much higher than 100 mA (perhaps on the order of 0.5-1 Amp) and the input current ripple of the dimmer could well upset the battery too. So it's a valid solution to post here. It is very vague to claim this solution be wrong, when the OP hasn't provided numerical values. \$\endgroup\$
    – tobalt
    Feb 15, 2023 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.