Hello, in this project i want to show you how to make a constant-current source which gives 20mA at the output.

Its also known as LEd driver, because many leds need 20 mA to light up. The input of the constant-current source can be between 5V and 15V DC, what is realy usefull for variable voltage sources. The unloaded output will be the same Voltage as the input -0,7V for the circuid, it will regulate itself when you burden it . You can place 1 to 7 LED´s in a row, without a resistor and without destroying the LED´s / the driver.

explanation

The LED will try to get the maximum aviable curent, what is 20mA, if the 20mA are reached the voltage will go down to the voltage which the LED need to have a currend of 20mA and stay there --> LED driver

## Step 1: What Do You Need?

Parts:

Solder

a circuit board

1x 39Ohm Resistor

1x 10kOhm Resistor

1x BC547B Transistor (Or equal)

2x 1N4007 Diode (Or equal)

additional

Terminals (like the blue ones on the pictures)

LED´s to test/use it

Tools:

soldering iron

a Cutter

pincers

voltage source to test/use it

## Step 2: Assembly

Now solder it together, use the schematic. Importand, eighth at the transistor don´t permute the legs or maybe there will be curents around 200mA (i tested it!! ;) ).

The circuit board i used is 7x8 holes small one, you can make it smaller when you dont use the terminals, a cooling element is not necessary, because it will not heat up that mutch.

## Step 3: Testing...

If you assembled it all right together you are ready to test it.

Add a Voltage source, and add a LED, the LED should light up :)

You can place 1 to 7 LED´s in a row, without destroying them and the driver, but then the voltages which the LED´s need added together dont have to exceed the input voltage -0,7V for the circuit.

example:

Input voltage = 9V

Circuit = 0,7V

Red LED´s = 1,8V

0,7V 1,8V 1,8V 1,8V 1,8V = 7,9V < 9V OK

0,7V 1,8V 1,8V 1,8V 1,8V 1,8V = 9,7V > 9V Not OK

Thank you for Reading, feel free to Comment.

Usings:

To test a LED

for bike lights, the dynamo generate different voltages at different speeds

If you are annoyed to calculate a resistor for a LED

Thank you for reading, you may want to visit my other websites:

Participated in the

Hardware Hacking

Participated in the

Make It Glow Contest

## 2 People Made This Project!

### DavidM519 made it!

### SuperBrainAK made it!

## 32 Discussions

4 years ago

great circuit, I made mine as small as possible. orange and black wires are where the power comes in, I got up to 25v, and red and black are where the LEDs go. I have two 75 ohm resistors instead of the 39 ohm one, to handle the extra voltage. thanks for sharing this circuit.

Reply 2 years ago

Hi im curios what to use to get power a led at 4 volts 40miliamp from 21 volts

Reply 4 years ago on Introduction

Very cool, Thank you for building it! I will try that with the 75Ohm resistors too! :)

Reply 4 years ago

I modified the circuit to run any value, adjustable amperage. But keeping the LED series option, did that sentence make any sense? anyway, I'll post an 'ible on it soon.

Reply 4 years ago on Introduction

I understood the sentence, so i think its okay :D I´m waiting for it ;)

Reply 4 years ago

so I did some testing with different input voltages, all at 530mA, and it seems that the mA going through the LED ranges quite a bit depending on the input voltage. This might be part of the circuit's function, but it seemed that it should have constant current even with uneven input. Here are my results with a single 3.6v blue LED: turns on at 2.5v. 10mA @ 3.5v. 20mA @ 4.1v. 40mA @ 5.15v (USB voltage). 60mA @ 7v. 80mA @ 9v. 95mA @ 11v this was as high as I could go, my power supply can go up to 17v, but the circuit would not accept above 11v. anything more and it turned it into heat (it got pretty hot when I tried 17v). just thought I would share this. and I'm currently waiting on a few parts to get here for my 'ible, hope they get here soon!

Reply 4 years ago on Introduction

oh, okay, I will test my circuit too, that seems to be bad. Thank you for sharing!

Reply 4 years ago

I finally got around to making my 'ible using your circuit. I'm currently experimenting with a driver circuit I made, I'll post an 'ible on that sometime in the next couple of months. But it is still based off yours.

Reply 4 years ago on Introduction

I´m looking forward to see it :)

4 years ago on Introduction

Thanks for sharing. I tried this out-used a bc549c and one led with Vf 2.1v

this is not a constant current source, as it varies with the input voltage.

