# LED driver: how to choose current and voltage?

In my project I have a microcontroller which has to light 3 groups of LED. Group A has 3 LED, Group B has 2 LED, Group C has 1 LED. There are all the same LED. In each group the LED are in series.

Let's consider group A : VCC is obtained from a positive voltage regulator. The lighting of the group is controlled by an MOSFET which acts as a switch. The microcontroller is driving this transistor open or close.

I have never done this before so I have questions :

• How do I know which voltage I have to appply with the regulator for each group? Is it the sum of each forward voltage ? Let's consider each LED has a forward voltage of 3 V. I would then need to apply 9 V, 6 V and 3 V?
• Do I need a series resistor in each group?
• How do I know the current which will be drawn by the LED in each group? How do I set the current to 1 A in each group for example?
• I think you need to propose a schematic diagramatically to make sense of what you are trying to say. – Andy aka Dec 4 '19 at 16:11
• it is just a diode. if you have a 5V rail/source and the led has a 2.1v drop and a max current of 20ma then 5-2.1 = 2.9 volts across the resistor V = IR 2.9 = 0.02*r greater or equal to 145 ohms. its no more complicated than that, just work the larger circuit. – old_timer Dec 4 '19 at 23:15
• If you share the resistor to a group and some leds are lit and some arent, then it will be uneven. three lit into one resistor drops one amount of current across the resistor causing the voltage division to go one, way but two lit changes that. one, two, three will have a different brightness from the same voltage source, so it will look funny/bad. that is for them in parallel, – old_timer Dec 4 '19 at 23:16
• in series then certainly not you only need one resistor. three diodes do the math, figure out the voltage across the resistor for some current (same current flows in series through everything in that series) and V = IR. Pick the minimum resistor for that current then make it larger. – old_timer Dec 4 '19 at 23:18
• the brighness is not linear and if you are pulsing them (did you ask another question on this topic recently?) then the brightness gets even more interesting (less linear). But worst case is worst case voltage rail through the diodes and you want to not exceed the maximum current. – old_timer Dec 4 '19 at 23:19

## 2 Answers

A schematic would definitely help. In general, LEDs don't regulate the current themselves, so you'll need a way to bias them. Most simply this is done with a series resistor. For instance in your group A with 3 LEDs and 3V forward drop across them, would give 9V across the LEDs as you mention. You'll need the regulated voltage to be greater than that, let's say 10V for starters. This would give 1V drop across the series resistor. Choose the value of resistance to set the current.

The higher the voltage used, the less susceptible the circuit is to differences in component parameters, but will dissipate more power. With that in mind, you'll have ensure that all parts meet the power requirements as you mention 1A through the LEDs, which is quite a lot using this method. With that amount of current, maybe consider using an LED driver chip.

• You need a power supply that's high enough to run 3 LEDs in series, with a bit of headroom, or in other words, 3 times the voltage of one LED. Different color LEDs run at different voltages, so your supply might be 9V or 12V. Or use separate power supplies for the 1 and 2 LED strings, and choose lower value resistors to suit.
• Yes, you need resistors, and different ones for each group. Given the 1A current you want, these need to be high power resistors.
• You calculate it, and choose the correct resistor.

To calculate the resistor, take the total LED voltage of the series string, and subtract that from the supply voltage. Divide the result by the current you want to give the resistance. For example, if you have 3 x 3V LEDs, on a 12V supply and you want 1A, then it's (12 - (3 x 3) / 1) = 3 ohms. For 2 x 2.2V LEDs on the same supply, it would be (12 - (2 x 2.2) / 1) = 7.6 ohms.

In the second example, the power dissipated in the resistor is substantial. It would be 7.6W, so you'd need a 10W resistor with adequate ventilation.