Page 1 of 1
How do I wire lock LEDs?
Posted: 25 Aug 2020, 20:45
by kelvinhall05
Hi guys. I'm making a replacment PCB for a friend and he wants in-switch lock LEDs to still work. I am planning on using a Teensy 2.0 and normal SKCL lock LEDs which iirc just work on 5v, but as I learned from another PCB I made (my Sharp PA1000H project), it's not as simple as connecting a pin on the Teensy to one of the pins on the LED and the other pin to ground (the pin either outputs 0v or like 1v or something that isn't enough to light up an LED).
I'm wondering if there is a guide somewhere on how I can wire up LEDs. I'll be running QMK on the Teensy if that makes a difference. Thanks!
Re: How do I wire lock LEDs?
Posted: 25 Aug 2020, 20:51
by kelvinhall05
Oh, I found this...can someone confirm this is what I need?
https://geekhack.org/index.php?topic=89021.0
Re: How do I wire lock LEDs?
Posted: 25 Aug 2020, 21:27
by Findecanor
The LED should be connected in series with a limiting resistor. Most LEDs work at 2.5-3 V or so, and ~5V from a Teensy pin is too high.
I think QMK supports the MCU's pin being a steady current source, not a current sink.
I also don't think QMK supports PWM (for limiting the brightness in firmware), but I may be mistaken.
On the ATmega32u4, port B is preferred for driving LEDs.
PB5 and PB6 support PWM using timer 1. PB7 supports PWM using timer 0. If QMK supports PWM then it should have a preferred timer of those two.
A 430Ω limiting resistor should work with many LEDs, yes. But the right way would be to consult your LED's datasheet for which voltage the LED runs best at and choose a resistor from that.
Maybe choose a higher value (but not too high) if you can't use PWM if the LED is very bright. (LEDs suitable for backlighting can be very bright, because they tend to be driven mostly off by PWM)
There are a bunch of "LED calculator" web sites (google for it!) where you can input the LED's values and get the resistor value straight away without having to do maths.
Re: How do I wire lock LEDs?
Posted: 25 Aug 2020, 22:31
by kelvinhall05
Findecanor wrote: 25 Aug 2020, 21:27
The LED should be connected in series with a limiting resistor. Most LEDs work at 2.5-3 V or so, and ~5V from a Teensy pin is too high.
I think QMK supports the MCU's pin being a steady current source, not a current sink.
I also don't think QMK supports PWM (for limiting the brightness in firmware), but I may be mistaken.
On the ATmega32u4, port B is preferred for driving LEDs.
PB5 and PB6 support PWM using timer 1. PB7 supports PWM using timer 0. If QMK supports PWM then it should have a preferred timer of those two.
A 430Ω limiting resistor should work with many LEDs, yes. But the right way would be to consult your LED's datasheet for which voltage the LED runs best at and choose a resistor from that.
Maybe choose a higher value (but not too high) if you can't use PWM if the LED is very bright. (LEDs suitable for backlighting can be very bright, because they tend to be driven mostly off by PWM)
There are a bunch of "LED calculator" web sites (google for it!) where you can input the LED's values and get the resistor value straight away without having to do maths.
So I actually tried the thing on the GH post I linked and it works.
https://photos.app.goo.gl/GmYobPW7ir7tUEwA6
So now I know how to do it and also I can have the capslock led on my Sharp working. Thanks!