geekhack

geekhack Projects => Making Stuff Together! => Topic started by: Vozella on Sun, 03 January 2016, 17:23:17

Title: I have a few questions about LEDs on custom keyboards.
Post by: Vozella on Sun, 03 January 2016, 17:23:17
1) Are PCBs the only way for a keyboard to have LEDs or can I have LEDs another way? I just want a static white light on it. Maybe hand wiring it? Also, how will I be able to change the brightness?

2) How do I have a CAPS LOCK indicator? Is there any way I can make it to where the LED for that keycap turns on when the CAPS LOCK is on? Or can I have a whole other LED somewhere else for it?
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: Connly33 on Sun, 03 January 2016, 17:29:07
Ive been wondering the same thing for the caps lock light. I have a keyset with a caps lock light window that is on the opposite side of the led mounting holes on most PCB's. Im not using most of the LED mounting holes so im trying to find out if i can do something in the firmware to make the LED come on with caps lock.  (or function key if i change it to that) If not im thinking about wiring the led up separately somehow either to the boards own microcontroller or a separate small one.
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: suicidal_orange on Sun, 03 January 2016, 17:46:04
If you can connect a wire to the LEDs you can wire them up to a battery (or whatever) to make them light up independently of the keyboard they're plugged in to.  By changing the resistor value you can set them to one static brightness of your choosing but if you want to be able to change the brightness while in use you'll need to use a microcontroller such as a Teensy and wire up an LED matrix as described in many tutorials online.

For caps lock LED you will need to connect it to a "keyboard" - this could again be a Teensy with no switches attached but with a keyboard firmware running on it as all keyboards share the system controlled caps lock status.

If there is an LED (or an empty space for one) somewhere on the board you could instead run wires from the two pads there to wherever you would like the LED to be, this won't interfere with the switches but be careful to route it round any case supports or standoffs so the wire doesn't get cut and short anything.
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: VinnyCordeiro on Mon, 04 January 2016, 00:20:35
1) Are PCBs the only way for a keyboard to have LEDs or can I have LEDs another way? I just want a static white light on it. Maybe hand wiring it? Also, how will I be able to change the brightness?

2) How do I have a CAPS LOCK indicator? Is there any way I can make it to where the LED for that keycap turns on when the CAPS LOCK is on? Or can I have a whole other LED somewhere else for it?
1) The biggest problem is handling the electrical current needed to light all LEDs up. USB 2.0 ports can handle only 500mA of current. Given the fact that a typical LED consumes 20mA maximum, you have a problem to light all LEDs of a given keyboard, even a 60%.

The common solution is to multiplex the LEDs, so just a fraction at a time are activated for a short period. Do that fast enough and human eye will not be able to see the LEDs going off. That's the same principle that makes cinema possible. And that's why it is easier to do that with a PCB, the additional electronics components needed usually goes soldered there.

If you use an external power supply to light the LEDs, you can completely ignore what I wrote.

2) On TMK firmware you define a port to be the Caps Lock indicator and connect the LED to this port. Simple like that.
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: user 18 on Mon, 04 January 2016, 00:32:37
Ive been wondering the same thing for the caps lock light. I have a keyset with a caps lock light window that is on the opposite side of the led mounting holes on most PCB's. Im not using most of the LED mounting holes so im trying to find out if i can do something in the firmware to make the LED come on with caps lock.  (or function key if i change it to that) If not im thinking about wiring the led up separately somehow either to the boards own microcontroller or a separate small one.

If I'm interpreting what you want to do correctly, it's a very simple task. Find some thin wire (I've used wire-wrap wire in the past) and solder it to the leads on your LED to extend them. Make sure the wire is long enough to run to where the caps lock LED pads are, and you should be in business. You can mount the LED pretty much wherever you want. I used this technique on my QFR to put the lock LEDs above the 6-key cluster.


Note that with MX switches, if you want an LED on a switch, the LED pretty much needs to be in the mounting holes in the switch, no matter how you have it wired. Trying to get a LED somewhere else under a key would almost definitely interfere with the mounting of the keycap.
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: BradTheGeek on Thu, 07 January 2016, 09:31:54
I recently did this to a model M:

https://geekhack.org/index.php?topic=78428.0

This could work for you.
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: qwack on Thu, 07 January 2016, 12:39:40
1) The biggest problem is handling the electrical current needed to light all LEDs up. USB 2.0 ports can handle only 500mA of current. Given the fact that a typical LED consumes 20mA maximum, you have a problem to light all LEDs of a given keyboard, even a 60%.

True, but as you said 20mA is a maximum value. You don't need to feed LEDs so much current for them to be bright enough. I once measured the total current used by my Pure Pro (60%) with the max (7th) brightness setting, it was less than 250mA -and the LEDs are already blindingly bright at the 4th setting). That's a max of 3.5mA for each LED, so they can all be turned on at the same time without multiplexing.

Vozella, if you want a LED under each key, you will likely need a PCB (unless you are willing to hand wire one LED + resistor for each switch, plus one transistor to drive them). The following post contains more detailed info on how to integrate backlight (hardware + firmware) with TMK: http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-240.html#p240050
Title: Re: I have a few questions about LEDs on custom keyboards.
Post by: Koren on Thu, 07 January 2016, 12:44:22
1) The biggest problem is handling the electrical current needed to light all LEDs up. USB 2.0 ports can handle only 500mA of current. Given the fact that a typical LED consumes 20mA maximum, you have a problem to light all LEDs of a given keyboard, even a 60%.

The common solution is to multiplex the LEDs, so just a fraction at a time are activated for a short period.
Alternatively, you can use fiber optics to dispatch the light of a couple leds to all keys... It can also be easier to bring just a fiber under each key than fitting a led with its power lines.