but it does limit the current to a reasonable value over the range, and it works from a very low input voltage which is nice.

I do not understand completely, but i think the voltage drop over the diodes makes the transistor control the current

2v -> 1.75mA

2.1v -> 2.8mA

2.2v -> 4mA

2.3v -> 5.6mA

2,5v -> 8mA

3v -> 9mA

4v -> 10mA

15v -> 15mA

24v -> 19mA

Reply 8 months ago

wow. you might do better with a resistor in this case.

thanks for sharing.

Reply 4 years ago on Introduction

Hi, Thanks for rebuilding my project,

the current shouldnt change, but it is an interresting effect, I will try it on my circuit!

10 months ago

A tutorial on this current source driver for LED (2018 09 14)

--------------------------------------------------------------------------------

I'll try to invoke as little math as possible.

More math will be separately appended at the end for details.

Some assumptions are made. They have very minor influence.

They, however, make explanation clearer, much easier to understand.

[IMO, Vd, the diode Voltage, at 0.68V, is a better fit.

But I'll use the Vd=0.78V here. To set to desired LED current,

R2 needs to be trimmed anyway.]

..........................

Let

Power supply be Vc (5V-15V, 10V is nominal),

Diode Voltage be Vd, diode current of D3,D4 be Id,

Voltage across R2 be Vr, current of R2 be Ir.

We assume Q1 collector current=emitter current=Ir=ILED,

all diode Voltages are about the same = 0.78V, as does Vbe of Q1.

Because

Ir=ILED=20mA,

Vr = IrxR2 = 20mAx39Ω = 0.78V

(That's why I choose Diode Voltage be 0.78V, so to fit

the article result.)

First, calculate the quiescent state of the circuit,

so that we have some numbers to visualize:

Choose Vc=10V (will explain why choose 10V), on the R1,D3,D4 circuit:

Id = (Vc-Vd-Vd)/R1 = (10V-2x0.78V)/10k = 0.844mA (0)

On the circuit of D3,D4,Q1Vbe:

Vd3+Vd4-Vbe=Vr

Therefore,

Vr = Vd+Vd-Vd = Vd |Vbe=Vd

ILED = Ir

= Vr/R2

ILED = Vd/R2 = 0.78V/39Ω = 20mA

From above equation,

ILED only depends on Vd,R2; has no dependency on Vc!

Explanation:

Vbe of Q1, Base-Emitter Voltage (a diode),

is about the same as Vd.

Vr = Vd3+Vd4-Vbe = Vd+Vd-Vd = Vd.

That is,

Vr=Vd (a single diode Voltage), about 0.78V here.

This is the reference Voltage across R2,

to develop the current Ir, which is also ILED.

The current source for the LED is then simply:

============================

ILED = Vd/R2 |Vd=Vdiode≈0.7V (1)

============================

For this article, ILED = 0.78V/39Ω = 20mA.

Now,

find variation of ILED based on Vd variation which,

in turn, is induced by power supply variation:

i.e. find ILED to be a function of Vc.

We can now ignore the Q1 side of the circuit, as

all we need to find is Vd variation, which is from

the D3,D4,R1 side of the circuit.

Diode (D3, or D4) current is:

Id = (Vc-2Vd) / R1 (2)

Vd is relatively constant, about 0.78V here, so

Id variation is defined by R1 only.

Or,

Delta Id (i.e. change of Id) = 1/R1 x Delta Vc

[See below appended why this is so.]

Delta Id = 1/10k x Delta Vc,

or

--------------------------------

Delta Id = 0.1mA per V (3)

--------------------------------

Assume the supply, Vc, centers at 10V, and changes +/-5V,

from 5V to 15V as in the article.

Hence,

for a 5-V supply Voltage change, based on

the above equation (3),

Total delta Id = 0.1mA per Volt x 5V, or

Id varies +/-0.5mA for Vc varying +/-5V.

From Equation (0), we have Id,nom=0.844mA.

We now calculate Vd change:

Id,hi = 0.5mA+0.844mA,nom

Vd change = 26mV x Ln [(Id,hi/Id,nom)] =12mV

[See appendix below on this]

If Vd goes higher by 12mV from the norm ...

From equation (1): ILED = Vd / R2:

ILED,hi = (Vd,nom+12mV) / R2

= Vd,nom / R2 + 12mV / R2

The part,

12mV/R2, is the variation term.

That is,

the change from 20mA norm, induced by +/-5V, is

