basic backlight
- DiodeHead
- Location: Spain
- Favorite switch: Gateron white
- DT Pro Member: -
hi guys, I need I little help with a topic that would be very basic to some. I have a project in mind and it involves backlight, it has 50 keys each one with it's corresponding led, as features I only want to control brightness.
this is how I would do it, but I don't know if this method is correct or even possible. this is a simplification and the schematic would have the 50 LEDs. I'll be using 3mm bright white LEDs, I'll try to find out their forward voltage.
and what transistor to choose is another question, since MCU pins usually have a 20ma - 40ma I think this is the way to drive the LEDs, but I don't know if the 5v USB rail has enough juice to drive all those LEDs, 200ma was the maximum current??
thanks in advance
this is how I would do it, but I don't know if this method is correct or even possible. this is a simplification and the schematic would have the 50 LEDs. I'll be using 3mm bright white LEDs, I'll try to find out their forward voltage.
and what transistor to choose is another question, since MCU pins usually have a 20ma - 40ma I think this is the way to drive the LEDs, but I don't know if the 5v USB rail has enough juice to drive all those LEDs, 200ma was the maximum current??
thanks in advance
-
- Location: UK
- Main keyboard: Planck
- Main mouse: Cyborg Rat 7
- Favorite switch: Alps skcm white
- DT Pro Member: -
hmm i think your idea is mostly correct, however i think you will be wanting to run all the LEDs in paralel ideally each LED would also have its own resistor, however if the current is low enough then the number of resistors may be reduced. I have recently put side lighting onto my handwired build at first it was 10x2 so 10 lots of 2 paralel and the current was in micro amps with no resistor at all and the LEDs barely glowed, after it was wireing all 20 in paralel and now they glow fine, still need to fine tune the final resistor value to get the balance of brightness to curent but it will do for now. Also I think you might need a resistor between the MCU_PWM and the transistor also depending on your transistor.
- vvp
- Main keyboard: Katy/K84CS
- Main mouse: symetric 5-buttons + wheel
- Favorite switch: Cherry MX
- DT Pro Member: -
@DiodeHead
You nay want to read this post. It will give you some hints how to do it.
You will need the resistor Anakey mentions if you would use some bipolar transistor. If you would use some FET then there is no need for the resistor.
You nay want to read this post. It will give you some hints how to do it.
You will need the resistor Anakey mentions if you would use some bipolar transistor. If you would use some FET then there is no need for the resistor.
-
- Location: Melbourne
- DT Pro Member: -
you cant run that many LEDs is series like that with a 5V supply.
this will help you with the power requirements:
http://led.linear1.org/led.wiz
this will help you with the power requirements:
http://led.linear1.org/led.wiz
- DiodeHead
- Location: Spain
- Favorite switch: Gateron white
- DT Pro Member: -
well, the one's that I have are 2.8v forward voltage, I guess that they should be as Anakey said, all in parallel with their individual resistors.
If I put one on my bench power supply they get very nice and bright with 3v and 0.01amps so in the program that zool recommended I wrote:
5: Source voltage
3: diode forward voltage
2: diode forward current (mA) Help
50: number of LEDs in your array
this gave me an individual resistor of 1k and a total consumption of 100ma, which I have to test and see if I did make any mistake in the calculations, but this configuration should give me a very bright backlight that I would be toning down with the PWM.
thanks a lot for the help.
If I put one on my bench power supply they get very nice and bright with 3v and 0.01amps so in the program that zool recommended I wrote:
5: Source voltage
3: diode forward voltage
2: diode forward current (mA) Help
50: number of LEDs in your array
this gave me an individual resistor of 1k and a total consumption of 100ma, which I have to test and see if I did make any mistake in the calculations, but this configuration should give me a very bright backlight that I would be toning down with the PWM.
thanks a lot for the help.
-
- Location: UK
- Main keyboard: Planck
- Main mouse: Cyborg Rat 7
- Favorite switch: Alps skcm white
- DT Pro Member: -
you would probably need to reduce the current to below 10mA anyway, as 10mA x 50 LEDs = 500mA which is going to potentially overload the PC USB controller as most do not like going over 500mA for the USB.
- DiodeHead
- Location: Spain
- Favorite switch: Gateron white
- DT Pro Member: -
hmmm then is settle the 470 ohms resistor it is, I'll then end up with a total current of 250ma + MCU.
For transistors, I have to order some 337 (that is what I'm seeing in most Arduino tutorials with a 2k2 resistor) since all I have on hand right now is 2n3906 and those are rated for 200ma if I'm not mistaken reading the datasheet. but at least I would like to code the PWM part, can I use a 2k2 resistor with this transistor too? how can I calculate that resistor?
thanks
For transistors, I have to order some 337 (that is what I'm seeing in most Arduino tutorials with a 2k2 resistor) since all I have on hand right now is 2n3906 and those are rated for 200ma if I'm not mistaken reading the datasheet. but at least I would like to code the PWM part, can I use a 2k2 resistor with this transistor too? how can I calculate that resistor?
thanks
- DiodeHead
- Location: Spain
- Favorite switch: Gateron white
- DT Pro Member: -
you're right, but I wanted to do it with the transistor to see what problems I would encounter and found out, they are little fragile creatures, I'm also making a tube amp and tubes support much more abuse, I already have burnt two of them (transistors), but the third one is hanging in there.
My question was if there's some kind of rule of thumb for knowing if I would need a resistor to drive it ( for example you guys told me if its a fet I don't need it) and if need the resistor how to calculate (for example, look for this in the datasheet and apply ohms law knowing that your pin supports around 20-40ma)
But maybe this is too broad of a question, anyways this weekend with more time I´ll try to read on transistors since as you can see my knowledge is very basic
My question was if there's some kind of rule of thumb for knowing if I would need a resistor to drive it ( for example you guys told me if its a fet I don't need it) and if need the resistor how to calculate (for example, look for this in the datasheet and apply ohms law knowing that your pin supports around 20-40ma)
But maybe this is too broad of a question, anyways this weekend with more time I´ll try to read on transistors since as you can see my knowledge is very basic
- vvp
- Main keyboard: Katy/K84CS
- Main mouse: symetric 5-buttons + wheel
- Favorite switch: Cherry MX
- DT Pro Member: -
You need a transistor when the LEDs powered by by an MCU pin need more current than one MCU pin can provide.
Typically, an MCU pin current rating is at most about 20 mA. E.g. if your LED would use 5 mA forward current then you can put at most 4 such LED in parallel at one MCU pin without a transistor. Also notice that most MCUs have maximum limit for current from all the MCU pins together. This can be e.g. around 120 mA (some STM32 models). In such a case you can have at most 5-6 pins powering LED directly (while each pin is limited to at most 20 mA). It is also common that some MCU pins have smaller current rating than others. Read the data sheet for your MCU of choice.
If you insist on a bipolar transistor then you need to consider, current amplification of the transistor α (often around 100), and forward base-emitor voltage drop Vbe (often around 0.6V). Then you can compute your base resistor Rb:
Rb = (Vcc - Vbe) / Ib
Ib = Iled / α
Ib - current through base (must be less than maximum MCU current rating)
Iled - required current to power LEDs
Vcc - power voltage of the MCU
Just use a FET a be done with it. Prefer FETs with enough source current rating and small gate-source capacitance. Use PWM at about 10 kHz or lower frequency and you can connect your MCU pin directly to the FET gate.
Typically, an MCU pin current rating is at most about 20 mA. E.g. if your LED would use 5 mA forward current then you can put at most 4 such LED in parallel at one MCU pin without a transistor. Also notice that most MCUs have maximum limit for current from all the MCU pins together. This can be e.g. around 120 mA (some STM32 models). In such a case you can have at most 5-6 pins powering LED directly (while each pin is limited to at most 20 mA). It is also common that some MCU pins have smaller current rating than others. Read the data sheet for your MCU of choice.
If you insist on a bipolar transistor then you need to consider, current amplification of the transistor α (often around 100), and forward base-emitor voltage drop Vbe (often around 0.6V). Then you can compute your base resistor Rb:
Rb = (Vcc - Vbe) / Ib
Ib = Iled / α
Ib - current through base (must be less than maximum MCU current rating)
Iled - required current to power LEDs
Vcc - power voltage of the MCU
Just use a FET a be done with it. Prefer FETs with enough source current rating and small gate-source capacitance. Use PWM at about 10 kHz or lower frequency and you can connect your MCU pin directly to the FET gate.