Why would an LED works off mains but not battery?

I have a USB-plug little LED light and I’ve noticed it works fine in a USB port fed by AC, but doesn’t work in a powerbank (just brief random flashes). I’ve tried several powerbanks. Why would this be? USB is 5VDC, surely 5VDC is 5VDC?

It should be 5V DC. But not all USB sources are of equal quality, and some of the cheap ones produce absolutely atrocious waveforms.

also, USB devices have to “negotiate” their power draw with the host port. Dumb (charge only) devices usually do this by bridging the data pins with a known resistance. could be that your light is doing something weird and causing the powerbank to refuse to supply it power.

Some power banks shut off when the current draw is very small. I’ve had a power bank that wouldn’t charge a bluetooth earpiece.

Did you connect it the right way round?
The “light emitting” only works when the diode part is off:)

As I understand, all USB ports supply 5V 500mA by default, and those “negotiations” are only needed for drawing more than 500mA.

I would start to debug it using one of those plug-in USB voltage + current meters. Connect it between the port and your device and you can see how much power is getting through, and at what voltage.

IIRC with USB 1.x and 2, it’s 100 mA by default, and per spec up to 500 mA if the device negotiates for it. Some systems/mainboards violate that by just tying the 5 volt pin to system +5 Vdd. I think with USB 3.x/Type C is when greater than 5V/500 mA is allowed.

Doesn’t an LED like that pull ~25mA?

This is my guess as well. There’s some switching intended to prevent parasitic drain that’s cutting power entirely.

I also have a powerbank that will only charge things that draw “enough” current.

Something like that. For reference it’s lamp similar to one of these: https://alexnld.com/wp-content/uploads/2015/05/SKU218866-1.jpg

Thanks everyone, I think “power-saving powerbank” answers the question.