geekhack
geekhack Projects => Making Stuff Together! => Topic started by: emenelopee on Mon, 29 January 2018, 21:44:23
-
Background: Custom keyboard, Teensy controller, per-key static LED hooked straight to the 5V power through a rheostat
Question: The keyboard keeps pulling power from my USB hub and laptop sockets even when the laptop is off, meaning the lights stay on when everything is shut down -- is there any way to stop this, either through the firmware or other non-mechanical switch method? I keep having to unplug the board overnight which is getting a little tiresome. I'm not too bothered by the light as the keyboard is in the office, but I have had one of the rheostats burn out in a prototype (smoke, cause unknown), so I'm a little concerned by any burning out happening when I'm not around.
-
The best way to get an answer would probably to ask PJRC (https://www.pjrc.com/), the folks who make the Teensy, by posting here (https://forum.pjrc.com/forum.php).
-
Some laptops supply power on USB ports even when they is powered off, for charging cellphone. Silly! Probably you can stop this awful function on BIOS setting.
what kind is your rheostat actually? and what do you use it for? Just curious.
I Google'd "rheostat" but I couldn't get idea.
-
Some laptops supply power on USB ports even when they is powered off, for charging cellphone. Silly! Probably you can stop this awful function on BIOS setting.
]
I was hoping there was something in the firmware I could tweak that would tell the laptop not to send power (I'm pretty sure all my off-shelf keyboards do that as they don't continue to glow), and it also happens when plugged into my monitor and dock USB holes. I'm guessing it's because of how simple my light circuit is.
what kind is your rheostat actually? and what do you use it for? Just curious.
I Google'd "rheostat" but I couldn't get idea.
This is one - I use it in series with the per-key LEDs, which are in parallel, to control brightness.
(https://sc02.alicdn.com/kf/HTB1bzD5OVXXXXXNXFXXq6xXFXXXo/White-Blue-500-ohm-Variable-Resistor-501.jpg_350x350.jpg)
-
It's a double-sided software issue.
First, the BIOS in your host computer needs to shut off the USB port or put the bus into "suspend mode".
Not all BIOS:es, even with the latest updates, can do either. Some are able to shut off USB ports, others will put devices into "suspend mode" and others will keep the USB buses alive.
In some, you have to find just the right option. Maybe there is some option for "awake from keyboard" or something, that you have to switch off, combined with "power saving mode". It is different from BIOS to BIOS.
Second, the firmware in the keyboard needs to make itself go into "suspend mode".
It is supposed to be mandatory for a USB device to auto-detect when the host puts the bus in suspend mode and then put itself in a low-power mode... but PJRC's USB source code (that most firmwares use) does not support it.
Some firmwares have suspend-mode support added in, however.
Then that firmware will have to be able to shut off the backlighting with an electronic circuit -- the host will not stop delivering power.
The common method for backlighting is not to drive LEDs directly but to use a LED matrix (connected similarly to a keyboard matrix) where the LEDs actually flicker at a rate higher than what the human eye can detect. Dedicated LED matrix driver chips tend to flicker at a fixed rate but alter the duration of each pulse (Pulse Width Modulation) to change brightness. With PWM you shuld have more range at the lower end than with direct drive, as with direct drive the lowest brightness would be limited by the LED's starting voltage.
-
Now that's a response!
I'd have thought USB sources would know not to push power into non-battery objects when shut down, but obviously, as you summarise, it's always more complicated than you'd expect.
EDIT: of course I went for the simple direct drive - the LEDs were a last minute addition. If I had my time again I'd tap into the QMK LED driving capabilities, maybe for the next iteration.