ILED change = +/-12mV/R2 = +/-12mV/39Ω

------------------------------------------------------------

ILED change = +/-0.308mA for +/-5V change (4)

------------------------------------------------------------

That is, total change of

+/-0.3mA from 20mA for a +/-5V supply change.

Or,

+/- (0.3mA/20mA) x100% = +/- 1.54%

i.e.

Total ILED varies <= +/-1.54% from the nominal 20mA,

very constant!

Conclusion:

Equations (3) and (4) show constant current source

as LED current driver, with minimum change

over a wide supply Voltage range (+/-5V, or 10-V span).

--------------------------------

Check the effect of Vd in the simplified equation (2):

For a diode, Vd varies very slowly with Id current.

For a 2X change of diode current, Vd changes 18mV.

For a 10X change of diode current, Vd changes 60mV.

Compare them to typical 0.7V diode Voltage magnitude,

the Vd varies only

(DeltaVd x100%)/0.7V -->

2.57% at 2X diode current change.

8.57% at 10X diode current change.

Therefore,

Vd can be a Voltage reference, just like Zener diodes.

The equation for above Id1/Id2 ratio is:

------------------------------

0.026V x Ln (Id1/Id2)) (5)

------------------------------

[where 0.026V is Thermal Voltage, Vt, at 25C.]

i.e.

Take the natural log (log-base-2, not base-10) of

the current ratio, then multiply by 26mV.

With (5) we can calculate ANY Vd change when knowing

the Id ratio. Example.:

5X Id change --> Vd changes 41.8mV.

..........

For Vc change from 5V-15V, the Id current change is,

from equation (3), with +/-5V supply change,

Delta Id = 0.1mA/V x 5V = 0.5mA total

Recall, from equation (0)

Id (or Id,nom) at quiescent is 0.844mA,

Id,hi = 0.844mA + 0.5mA = 1.344mA

Ratio of Id = Id,hi / Id,nom = 1.344mA / 0.844mA = 1.59

Using (5),

0.026V x Ln(1.59) = 26mV x 0.465 = 12.1mV

Have two diodes, D3,D4, so

total Vdiode variation = 2x 12mV = 24mV = 0.024V

Here,

the nominal two-diode Voltage is 0.78Vx2 = 1.56V

With a 5-V change on Vc, the change on the 2-diode Voltage is:

from 1.56V to (1.56V+0.024V),

--> Vd is practically constant!

Hence,

the earlier assumption that D3,D4 diode Voltage is

relatively constant is valid, having little effect on the simplified

equation (3) which is derived from equation (2).

Conclusion:

Equation (1), ILED = Vd/R2 is valid,

[Vd is Vdiode, and stable and flat, at about 0.7V.]

and 'seems' independent of the power supply Voltage.

---------------------------------------

As real world would have it, ILED is slightly dependent on Vc,

the supply Voltage. A percentage here, a percentage there, it adds up.

Also the NPN (Q1) output impedance (collector impedance)

is not ideally infinite. It depends on the supply Voltage.

There would be small induced error by the collector

impedance.

But the simplified way for quick calculation and visualizing

the dependency are a valuable tool.

A circuit good to 5%, 2%, tighter accuracy, is something else.

At accuracy of 1% and below you'd have to account for

a lot more. More understanding of the circuit and the device

are needed.

You can always trim R2 to get the precise current you want.

Then it stays nearly constant over the supply range.

===========================================

===========================================

Appendix:

Let

Id=diode current, Vd=diode Voltage,

Is=diode saturation current (a diode parameter)

For a diode, the Current-Voltage relationship is

Id = Is x [e^(Vd/Vt) - 1] (6)

where

Vt=0.026V approx. at 25C, is called Thermal Voltage

Is is a parameter of the diode.

Because (Is) is very very small (10^-15, 10^-17 Amp),

when compared to Id, the equation can be simplified to

------------------------

Id = Is x e^(Vd/Vt) (7)

------------------------

Equation (7) is the simplified diode equation.

Take the Ln of (6):

Vd = Vt x Ln [1 + (Id/Is)] (8)

Example:

Vd = 0.026 x Ln [1 + (0.228mA/10^-15)] = 0.68V

Diode has internal resistance, the complete equation is

Vd = IdRd + Vt x Ln [1 + (Id/Is)] (9)

Because Rd is small, and mostly Id is small (in mA),

IdRd is small compared to Vd, equation (7) is mostly used

for low power, battery powered, circuits.

