Probably a stupid question about adding an LED

User avatar
fohat
Elder Messenger

27 Sep 2016, 02:40

I want to add an LED to a keyboard (a Model F 122-key, but the question is probably general) with an internal Teensy.

This is not to be an "indicator" but rather an actual small white light on a stalk or a wire. I would like to control it with a locking switch (I have a couple of them from AEKs "CapsLocks"). If it makes the task easier, I have NumLock "on" all the time and if it is easier to piggy-back on a connection for that, it would be acceptable.

Otherwise, could I take 2 leads from "5v" and "GND" on the Teensy, or would the light disturb the operation of the Teensy?

Would resistors be needed in the LED circuit? Which side?

I realize that this is probably elementary circuits but I just don't know them.

Thanks

User avatar
Ir0n

27 Sep 2016, 03:24

I was thinking of doing something like this to my IBM AT to restore the lock LEDs back from where I destroyed the LED board.

I got busy right when I was starting to look into it and never got around to it.

If you do happen to start would you mind posting some photos and stuff of your work? It could help me when I eventually start. Good luck!

Vizir

27 Sep 2016, 03:31

you will find this very useful https://www.pjrc.com/teensy/tutorial2.html

basically, connect the LED to any pin and Gnd. But you WILL need a resistor between the pin and LED. the pin could be any which you can control in code including the numlock pin. the resistor value depends on the LED you are using and its characteristics.

Arakula

27 Sep 2016, 07:44

Here's a picture from the documentation of Soarer's Converter, originally from ladyada.net (also a nice tutorial behind the link):
LED_circuit.jpg
LED_circuit.jpg (7.44 KiB) Viewed 1607 times
... that's about it if you want a 5V LED attached to the Teensy's 5V (constantly lit) or a data pin.

1K is a good resistor value for most 5V LEDs; but if you want to "tune" it to the others, I'd recommend a 2K .. 10K trim potentiometer instead (just make sure it's set to roughly 1K before you power up the circuit, then play with the trimmer, just don't let it go below ~100 Ohm; for absolute safety wire it serially to a 100 Ohm resistor, then you can turn it down all the way).

If you got a specific LED and know its values, google for "LED resistor calculator" to get some nice online calculators for the required minimum resistor value.

User avatar
chzel

27 Sep 2016, 08:54

Fohat needs a light to illuminate the keyboard (if I understand it correctly), so a transistor or mosfet will be needed, controlled by the teensy output. I'm on the phone now, can't really add details...

User avatar
fohat
Elder Messenger

27 Sep 2016, 14:20

Vizir wrote:
you will find this very useful https://www.pjrc.com/teensy/tutorial2.html

basically, connect the LED to any pin and Gnd. But you WILL need a resistor between the pin and LED. the pin could be any which you can control in code including the numlock pin. the resistor value depends on the LED you are using and its characteristics.
Thank you, that is exactly what I needed. I had forgotten to check the pjrc info.

The light will be for "utility" purposes, perhaps to illuminate the keyboard, maybe not. Ideally I would like a white light, brighter than a mere "indicator" but not blinding, so I may have to experiment with resistor values.

Vizir

27 Sep 2016, 14:33

Are you trying to replicate the LED in the screen frame of old IBM Thinkpads? It used to be angled down to light up the keyboard to help when working in the dark.

Sent from my Nexus 6P using Tapatalk

Post Reply

Return to “Workshop”