Author Topic: [Q] How do i light up all 90 leds for backlight with QMK firmware?  (Read 3872 times)

0 Members and 1 Guest are viewing this topic.

Offline marhalloweenvt

  • Thread Starter
  • Posts: 20
  • Location: Viet Nam
I want to make my own keyboard with a teensy controller with supported of QMK firmware. My problem is how i can light up all 90 leds for backlight? Because a pinout of teensy just around 10mA current. It can't light up a single led? Which component do i need to amplify the current? Anyone can help me with this problem?
I am really appreciate your support

Offline senso

  • Posts: 47
  • Location: Portugal
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #1 on: Thu, 05 April 2018, 08:23:55 »
An N-Channle Mosfet, and a regular led at 1mA will blind you, much less at 10mA, and beware that you can't draw over 500mA from a single USB port, so, at 90 leds, you shouldn't really be driving then at more than 2-3mA or you might get random disconnects.

Offline marhalloweenvt

  • Thread Starter
  • Posts: 20
  • Location: Viet Nam
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #2 on: Thu, 05 April 2018, 21:30:16 »
An N-Channle Mosfet, and a regular led at 1mA will blind you, much less at 10mA, and beware that you can't draw over 500mA from a single USB port, so, at 90 leds, you shouldn't really be driving then at more than 2-3mA or you might get random disconnects.

Thanks for your support. But i wonder how i can make a led light up with 1mA. I think a regular led needs 20mA to light up. Am i wrong?

Offline vvp

  • Posts: 886
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #3 on: Fri, 06 April 2018, 04:23:14 »
20 mA is just the (common) maximum current. You can use less.

Offline senso

  • Posts: 47
  • Location: Portugal
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #4 on: Fri, 06 April 2018, 05:26:49 »
To limit the current you use a resistor, you input voltage is 5v, from the USB.

Then there is the Vdrop, that depends on the led colour, for specific values, use the led datasheet, for general guidelines, check this:

https://s17.postimg.org/f2xi7qobj/FW2_IC04_I7_VQP2_EC.LARGE.jpg

Lets say you choose red leds, so thats a usual 2.1v Vdrop(called forward voltage on the table), to calculate the resistor value for EACH led you do it this way:

R = (Vbus - Vdrop)/Desired current(in Amps).

2mA = 0.002A
Vbus = 5v
Vdrop = 2.1v

R = (5-2.1)/0.002 = 1450 Ohms

Grab the E24 resistor values:

http://www.ohmslawcalculator.com/e24-resistor-sizes

The nearest value is 1500Ohms(1.5K), so you use a 1.5k resitor for each led.

Now to know what size(Watt) the resistor needs to be you calculate the dissipated power in the resistor using this formula:

P = R * I * I

R = 1500 Ohms
I = 0.002 Amps

P = 0.006Watts, or 6mW

So a 1/8 Watt resistor is more than enough.

And the mosfet should be a logic level one, so that it is fully on with just the 5v that the Teensy puts out on its pins, like this one:

https://eu.mouser.com/ProductDetail/ON-Semiconductor-Fairchild/FQP13N06L?qs=sGAEpiMZZMshyDBzk1%2fWi9bHELEahoDn5O7IxOXNvZs%3d

Or a bit smaller:

https://eu.mouser.com/ProductDetail/ON-Semiconductor-Fairchild/FQU13N10LTU?qs=sGAEpiMZZMshyDBzk1%2fWi1oKJWRB0GXw0%252bteEXgHDc8%3d

Or any from this search:

https://eu.mouser.com/Semiconductors/Discrete-Semiconductors/Transistors/MOSFET/_/N-ax1sf?P=1z0y3zrZscv7Z1z0z63x&Keyword=logic+level+mosfet&Ns=Pricing%7c0&FS=True

Any doubts, just ask :)

Offline marhalloweenvt

  • Thread Starter
  • Posts: 20
  • Location: Viet Nam
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #5 on: Sun, 08 April 2018, 01:52:47 »
20 mA is just the (common) maximum current. You can use less.

Thanks for your advice.

To limit the current you use a resistor, you input voltage is 5v, from the USB.

Then there is the Vdrop, that depends on the led colour, for specific values, use the led datasheet, for general guidelines, check this:

https://s17.postimg.org/f2xi7qobj/FW2_IC04_I7_VQP2_EC.LARGE.jpg

Lets say you choose red leds, so thats a usual 2.1v Vdrop(called forward voltage on the table), to calculate the resistor value for EACH led you do it this way:

R = (Vbus - Vdrop)/Desired current(in Amps).

2mA = 0.002A
Vbus = 5v
Vdrop = 2.1v

R = (5-2.1)/0.002 = 1450 Ohms

Grab the E24 resistor values:

http://www.ohmslawcalculator.com/e24-resistor-sizes

The nearest value is 1500Ohms(1.5K), so you use a 1.5k resitor for each led.