At high Id, say, 0.1A, even if Rd is as low as 1 Ohm

(maybe 5 Ohms), IdRd would be 0.1V (maybe 0.5V).

Now it is not small when compared to nominal 0.7V.

Then (9) must be used.

For the circuit, assumption is made that

Vd of 1N4007 = Vbe of Q1.

Vbe of an NPN may not be the same as power supply type

rectifier diodes such as 1N4007.

For example, Vbe of 2N3904 is about 0.68V,

and 1N4004 is about 0.56V.

The key is: Vd is relatively constant over wide Id range,

only the magnitude (0.56V vs 0.68V) is different. For the

magnitude difference, you can trim it out.

[Again, 10X Id change induces only 60mV Vd change.

Examples: 0.56V to 0.62V, 0.68V to 0.74V.]

1N4007 is a high Voltage diode (1000V break-down, 1A).

As a high Voltage application diode, its Rd is generally high.

It affects the Vd flatness over Id variations.

The diode current here is small, about 1mA. Supply Voltage

is low (less than 20V). For flatter/more constant diode Voltage

as a reference, recommend use diode types

1N4001-1N4004 instead (lower Rd). 1N914 works fine too.

Q1 can be any 400mW to 1W NPN, such as 2N3904, 2N2222A.

-----------------------

Derivation of Id variation (of D3, D4):

As mentioned, from (2),

Id = (Vc-2Vd) / R1

or

Id = Vc/R1 - 2Vd/R1

Assume Vd is relatively constant,

differentiating with respect to Vc

∂Id/∂Vc = 1/R1 - 0

= 1/R1

--> ΔId/ΔVc = 1/R1 = 1/10k

--> ΔId = 0.1mA per V

To avoid differentiation, optionally do this:

Calculate Id using (2),

say, at Vc=10V:

Id,nom = (10-1.56V)/10k |2Vd=1.56V

Id,nom = 0.844mA

Now increase Vc by 1V, to 11V:

Id,hi = (11-1.56)/10k = 0.944mA

Change of Id for a 1-V change:

ΔId = Id,hi - Id,nom = 0.944mA - 0.844mA

= 0.1mA

Therefore,

Id change is 0.1mA per V.

Or total of 0.5mA change for a 5-V change.

-------

You might be confused here ...

Why find the variation of Id from supply Voltage?

Reason:

To find the supply-dependent variation of ILED ...

in which ILED is Ir ... by way of ...

Vr, Vd ... in which Vr is Vd.

Simply:

ILED variation is Vd variation; is Id variation.

Vr=Vd= the Voltage reference across R2.

Recall equation (2):

ILED = Vd/R2 --> If Vd varies, ILED will vary.

Recap:

Vd varies very very slowly with Id.

It has already been established by (5), then (3),

which leads to (4) which is

0.3mA total variation for a 5-V supply change,

from the nominal 20mA. Or

only 1.5% total change; essentially, a current source.

--------------------------------

The other factors:

Current gain, beta (β), of bipolar transistor is

β = Ic/Ib, deriving to

Ic = (β/β+1) x Ie [Ic is always one Ib less than Ie]

If beta is nominally 100, the error induced by beta is

1% on Ic magnitude (which is ILED).

If β is 100, and Ic=ILED=20mA, Ib= 20mA/β = 0.2mA

This Ib takes away the current from diodes D3,D4,

Recall that at 10V supply, Id,nom is 0.844mA,

error induced by Ib (or β for that matter) = 23.7% of Id (!!)

This Id variation causes

Vd error = 0.026 x Ln (23.7%) = 0.026 x Ln (23.7/100)

= 37.4mV

Ir error = Vd error / R2 = 37.4mV/39 = 0.96mA, or 1mA approx.

Hence,

Ib, or β, alone causes 1mA/20mA x100% = 5% magnitude error,

(the delta variation over supply change, though, remains small).

The comfortable factor here is that the 'large' errors are all

magnitude errors, affecting only the accuracy of deriving the

nominal current value using the simplified equations. All the

while, the LED current variations induced by supply Voltage

change is still small and valid, forming a tight current source.

And, the magnitude errors can be trimmed out by varying R2.

-------------------------

Collector output impedance is finite. It is a function

of the applied Collector Voltage (at Collector-to-Emitter pins).

In this circuit it is (Vsupply-VLED).

The related transistor parameter is called

Early Voltage, Va.

Collector impedance is then roughly

Rc = Va/Ic

Va generally ranges from 30V to 100V.

