Any way to figure out power utilization

So I’ve been doing some basic programming of the firmware trying to customize the LED lighting effects a little, and now I keep getting warnings on Windows that I’m shorting the USB ports due to drawing too much power. Obviously this is bad, but as I’m developing, is there any way for me to predict what will/won’t trigger this? Is there a simulator for this board or anything of the sort that could help predict potential power usage of the code running?

I’d probably start with the datasheet for the APA 102C. You might also grab a USB voltagemeter/ampmeter. They’re typically only a couple bucks on Amazon. That’ll help you see what’s “really” going on.

The keyboard itself is hard-limited to draw no more than 1.6A, even if you try to overdrive the LEDs. (At full white, they can pull 4A)

I’m not used to Windows complaining about current draw under 2A. What Windows is this?

Ah ok. I’m fairly new to this, so I was wondering whether there was like a software emulator to do a rough estimate of the power draw first, but from looking around, it seems like people just “do it live”, so to speak.

This is Windows 10. The error I get is basically this:

I think it’s probably something to do with me flashing all LEDs on the keyboard a certain colour for a brief moment that triggers the surge, but I’ll look at purchasing a USB voltmeter/ampmeter like you said to measure it myself. I haven’t used one in decades. Any recommendations?

nod AVR simulators are…not as good as we would want them to be. But measuring power draw in a simulator is probably one of the ‘hardest’ bits. It requires accurately modeling the ICs, LEDs, capacitors, resistors and the traces on the board.

Right, I wouldn’t expect it to be accurate in the slightest; but having a rough idea at least of the power drain between iterations of my code would be better than not having any clue at all whether the changes I’m making are helping/hurting.

I went ahead and ordered a cheap thingy: so I’ll see if it works as advertised. Should be fun, assuming it doesn’t blow up or fry the board.

If you/anyone has tips/tricks on what I should look out for when measuring power, feel free to educate; I’m completely new to this aspect of programming. I had a quick look over the LED datasheet and it looked fairly straightforward; I assume they the

So I got my USB volt/amp meter today, and it seems like the keyboardio draws ~2.77V consistently, regardless of whether all the lights are on/off, or whether I’m typing. Does that seem right? I would have expected power draw to be lower if the lights were off or when no keys were pressed at all.

Edit: I started going around measuring my co-worker’s keyboards, and funnily enough, they all measure at around 3V or so, even for keyboards with no backlighting whatsoever.

Edit 2: Interestingly, at home, using the same firmware, the keyboard is drawing 2.99V pretty consistently! Both keyboards are (supposedly) from MP5, the only difference is that one keyboard had its firmware compiled on Linux and the other on Windows…I wonder if somehow the code generated actually had a difference?

Also, I notice that right when I trigger the USB power surge warning, the power draw remains at a steady 2.99V and then the power gets cut off by the OS; the USB voltage supply remains around a steady 5V throughout. I’m planning to swap the keyboardios I have at work and at home just to see if it’s hardware-specific or if it’s to do with the firmware.

You say “V”, do you mean “A”? You want a meter that measures current, not voltage.

Strangely, the current reading remains at 0A consistently…I’m measuring it by connecting the tester between my keyboardio and the USB port supplying power.

Ok, so that ampmeter was bad. I got another one (Makerhawk UM25), and it looks like the Caps Lock plugin lighting the keys red is the issue; the keyboard draws about .75A normally with all lights on, but once I hit Caps Lock which changes all my alphabetical keys to red, the keyboard power draw jumps to around .87A, which is close to the limit for USB3. Since my KVM at home supports USB 2.0 standards only, my guess is that this is what’s triggering the power short. With all lights off, the keyboard draws approx. 0.25A, so I’ll try modifying the caps lock plugin to just light up fewer keys and see if that helps solve the issue.

You can also try changing the color, to be less bright. Something like, say, CRGB(160,0,0) should draw noticeably less power.