Now to know what size(Watt) the resistor needs to be you calculate the dissipated power in the resistor using this formula:

P = R * I * I

R = 1500 Ohms
I = 0.002 Amps

P = 0.006Watts, or 6mW

So a 1/8 Watt resistor is more than enough.

And the mosfet should be a logic level one, so that it is fully on with just the 5v that the Teensy puts out on its pins, like this one:

https://eu.mouser.com/ProductDetail/ON-Semiconductor-Fairchild/FQP13N06L?qs=sGAEpiMZZMshyDBzk1%2fWi9bHELEahoDn5O7IxOXNvZs%3d

Or a bit smaller:

https://eu.mouser.com/ProductDetail/ON-Semiconductor-Fairchild/FQU13N10LTU?qs=sGAEpiMZZMshyDBzk1%2fWi1oKJWRB0GXw0%252bteEXgHDc8%3d

Or any from this search:

https://eu.mouser.com/Semiconductors/Discrete-Semiconductors/Transistors/MOSFET/_/N-ax1sf?P=1z0y3zrZscv7Z1z0z63x&Keyword=logic+level+mosfet&Ns=Pricing%7c0&FS=True

Any doubts, just ask :)

Thank you very much. You have save me a tons of research. You are my hero. In my country, it's easy to find a SI2308. Is it ok for my project?
« Last Edit: Sun, 08 April 2018, 02:00:18 by marhalloweenvt »

Offline senso

  • Posts: 47
  • Location: Portugal
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #6 on: Mon, 09 April 2018, 06:00:41 »
If you can solder it, its OK to use, the RDSon at 4.5v on the gate and a load of 1.7A is per the datasheet worst case 0.192 Ohm's, if you plan on running the leds at 2mA each and you have 90 leds, thats 180mA.

Again calculating the power using the resistance of the mosfet(the RDSon value) we get:

P = 0.192 * .180 * .180 = 6mW, the MOSFET will have no problem dissipating much more than that, expect a bit of a voltage drop across the mosfet as well(R = U/I so U = RI, so U = .192*.180 = 34mV).

So, the MOSFET is more than capable of turning on and off your leds at 2mA per led(it can handle a lot more in fact, and you are USB power limited long before you overheat your MOSFET).

Offline marhalloweenvt

  • Thread Starter
  • Posts: 20
  • Location: Viet Nam
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #7 on: Tue, 10 April 2018, 05:43:30 »
If you can solder it, its OK to use, the RDSon at 4.5v on the gate and a load of 1.7A is per the datasheet worst case 0.192 Ohm's, if you plan on running the leds at 2mA each and you have 90 leds, thats 180mA.

Again calculating the power using the resistance of the mosfet(the RDSon value) we get:

P = 0.192 * .180 * .180 = 6mW, the MOSFET will have no problem dissipating much more than that, expect a bit of a voltage drop across the mosfet as well(R = U/I so U = RI, so U = .192*.180 = 34mV).

So, the MOSFET is more than capable of turning on and off your leds at 2mA per led(it can handle a lot more in fact, and you are USB power limited long before you overheat your MOSFET).

Sorry for the dumb question but how do you can point out the number 0.192 Ohm's. Because in this datasheet, i just can see this: VGS=4.5V,ID=2.8A, TYP=65mA, max=80mA
Thank you again for everything you've done. They really mean alot to me

Offline senso

  • Posts: 47
  • Location: Portugal
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #8 on: Tue, 10 April 2018, 11:05:58 »
This datasheet:

https://www.vishay.com/docs/70797/70797.pdf

And I used the wrong values (read the wrong datasheet, sorry) :'(

Drain-Source On-State Resistancea RDS(on)
VGS = 10 V, ID = 2.0A Typical: 0.125 Max: 0.16
VGS = 4.5 V, ID = 1.7A Typical 0.155 Max:0.22

Still, very close numbers .196 vs .22 is just a smidge, still plenty capable.

Offline marhalloweenvt

  • Thread Starter
  • Posts: 20
  • Location: Viet Nam
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #9 on: Tue, 10 April 2018, 20:45:02 »
This datasheet:

https://www.vishay.com/docs/70797/70797.pdf

And I used the wrong values (read the wrong datasheet, sorry) :'(

Drain-Source On-State Resistancea RDS(on)
VGS = 10 V, ID = 2.0A Typical: 0.125 Max: 0.16
VGS = 4.5 V, ID = 1.7A Typical 0.155 Max:0.22

Still, very close numbers .196 vs .22 is just a smidge, still plenty capable.
I see. I use this database instead http://www.sipusemi.com/pdf/si2308ds.pdf.
Thanks for your kindly support

Offline senso

  • Posts: 47
  • Location: Portugal
Re: [Q] How do i light up all 90 leds for backlight with QMK firmware?
« Reply #10 on: Wed, 11 April 2018, 03:33:10 »
It will work as expected, wont heat at all with the load of the leds  :thumb: