LUMINA

A fun idea

Sun Jan 2 2022 23:32

I had a fun idea. A little thing with two USB-C jacks that lights up LEDs based on the current going through it. Simple threshold sensing with LED outputs for charging, not charging, and always on.

I designed that with a simple (and readily available) dual op amp, which left one op amp unused. I could buy a single op amp chip but they're not really any cheaper so usually you either leave it unconnected or figure out something else to do with it. So I used the extra op amp to implement a pulsing light output.

This fourth output is on when the current is below the threshold but pulses when it's over the threshold. So it can be used as a more attractive status indicator. Pulsing means it's charging (or at least using more than about 250mA) and on means it's done (or broken).

And because it's USB-C you can plug it in backwards to bypass the current sensing and just have it always on. Or just only connect one side.

Of course a couple hours after I figured all this out, I realized I could do it with a quarter of the parts if I just used an ATtiny. But finding an elegant solution that doesn't require writing any software has a certain appeal. And I'm not actually sure that solution would be any cheaper. We're talking about a BoM on the order of about a dollar.

I just realized this is going to do some fun things if the downstream device uses USB-PD and switches to higher voltages. That's actually not a problem for the op-amp circuit, as long as it stays below 32V. A microcontroller-based project would definitely need some kind of regulator, though. The LED current limiting resistors will need to be a bit more stout at higher voltages, too.