Wiring Up Lock Key LEDS to a Teensey

Davsmith4

28 Jun 2015, 06:19

Hello,
Long time lurker to the forum and im about to build my first keyboard and the one thing I cant find is how to properly connect the three lock key, caps scroll and num, leds to the teensy 2.0 so i can program the avr controller to turn the light on and off when the corresponding keys are activated and turn off when they are deactivated.

User avatar
Redmaus
Gotta start somewhere

28 Jun 2015, 06:31

Bump

Davsmith4

28 Jun 2015, 06:47

Redmaus wrote: Bump
Sorry did I post in the wrong thread? If I did I will delete this and repost in the appropriate one. Sorry im new here :P

User avatar
kbdfr
The Tiproman

28 Jun 2015, 07:17

Redmaus wrote: Bump
Bumping a thread 12 minutes after it was created? Not sure I really get the sense of it :evil:
Davsmith4 wrote: […] Sorry did I post in the wrong thread? If I did I will delete this and repost in the appropriate one. Sorry im new here :P
No, you're perfectly right. Good luck with your question (which I unfortunately cannot answer)
and welcome to DT :D

User avatar
flabbergast

28 Jun 2015, 07:54

The easiest way is wiring like this: <pin on teensy> --- LED anode (+) - LED cathode (-) --- resistor --- ground.

The pin on teensy should no be used for anything else (so you'll need a free teensy pin for each LED). Resistor needs to limit the current through LED to that it doesn't take more than 10mA, and altogether all LEDs should take at most cca 50mA (there's a low limit because this way the LEDs take the current from the teensy, through the microcontroller).

This way, the LED lights up when the pin is taken high, and is off when the pin is low. Of course you can put the resistor between the pin and the LED instead; or you can reverse the LED and end in VCC (5V). (That way you can actually let a bit more current through, cca 15mA). For the resistor/current calculations, you can use this.

There are other ways which can be used if you want to power the LEDs directly from the USB current, or if you need to control more LEDs than free teensy pins. But wiring this way is the easiest if you need only a few LEDs.

From the point of the view of the firmware, all it needs to know is to which pin the LED is wired. This is certainly configurable in TMK; I haven't tried other firmwares yet.

Davsmith4

29 Jun 2015, 03:58

flabbergast wrote: The easiest way is wiring like this: <pin on teensy> --- LED anode (+) - LED cathode (-) --- resistor --- ground.

The pin on teensy should no be used for anything else (so you'll need a free teensy pin for each LED). Resistor needs to limit the current through LED to that it doesn't take more than 10mA, and altogether all LEDs should take at most cca 50mA (there's a low limit because this way the LEDs take the current from the teensy, through the microcontroller).

This way, the LED lights up when the pin is taken high, and is off when the pin is low. Of course you can put the resistor between the pin and the LED instead; or you can reverse the LED and end in VCC (5V). (That way you can actually let a bit more current through, cca 15mA). For the resistor/current calculations, you can use this.

There are other ways which can be used if you want to power the LEDs directly from the USB current, or if you need to control more LEDs than free teensy pins. But wiring this way is the easiest if you need only a few LEDs.

From the point of the view of the firmware, all it needs to know is to which pin the LED is wired. This is certainly configurable in TMK; I haven't tried other firmwares yet.

Ok thanks for the answer! Just two thing I want to ask:
1. For a 104 key keyboard will I need a tensey ++ to fit all the leds? I only ask because I would like to order it asap but if you dont know i can wire it up and figure it out myself.
2. Do you know of a a build where someone has done this? Just so i can visualize it?

User avatar
flabbergast

29 Jun 2015, 08:24

Davsmith4 wrote: Ok thanks for the answer! Just two thing I want to ask:
1. For a 104 key keyboard will I need a tensey ++ to fit all the leds? I only ask because I would like to order it asap but if you dont know i can wire it up and figure it out myself.
2. Do you know of a a build where someone has done this? Just so i can visualize it?
Yes, you'll need teensy++ for a full-size keyboard. You'll need at least rows+columns+leds free pins on the controller and even rows+cols is already 27.

I haven't seen pics of wiring a full-size keyboard yet - but maybe some gurus here have.

User avatar
Nephiel

29 Jun 2015, 17:38

You can reduce the number of pins needed if you don't mind rewiring the matrix in a different way. E.g. for a 104-key you could use a matrix of 13x8=104, which uses only 13+8=21 controller pins.

The closer to a square, the more keys you can have; e.g. a matrix of 10x11 allows 110 keys using the same 21 pins.

The Teensy 2.0 has up to 25 i/o pins so in theory you could have a maximum of 110 keys + 4 status LEDs, but it won't be as easy to wire.

Post Reply

Return to “Keyboards”