Projects‎ > ‎Electronics‎ > ‎

Simple LED Current Source

It's no secret that I do a lot of projects with LEDs (ex. CycleLux, Tabletop Tree Lights). They are cheap, simple, and efficient. The tricky thing is designing a circuit to control and drive them. This project details the design of a simple current source for driving LEDs. Efficiencies of around 90% can easily be achieved. 

The Easy Way Out

If you just need to turn on an LED, then not much of a circuit is needed. If you have the LED datasheet you should be able to find out what the forward current and voltage drop will be, but if you're like me and have a large pile of LEDs and no known part numbers, then a little guestimation is in order. Depending upon how "high brightness" your LEDs claim to be, the voltage drop will be somewhere between 2 and 4 volts for a typical through hole LED. This voltage is really dependent on how much current is flowing through the LED. For any application involving a low current indication LED, I typically assume that 2 volts will be spent on a single LED - 3volts for my brighter whites. The actual brightness is then set by how much current you generate with a series resistor.

This schematic shows the simplest way to power an LED. There is some voltage source Vcc and a series resistor R. The exact current through this LED can be found as such:

ILED = VR / 1kΩ;  VR = VCC - VLED

But guessing a 2V drop on the LED, it can be estimated as:

                                                                                                            ILED = (VCC - 2) / 1kΩ 

A Better Current Source

The simple LED driver shown above is suitable for most of my applications, but when high brightness and power consumption are a concern, a better design should be used. There are many ways to create a current source, most of which use some form of transistor based current mirror. These were the industry standard for a long time, but people are finally learning how much more efficient MOSFETs (a voltage controlled device) are over the more common BJT (a current controlled device). Not only that, but I think FETs are easier to use.

In the following circuit, a logic level MOSFET is used in combination with a standard NPN BJT. The "logic level" description of the FET means that a smaller voltage is required to fully "turn it on" at the gate. Some FETs will require a large voltage at the gate and a type of charge pump is required to do so from lower voltage sources such as a microcontroller. The resistor R1 is used to "pull up" the FET gate to the supply voltage. When this happens, the FET drain and source are effectively shorted allowing current to flow through the LEDs and R2. This is where the BJT transistor Q1 comes into play. The base of the transistor won't want to go higher than some set voltage: Vbe. This value can vary among transistors, but I have found it to be 0.6V for a standard 2N3904 NPN BJT. At this voltage, Q1 will also "turn on" and allow current to flow through Q1, stealing voltage from the gate of Q2. With less voltage at the gate of Q2, it begins to "turn off." These two transistors will battle back and forth to be in the on state, effectively creating a constant current source through the LEDs.

I have included my results from using this circuit with a 12V supply and three high brightness white LEDs in series. The obtained values using different resistors are shown.

The limitations of this circuit are the supply voltage Vcc and characteristics of Q2, namely current Id. In addition, if the voltage supply Vcc cannot be greater than the rate gate voltage of Q2. If so, a resistive voltage divider or zener diode should be used to limit the voltage seen at the gate. Another thing to consider is the power being dissipated in R2. With the currents listed not a lot of power is drawn; however, if a few LED strings were used in parallel, the current draw and power dissipation would increase. The given calculation for I LED is based on the equations obtained from plotting the data points of R2 vs I LED. A simple estimate is:

 ILED = 0.6V / R2 which is Q1VBE / R2

The power dissipated in R2 can also be estimated as:

 0.36 / R2 which is Q1VBE2  / R2  ... (P = V2 / R)

As the current increases, so will the voltage drop across the LEDs. At some point, this will cause the voltage drop across R2 to decrease which will alter the given equations. This is not to say that more current cannot be sourced, but actual measurements should be taken to avoid a gross over or under estimation.

Adding Digital Control

To make this circuit useful, a way to control the LED brightness without changing the value of R2 would be necessary. To do so, a pulse can be sent into the gate of Q2. Doing such will only allow Q2 to be turned on when the pulse is high. The brightness of the LEDs is then controlled by the duty cycle of the pulse. This happens because our eyes have a low refresh rate, generally 10 to 12 images per second. Anything changing faster than that will appear blurred to us. In addition, a higher current than the rated one can be sent through the LEDs because they are only on for a portion of the time. They don't overheat and burn out as they would if they were on constantly. There has even been research done proving that an LED pulsed with a 50% duty cycle appears brighter than one constantly on with half the current; however, a specific range of pulse frequencies must be used for this to work.

As mentioned, the human eye refreshes at 12Hz, but an LED should be flashed much faster than that for the desired brightness effect and LED cooling to take place. Many people have recommended a rate of 200Hz, and that has worked well for my applications. I am showing two versions of this circuit. The first will work as long as long as the MCU output is high enough to turn on the gate of Q2. If it isn't, than a zener diode should be used at the gate to ensure the voltage is where it needs to be, and the MCU output should be set to open-collector. In this setup, the resistor R1 will still pull the gate high, but the MCU can pull it low. The value of R1 may need to be altered, depending on the current sinking of your MCU or the characteristics of the zener diode D1.

Calculating the LED current is the same as it was before, but the total current can be increased because of the pulsing. R2 should be set to a value to give the absolute maximum current you are willing to drive through the LEDs. The average current passing through the LEDs will then be the maximum multiplied by the duty cycle percentage.