For 2N2222A Va=74V.

Assume Va=74V in this circuit. The Collector impedance,

at ILED=Ic=20mA, is

Rc = 74V/20mA = 37k Ohms.

1/Rc = 1/37k gives

ΔIc = 0.027mA per V change on Collector Volt.

Or, 0.027mAx100%/20mA, it is 0.135% change per Volt.

Practically can ignore.

Also note that there is a resistor (R2=39Ω) at the emitter.

Its presence greatly enhances Collector output impedance

to even higher still.

Meaning? Can ignore Collector impedance influence.

----------------

With all that, do not forget resistors. They could be

1%, 2%, 5%, even 20% tolerance.

A 20% error on R2 (39Ω) is a direct percentage error

on ILED!

We use R2 to trim out all other magnitude variables anyway!

And it is designed that way for trimming and setting the

correct LED current.

----------------

Transistor saturation:

If supply Voltage is too low, there may not be enough

headroom for Q1 and it will saturate. Current gain may then

go down to 10 or even 1, 0.1, etc. Base current increase

will drastically rob current from diodes D3,D4.

Vcollector = Vc-Vled. Vemitter=Vd=0.7V approx.

Vce = Vcollector - Vemitter = Vc - Vled - Vd

or Vc = Vled+0.7+Vce.

Vce needs about >=0.2V to be above saturation at 20mA.

So Vc >= Vled+0.7V+0.2V

or

-----------------------------------------

Vsupply >= Vled+0.9V approx. (10)

-----------------------------------------

A single white/blue LED is about 3.3V at 20mA;

green LED about 1.9V; red LED about 1.6V,

Arriving at, for a single LED:

Vsupply >= 4.2V|wht, 2.8V|grn, 2.5V|red

------------------

The maximum supply Voltage is dependent on Q1

break down Voltage. Because Voltage transient could

apply to the collector pin via capacitive coupling of the

LED capacitance, for safe application:

Vsupply,max <= BVceo

where BVceo is Collecter-Emitter Breakdown Voltage,

when Base is open; no connection on the Base pin.

-----------------------------------------------------------------------

Circuit wiring errors:

If D3/D4 is wired in reverse, they no longer conduct current.

Q1 will saturate. Then LED current is roughly

dependent on R2 only:

ILED = (Vc-Vled-0.1)/R2 |0.1V is saturation Voltage

As you can see, ILED varies directly with supply Vc.

Always first check Voltage at D3,D4 (or at Q1 Base).

It should be 2Vd, or about 1.4V - 1.6V.

The safety net is R2 (39Ω).

It limits damage:

There is no short-circuit current path from supply to ground;

can only via R2 (or R1).

If the LED is reversely connected, there will be no LED light

and zero LED current (Icollector=0). Q1 would saturate

to about Vcollector=0.8V, even if plenty Vsupply headroom.

At high enough supply Voltage, and if LED is wired in reverse ...

Note that LED reversed breakdown Voltage can be as low as

3.6V to 6V. It is still higher than the forward LED Voltage.

If its Voltage is that high, the LED is wired in reverse.

1 year ago

Hi, can I use the PN2222 transistor instead? and how to change mA and voltage?

1 year ago

Typically what is meant by "current source" is that the current does not vary (substantially) with load. If you look at the circuit schematic symbol for a current source, the supply for the source is not part of it. So, it's inaccurate to say that this is "not a constant current source" because it varies with supply voltage. Exactly what the constant value is will change with supply voltage, which however should be kept constant once a supply/value is selected.

The reason it varies with supply voltage is that the 1N4007 diodes (like all diodes) do not have a fixed forward voltage; above the threshold the forward voltage will depend on the forward current. The forward current is set by (Vin - (2 * Vdiode) / 10k). This roughly corresponds to (Vin-2)/10k since 1N4007s have a nominal forward voltage of 1V, but again the precise value depends on forward current.

2 years ago

I pluged in my led and it went POP!

2 years ago

Hello,I would like to know how to calculate , or what parts do I need for 21 volt source to 4 volt 40 miliamp led

3 years ago

Can i use this for LED with typical rating 1.2V@20mA

4 years ago on Introduction

5 years ago on Introduction

I just bought this: http://www.adafruit.com/products/1005#Technical_De...

...for the color wheel interface. I am using 1-2 RGB LEDs only and would like to drive them with this controller. The current needs to step down from 4A to 30-20mA. Would a circuit like this one work or would I be better off hacking the device?