Handwiring LEDs

HeroXLazer

21 Jan 2017, 04:08

I want to use a Teensy 2.0, 38 switches and 38 LEDs. What LEDs (based on current, beccause of the 500 ma limit on USB) should I use for through switch and how would I wire the LEDs? I want to also use white or gold LEDs. Also should I use a separate controller>
Last edited by HeroXLazer on 05 Apr 2017, 06:08, edited 2 times in total.

User avatar
Ray

21 Jan 2017, 10:32

To give you some ideas:
What is a 1000 mah limit on USB, how does it relate to current?

38 switches => at least 6+7 pins for keyboard matrix

I assume the LEDs belong to a switch each. Do you need them individually adressable, or just everything on?
In case of individual adressing, you need at least 7 pins for charlyplexing, 13 for matrix-multiplexing is more sane though. Better even, offload the driving of the LEDs to a separate controller>

User avatar
Wodan
ISO Advocate

21 Jan 2017, 12:02

LOL please do your homework HeroXLaser.

There is no 1000mAh limit on USB. Where did you get this? mAh is a CAPACITY and not a CURRENT.

The number 1000mA is super random, too! If there is any universal value for USB, it is 500mA!
Only USB 3.0 and up supports higher current draw (900mA, 1.5A or even 3A) ...

User avatar
matt3o
-[°_°]-

21 Jan 2017, 13:04

he used wrong nomenclature but the concept if perfectly understandable. why attack the poor guy :D

The limit on a standard USB is 500mA, which is really low for a full backlit keyboard, you should check how to PWM-drive them. I don't feel you need a dedicated controller if you don't want 1:1 granularity (ie: you want to control on each individual LED).

Matt_

21 Jan 2017, 14:55

HeroXLazer wrote: how would I wire the LEDs?
Depends on how you want to drive them software-wise, in other words how you want to control them and which firmware you use. If you use TMK or another variant, you can wire your LEDs in parallel, with a resistor in series with each LED. There's a good explanation by flabbergast here: workshop-f7/how-to-build-your-very-own- ... ml#p240050

You can use any LED (either 3mm flangeless or 1.8mm), choose the resistor value in relation to the max brightness you want, see Ohm's law. I think something like 5 mA per LED is already super bright, you don't have to go all the way to 20 mA (which is what most of them are rated to). Then use software PWM to dim your LEDs from there and set different levels of brightness.

With PWM, you can let your LEDs be blindingly bright and still stay under the 500mA threshold (for instance my Pure Pro with ~65 switches draws 220 mA with the backlight at full brightness, which in uncomfortably bright; I use it at a lower setting, where it only draws 44 mA and the backlight is strong enough).

If this is your first time working with LEDs, I strongly suggest you get a breadboard, a handful of LEDs and resistors and play a bit with them to understand how to wire & drive them.

User avatar
Ratfink

21 Jan 2017, 16:17

matt3o wrote: The limit on a standard USB is 500mA
Only after you ask for it! For USB 2.0, the limit is 100 mA, but you can ask for up to 500 mA and may or may not be able to get it. For example, if your keyboard is connected through an unpowered hub, it couldn't get more than 100 mA. :geek:
Wodan wrote: mAh is a CAPACITY and not a CURRENT.
Actually, it's an electric charge. :ugeek:

HeroXLazer

21 Jan 2017, 18:44

Wodan wrote: LOL please do your homework HeroXLaser.

There is no 1000mAh limit on USB. Where did you get this? mAh is a CAPACITY and not a CURRENT.

The number 1000mA is super random, too! If there is any universal value for USB, it is 500mA!
Only USB 3.0 and up supports higher current draw (900mA, 1.5A or even 3A) ...
Yes, sorry, I've been really confused with this, so I got confused with those two.

HeroXLazer

21 Jan 2017, 18:51

matt3o wrote: he used wrong nomenclature but the concept if perfectly understandable. why attack the poor guy :D

