When you want to control an external device (like a lamp) from your computer, you might reach for a USB enabled micro. Looking for an inexpensive and quick option to control two lamps [Pete] wanted to control a couple 12 volt halogen lamps, he reached for his keyboard and used a little bit of python.
Desktop PC keyboards have 3 LED’s indicating lock functions, hardly anyone uses the scroll lock, and on a laptop with no keypad, numlock is no big loss as well. Adding wires to the little PCB out of a USB keyboard the numlock and scroll lock LED’s 5 volt output was redirected to a switching circuit.
That switching circuit takes the output of either LED, inverts it with a PNP transistor, then connects to the gate of a FQP30N06L, “logic level” mosfet transistor to handle the heavy lifting. Once the wiring is in place a fairly simple Python script can take over turning on and off the two chosen lock keys, giving control of up to 32 amps with the touch of a button.
21 thoughts on “Quick Keyboard Hack To Control Heavy Loads”
You can buy a Teensy for less than (or about) the cost of a many a USB keyboard, and you don’t have to worry about things like “what happens when the computer reboots”….
I actually bought a USB keyboard at a dollar store for a couple of dollars. Their keys aren’t great, but you are only after the controller.
but you can go out to your local computer store and pick up a keyboard the same day.
Or if there is a microcenter around you then your in luck. It’s like a hackaday toys r us. Inland unos are 6$.
You don’t have a bunch of old keyboards just lying around? For that matter, this idea could be applied to just about anything with a LED.
Where are you buying your keyboards from? Or, alternatively, where are you buying your teensys from? You can usually pick up a keyboard for a couple of quid; even less if you pick up someone elses old one. teensys are usually about £20ish
Smart implementation. I love this sort of on-hand stuff.
Wire a couple of the pads together to simulate say a [Ctrl]+[Alt]+[Shift]+”x” shortcut. Then you can have feedback. For say the ambient light level in the room.
Err… optical isolation? 32A AC and keyboards are unlikely to play nicely together.
Relevant despite the lack of an Arduino here.
You won’t see 32A without wiring a special outlet from a fuse panel. So chances are this is lower voltage DC and just a max rating from the MOSFET. i.e. even real rating in real life.
So if your linux box goes kernel panic, your lamp will blink. I don’t know if this is a bug or a feature ;)
PIC 18F2550 is about $2 on eBay, it has native USB interface, 2k of RAM, runs at up to 96MHz … also there is that thing called Arduino Nano.
However this is the cool hack, giving some purpose to scroll lock LED is nice option. I wish some keyboard manufacturer realized that and put general purpose out connector on keyboard.
I have not seen ebay selling PIC18F2550 for less than $4. On Aliexpress, they are from $3.80 and up.
Not that it matters as there are plenty of much cheaper USB capable chips at that price range.
PIC16F1454. USB Chip for $1.40 14 Pin DIP.
I used this approach almost a decade ago for some small lava lamps used as code build indicators.
Check out the link for a nearly free way to make usb connectors, another way to implement the software, and an altoids tin project case.
How odd, I was considering doing this very thing with my keyboard a couple weeks ago, I was going to glue an LDR to the scroll lock LED of the keyboard instead of hacking it open though. But I keep my keyboard on my lap most of the time and I don’t want to deal with extra wires coming off it. I suppose that could be remedied with change to a cord with more wires though…
On most laptops with no numpad some of the ordinary keys become the numpad when Num Lock is on (for me UIO becomes 456, JKL becomes 123 etc.) S6 5f 5 d5d th5s, th5s 5s what everyth5ng 5 ty*e w643d 3662 352e when the 3a0* was 6n.
MAME has long supported mapping some of the original games’ cabinet lights to LEDs – I think even the Q*Bert pinball thumper can be triggered via CAPSLOCK light or something. Atari had several games with individually lighted Player 1 and 2 “volcano” buttons once you had put in enough coins.
Cool idea have done similar things when I was a teenager and didn’t yet have microcontroller powers. On another note this post makes me miss parallel ports…
Oh also I wonder what type luck one would have use a pre-amp circuit wired directly to an audio output through some passive highpass/lowpass (notch?) filters interfaced with a flip/flop. Turn on tone once lamp on again lamp off.
Use another USB keyboard circuit board and cable gutted to do this, then plug it into your system. Run USB to the hacked control remotely located. No hack on your normal keyboard. I want to mute the radio tuner at the sound mixer which includes computer sound, it’s a few feet away from the chair and desk. The only thing I can’t control is the radio from the computer.
This came up on a search of scroll lock hacks. Playing with the little board from a texter that also had the mute and volume buttons on it I wanted to mute the volume of the computer at the stereo with this board and a big pushbutton. Then it occurred to me, what happens when I hit one of the lock buttons on the computer keys? The light comes on on the slave keyboard too!
Please be kind and respectful to help make the comments section excellent. (Comment Policy)