Current generator for LED

The following is a description of a very simple yet well-functioning current generator that I designed specifically to drive LEDs. It’s important to note that I wish this article to be thought-provoking, that you can achieve good results with simple tools. So you’ll get some more theoretical explanation and calculation, but don’t be afraid, the operation is easily understandable for those who have some knowledge in electronics...

I got the idea of the circuit diagram from my previous article, where I used LM317 stabilizing ICs to generate the current. The problem with this – as many of you noted – is that it warms heavily and it’s not designed to generate impulse. So I decided to build a switch-mode current generator that meets today’s expectations. This means that it doesn’t heat and converts voltage with high efficiency. I browsed through ICs that were specifically designed to drive LEDs and I sadly found that the manufacturers don’t have in mind those who do electronics as a hobby. This means that there is no proper LED driver IC, only in an SMD case. I’m not really willing to plant SMD. This is how I came to the decision that I’m going to use a cheap and easily available dc-dc switch converter as a current generator. Although these were not designed to generate current, but for easier tasks, like to drive a LED with fix current – they are perfect for this. Since I’m planning to develop the whole RGB driver further, it will take a couple of months to finish it. But this current generator can be used in itself, so I’d like to share it with you. The switched-mode current generator’s circuit diagram can be found at the bottom of the page in PDF format.

How the circuit works:

On the basis of the LM2574 it can be seen that with the ADJG alternation the feedback leg is connected directly to the error amplifier, so it doesn’t have a resistor divider that the fix voltage versions have. This is what we make use of for the current generator. The DC-DC’s error amplifier is at balance at 1.23V (according to the data sheet), so if this much voltage is on the feedback leg, then the error amplifier’s output is 0V – so in this case the IC doesn’t regulate, but maintains the output voltage. If there is more voltage on the feedback leg than 1.23V, then the DC-DC lowers the output signal’s filling, thus lowering the voltage at the output. Also, if it’s lower than 1.23V, then it increases it.

I hope this is clear up to this point, this is how the DC-DC regulates the output voltage – but we need a current generator. So we have to keep the current fix, not the voltage. This is done by a low value shunt resistor. R1 0.5 Ohm at the circuit diagram. The DC-DC’s whole output current flows though this after it flowed through the LED. As a result of the current flowing through, low value voltage drops on the shunt, which is amplified by the operational amplifier. (Not inverting base connection, I wouldn’t like to discuss this now.) The point is that the amplification is determined by the quotient of the 4.7K and 15K+500K (adjustable). The 22nF is only there for noise filtering purposes, because the output of the DC-DC is noisy and we wouldn’t like to amplify the already too much noise. Without this the regulation can become instable, and the LED’s luminance won’t be even.

Let’s look at an example:

Let’s suppose that the trimmer is set to 50K Ohm. What’s going to happen? On the output of the DC-DC the voltage rises rapidly after turning it on as the output capacitor begins to charge. If it reaches the LEDs opening voltage the LED opens and begins to light, and at the same time current flows though the shunt, thus voltage goes through it. This voltage gets to the operational amplifier. The voltage gradually increases on the output and the LED begins to open more, so more and more current flows through the shunt. The amplification of the operational amplifier: 1+((15KOhm+50KOhm)/4,7Kohm) = about 15 times. It can easily be calculated from this that the 1.23V signal will appear on the feedback leg if 0,082V drops on the shunt resistor (0,082V*15x amplification = 1,23V). If the DC-DC gets the 1,23V, then from that point on it sets to this output voltage and constantly maintains the balanced state. So anything happens, the current flowing through the putput I=U/R, so the voltage dropping at the shunt / value of the shunt = 0,082 / 0,5 Ohm = 164mA and it keeps this precisely.

How to build it:

If one wanted to build the circuit, keep to the rules of building switched-mode supplies, that I could summarize as follows: Place the components as close to the DC-DC as possible and as far from the disturbance-sensitive circuits as possible. I can’t add more to the construction of this. The circuit is very simple, it contains hardly any components. The Schottky-diode on the diagram can be changed to any 1A fast diode. Don’t significantly reduce the output capacitor’s value, otherwise the circuit won’t work properly. The way too big capacitor affects the speed of regulation negatively, so if possible stay with a 100uF-300uF range. The inductivity should be chargeable with at least 0.75A.

How to set it:

One should set the output current according to his own needs. You must be aware that we begin the setting when the trimmer is at maximum position. This is when the output current is the lowest. More specifically in this case 1+((15KOhm+500KOhm)/4,7KOhm) = 110x amplification and the 1,23V feedback on the shunt: 1,23V/110 = 11,18mV should drop there. It can be calculated from this that the output current is I=U/R, so 0,01118V/0,5 Ohm = 22,36mA. This is the minimal current that the current generator is able to supply. The maximum current is regulated to 500mA by the DC-DC. If we calculated it, in principle, 1+((15KOhm+0Ohm)/4,7KOhm) = 4,19x amplification is the result, so with a trimmer set to zero and from this voltage dropping on the shunt: 1,23V/4,19 so 0,293 V, from which the maximum current is I=U/R, so 0,293V/0,5 Ohm = 586mA. The IC obviously cannot supply this much continuously, because the protection disables it, but it can be used this way for a short period of time without any problem.

Other possibilities:

Who needs a stronger current generator, simply change the DC-DC converter to an alternate that can be charged with more current:

  • LM2575-ADJG max chargeable with 1A

  • LM2576-ADJG max chargeable with 3A

In principle the operation of the circuit stays the same, and you’ll have to set the diodes, inductivity and the output capacitor to stronger current in chargeability. And in the feedback branch you have to change the value of the resistors and shunts to these:

1A version:

R1 = 0,33Ohm / 1W

R4 = 10KOhm

R3 trimmer = 1MOhm

C2 = 330uF/50V

With these values the 1A current generator’s regulatory range is between 17mA and 1,2A.

3A version:

R1 = 0,12Ohm / 2W

R4 = 10KOhm

R3 trimmer = 1MOhm

C2 = 1000uF/50V

With these values the 3A current generator’s regulatory range is between 47mA and 3,2A.


As I’ve mentioned before I recommend this current generator to my RGB LED driver, so the current generator’s controllability had to be solved. Fortunately it’s very simple, since the DC-DC converters have an On / Off leg that can be directly driven by a microcontroller. If this leg is on the ground potential, then the current generator works. If we pull this leg up, then the converter switches off. So we have nothing else to do, but to connect this leg with the one of the microcontroller’s output leg and the current generator can be immediately run. The microcontroller sets le luminosity of the LED by switching this On / Off leg with a PWM signal. It’s crucial that the PWM signal’s frequency cannot be bigger than 100-120Hz. Fortunately, the human eye cannot follow this, so our eyes will perceive this as constantly lighting.

To close up this article here is a video, where the 500mA current generator can be seen in operation. Comment to the video: the scope seen in the video is set to 0,2V/division and I used 1 Ohm for the shunt. The scope measures the voltage on the shunt and since it’s set to 1 Ohm, so the current flowing through can be directly read from the scope. So: 1 division = 0,2A. As you can see the current generator can supply 0,6A, but this is no longer normal operation.

I hope I gave you good ideas in connection with the switch-mode current generators, and their use in microcontroller environment.


Cart empty