The limit on a standard USB is 500mA, which is really low for a full backlit keyboard, you should check how to PWM-drive them. I don't feel you need a dedicated controller if you don't want 1:1 granularity (ie: you want to control on each individual LED).
Do you have any recommendations for LEDs? I don't need to be able to control each LEDs, I just want to be able to change the levels of brightness of all the LEDs at once.

User avatar
Ray

21 Jan 2017, 22:47

You probably choose the colour and formfactor yourself, after that choose an efficient one, so you don't need too much power to drive them.

As for wiring: a PWM output will drive a mosfet, through which you can supply enough current for all the leds. You will probably pair each led with a resistor to get the right current. For leds with low forward voltage you could pair a resistor with two leds (depends mostly on colour; if you go for white, you can't).
Choose the resistors for your maximum brightness, the dimming will be done with PWM. You don't need a lot of light per led, so depending on the leds you choose a single digit mA will be around the value you are looking for.

PS: you should probably start with some easier stuff. Drive a single led first, figure out how bright you want it, scale from there.
From your questions we can see you don't have a good clue about what to do. You will learn by mistakes, but you don't need dozens of errors at once at the start (which you will get for a project that scale you are looking for), so get a tutorial online, work with that, get a grasp, take it to the direction you want to go, and only after that start the complex thing.

HeroXLazer

21 Jan 2017, 23:55

Ray wrote: You probably choose the colour and formfactor yourself, after that choose an efficient one, so you don't need too much power to drive them.

As for wiring: a PWM output will drive a mosfet, through which you can supply enough current for all the leds. You will probably pair each led with a resistor to get the right current. For leds with low forward voltage you could pair a resistor with two leds (depends mostly on colour; if you go for white, you can't).
Choose the resistors for your maximum brightness, the dimming will be done with PWM. You don't need a lot of light per led, so depending on the leds you choose a single digit mA will be around the value you are looking for.

PS: you should probably start with some easier stuff. Drive a single led first, figure out how bright you want it, scale from there.
From your questions we can see you don't have a good clue about what to do. You will learn by mistakes, but you don't need dozens of errors at once at the start (which you will get for a project that scale you are looking for), so get a tutorial online, work with that, get a grasp, take it to the direction you want to go, and only after that start the complex thing.
Yeah. Any tutorials for the LEDs?

User avatar
matt3o
-[°_°]-

22 Jan 2017, 00:05

just get any rectangular 3x2 LED.

I remember someone posting a modified TMK firmware here supporting PWM backlighting. Give me some time and I'll find it back.

User avatar
Ray

22 Jan 2017, 04:27

HeroXLazer wrote: Yeah. Any tutorials for the LEDs?
every journey starts with the first step.

http://lmgtfy.com/?q=led+microcontroller+tutorial

User avatar
matt3o
-[°_°]-

22 Jan 2017, 08:58


HeroXLazer

25 Jan 2017, 06:07

I'm still really confused with the wiring and hardware, not the software.

Matt_

25 Jan 2017, 13:50

See above:
Matt_ wrote: you can wire your LEDs in parallel, with a resistor in series with each LED. There's a good explanation by flabbergast here: workshop-f7/how-to-build-your-very-own- ... ml#p240050
Or Ray's link.

HeroXLazer

27 Jan 2017, 02:52

I'm still confused. I am wondering if I need a separate controller if I want each LED to be controllable. Can anyone give me a simple explanation. I am so sorry for bugging all of you guys. :)

User avatar
matt3o
-[°_°]-

27 Jan 2017, 09:26

yes, if you want 1-to-1 control over the LEDs you need an additional controller (possibly even 2 of them) speaking I2C with the IC. I believe you should start with something simpler :)

HeroXLazer

27 Jan 2017, 15:25

BLANK
Last edited by HeroXLazer on 05 Apr 2017, 06:10, edited 1 time in total.

HeroXLazer

09 Feb 2017, 06:09

matt3o wrote: yes, if you want 1-to-1 control over the LEDs you need an additional controller (possibly even 2 of them) speaking I2C with the IC. I believe you should start with something simpler :)
Okay, I'll just do all of them at once. What else do I need except for resistors and LEDs? Do I need a transistor?

Post Reply

Return to “Keyboards”