# Will this circuit with 3x LED work?

I'm planning to do a little light with a changeable color and light intensity. I made up this schematic but before I buy a needed parts I'll be glad if somebody checked it after me if it hasn't some flaws I overlooked.

Picture of the schematic (don't mind the white box at the bottom):
http://i.imgur.com/QsYh1fJ.jpg

Notes:
-the power source is 3.7V Li-Ion battery
-the box right next to the battery is a 5V step-up module (this one)
-the resistors are different because the LEDs have different Vf, every one is calculated to limit the current to ~18 mA (with potentiometers at 0)
-all potentiometers are the same with 1K max and 0.05W (I'm not sure if the wattage is enough though)
-the LEDs are all marked as a 20 mA, that's why I limit the current to a safe 18 mA

So what do you think? Will it work? Is there anything that could be made better?

Thanks for all replies!

sort by: active | newest | oldest
steveastrouk2 years ago

It won't work very well, because you aren't controlling the current in the diodes, only the forward voltage, which is non-linear.

Use a circuit like this one, for each colour of LED

amdlo (author)  steveastrouk2 years ago

Thanks for the reply but I don't understand what will this circuit do? And where is the LED? Also I think that I'm regulating the current in my circuit, or am I not? When turning the knob on a potentiometer and rising the resistance, shouldn't be the current going down? I tested it with a simulator and it worked. With potentiometer at 0 there was about 18 mA through the LED and when at full 1000 ohm the current dropped to about 2-3mA. Shouldn't be by ohm law the current going down with a higher resistance? Am I getting something wrong?

2 years ago

http://users.telenet.be/davshomepage/bitmaps/curre...

It is actually just a variation of a voltage regulator being used to regulate current. The one steveastrouk is showing is a bit more advanced. The reason it works is because the LM317 does whatever it can to the output to make sure the voltage difference between the adjust pin and the output is 1.25V. When you power that LM317 in that way, it immediately does whatever it can on the pass transistor inside the LM317 to maintain that voltage difference. and in order for that to happen in that config, the LM317 has to push a specific amount of current through that resistor to keep the voltage across it 1.25V.

This configuration is good for driving LEDs, as because each LED can be a very fussy about the exact voltage across it (small change in voltage = huge change in current and power use) it is easier to drive them with constant current, (small change in current = almost no change in voltage, and small change in power use.)

When using ohms law to calculate the current, just assume that the LED is like a voltage drop that never changes, no matter the current. It is almost like a battery connected backwards in the circuit.

amdlo (author)  -max-2 years ago

I understand that when using a power directly form a battery than the configuration using only a resistor to regulate the current would be wrong (because a battery has a pretty unstable voltage) but would this be an issue when using a step up booster like the one in my circuit? (I'm not arguing with you nor doubting you I'm really just asking :)

Also thanks for the explanation of a LM317 working :) I'm still not sure about some details. I understand that the voltage between OUT and ADJ will always be 1.25V but what would be the voltage between OUT and the circuit end (in the battery -)? And what would be the voltage between ADJ and the circuit end? Of course I'm talking about our situation with 5V voltage on the IN.

Other thing I don't understand is the current. I know that to calculate the current when using that simple configuration used in the article I have to use 1.25V and calculate the resistance from it for the needed current. But why is it 1.25V when the voltage between the LM317 and the circuit end should be more than 1.25V (for the LEDs it should be at least 3.5V)? And how the current behaves in OUT and ADJ connectors? This second question I illustrated in a picture where I don't know how to calculate the ?mA. And as I mentioned I also don't understand why is the output calculated using I=1.25/R. Is there something trivial I'm not getting?

Thanks for the answer if you still have the nerves :)

My illustration: http://i.imgur.com/LCEpkTB.png
(in the top picture I drew a situation using Ohm's law that I'm familiar with and understand completely, in the bottom picture is our situation where I'm not clear about what is happening with the voltage and the current)

2 years ago

I think what is throwing you off with the understanding of the circuit is the functioning of that regulator. What is most important to understand is, is that the error amplifier will do whatever it can (when it is in a feedback loop) to minimize the difference between it's two inputs. When the negative feedback "Disagrees" with the voltage reference, 1.25V usually, then the pass transistor, which is like a variable resistor controlled by electricity, will be either turned ON or OFF or something in between to ramp up or lower the voltage, so that the difference is zero again.

When it is used as a constant current regulator, essentially, it is just measuring the voltage drop across that resistor, and so when the Vdrop is too low, the pass transistor turns ON, which lets more current flow though any load, and when the Vdrop is too high, it turns the transistor OFF, and less current flows through the load. Simple as.

Remember, voltage is relative; it is relative between 2 points, and for the current regulator circuit, it is the voltage across the just that shunt resistor between the OUT and ADJ pin. That is what will always remain 1.25V because of the voltage reference inside the regulator, and the op amp actions to make sure the voltage seen between the 2 inputs is zero.

amdlo (author)  -max-2 years ago

Op amps explanation (especially the first half is mandatory):

A really good and simple explanation of the voltage regulating and the current regulating setups:
http://en.wikipedia.org/wiki/LM317

2 years ago

Great, glad you understand it now! Pretty amazing and versatile little things, really!

I will not that in the real world, they are not so perfect, and LOTS of little itty bitty things to keep in mind with op amps, you can read about those considerations here: http://www.allaboutcircuits.com/vol_3/chpt_8/13.ht... but in the case of figureing out how things work and reverse engineering, who cares really, that makes things hard ;)

amdlo (author)  -max-2 years ago

Yes, I'm sure that the real life isn't so perfect as the theory :) But I'll leave such details for now. I'll be learning more from the basics and in a few weeks (when I'll have all the components) I'll do this 3 LED lamp and probably public an instructable here :) Thanks for your help I'll select the answer as I'm finally fully satisfied :D

2 years ago

Nah, I don't have any nerves against you or anything! :) Good question: It is all about feedback loops, built in voltage references, and stuff like that. Also, the LM317, like all semiconductors, requires power to work.

The basics of a regulator are really simple, and you can watch dave's video on how they work. He does a great job at explaining the basics:

Actually, I have a very similar circuit from the LM317 datasheet on LTspice, and I am reverse engineering it along with the formula to figure out how exactly the darn thing works, as it is quite intriguing! (It is slightly more complex than the really simple configuration dave shows, but not by much.)

For the ADJ, there is a bit of current on the output, and it is a constant current output, but is is like less than 100μA. So now that you understand that the voltage regulator is like a variable resistor controlled by super smart space-age technology, so that the output voltage stays constant relative to the reference, we can analyze the workings of the way to use it as a current regulator, or a constant current source.

amdlo (author)  -max-2 years ago

Thanks for the explanation and the video helped a little too. I still have trouble understanding the principle of a circuit with a LM317. Probably the best would be to try it in real life and maybe after that I'll understand. I'm just totally confused about what are the voltages between different points in such a circuit. And I was trying hard to understand both - the current regulation and the voltage regulation with a LM317 but I just don't get it. Thanks for your help I appreciate it really :)

2 years ago

The circuit directly controls current. Somewhere I have an explanatory note on sizing the resistors

The LED is on the right hand end of the circuit.

You aren't regulating current directly, for complex reasons.

An LED is NOT a resistor, it does NOT obey Ohms law, for one thing, once the voltage across the LED drops below the forward voltage NO current will flow.

amdlo (author)  steveastrouk2 years ago

Yes, I understand that LED don't have a resistance and does not obey ohms law but that's why there are these 6 resistors in my schematic. Their intention is to regulate the current for the LEDs not to burn. I still don't understand why my circuit wouldn't work. I have also tried your solution in a simulating app and it wasn't working. I used a 7805 instead of the LM317 though. When attached to 3.7V battery it didn't do anything but when I raised the voltage to 30V circuit worked but there was a huge current going through the LED (1A when potentiometer was at 0 and 1.5A when at full 1K). But maybe I did something wrong.
Here are a screenshots of both 3.7V and 30V arrangements:
http://i.imgur.com/2QMblh8.png
http://i.imgur.com/dw4KnB9.png

amdlo (author)  amdlo2 years ago

Oh, sorry I used a R5 instead of a 0R5 resistor but when I fixed it now it didn't work either.

2 years ago

If you could use a 7805, I would have said so. My circuit works, substituting random parts will not.

Your simulated circuit was working "correctly" as it would using a 7805, not a 317.

Your circuit will be horribly non-linear wrt to the potentiometer position, if that suits, go ahead.

2 years ago

A 7805 will also work in the circuit, the only difference is that the voltage drop across it will be more significant, so the resistor values will need to be higher, and the boost converter would have to make at least 8V.

amdlo (author)  steveastrouk2 years ago

Don't get me wrong, I'm not saying that your circuit isn't working or is bad in some way. I said that I probably did something wrong in the simulation. What I'm just saying is that I don't understand how it works and that my simulation didn't help me to understand it either. I'm not arguing with you that which circuit is better and which is wrong. I'm still trying to understand what are the downsides of my solution as you suggest and how your solution works (as I don't understand it). And for the simulation I had to use 7805 because the application doesn't have 317...

In the meantime I was simulating how to make my solution better and I think that when I move the LEDs to the left (just before the resistors), the voltage would be always 5V and with the potenciometers I would be regulating the current only. What do you think?

2 years ago

It makes no difference to the way the thing works. Remember, The same current flows THROUGH all the parts in series !

amdlo (author)  steveastrouk2 years ago

Yes, that I understand. My change (moving the LEDs) isn't about changing the current but changing the voltage which was dropped by the resistors when they were before the LEDs. With LEDs moved to the left they will get 5V and there will be about 18 mA in each parallel part (through each LED). About 54 mA in the whole circuit.

2 years ago

It won't change anything.

amdlo (author)  steveastrouk2 years ago

I think it will because the voltage is divided by the resistance so when I put the LED at the beginning of the circuit there would be a full 5V but when I put it after the two resistors the voltage would be lower. I made a screens from the simulation app. The first two are with the LED at the beginning (with potentiometer at 0 and at 1000) and the second two are with LED at the end (again with total resistance 110 and 1110). Notice the change in current (caused by a change in resistance) and the stable 5V in the first two scenarios.
http://i.imgur.com/m5CxWZ3.png

2 years ago

You're not comparing the same thing then, and you wonder why your results are different. What is the strange thing with three dots in it ?

A simulator is no replacement for understanding and a piece of paper.

Really, it makes no difference. Forget the simulator. Build it.

amdlo (author)  steveastrouk2 years ago

If by comparing a different thing you mean that I made a simplified circuit to show the point, I still can do the whole original circuit with 3 LEDs but it'll be the same and you probably wouldn't believe the simulation. But I don't need to use a simulation to know that a voltage is distributed in a circuit according to a resistance so it is highest in the beggining after the source and 0 in the end. That's why moving the LEDs right after the source will supply them with full 5V independently from the resistance in the circuit. The blue thing with three dots is just a selection I made to see the current and voltage in that part of the circuit (it's just a wire but selected within the app to show the measurements).

2 years ago

Whatever. A wire can't develop a voltage across it to measure, because if it doesn't have zero resistance its not a wire, its a resistor and affects the measurement.

You really need to get some basic circuit knowledge and not play with simulators. Garbage in, garbage out.

amdlo (author)  steveastrouk2 years ago

The voltage doesn't even matter if you think it's the same then ok. But the point is that I don't see why regulating the current with potentiometer is wrong. I even looked into a handbook and there was an example of a regulating of LED light intensity with the same circuit as this simplified mine (which is just a part of the full circuit). That means - power source, resistor, potentiometer and LED. Resistor's value is calculated to limit the current below the LED's maximum (it's about 18mA in my circuit) and the potentiometer can regulate it even lower for further light dimming. And about the voltage drop I know how to measure a voltage but the app shows the voltage splitting like it happens in a voltage divider. But it really doesn't matter because the voltage is stable 5V and I'm only regulating the current (the voltage wasn't even in question at the beginning of our discussion). And you said that it is wrong but I still don't understand how and still don't understand how your solution works. You don't have to be so offended I wasn't arguing with you. So my question is - why changing of the resistance within a circuit doesn't change the current accordingly?

amdlo (author)  amdlo2 years ago

So to be exact the voltage shown is between that point and the circuit ending (in the battery -). But the point is really the current regulation, not the voltage.

2 years ago

You seem to be arguing that the order of the components in a series circuit magically changes the current. It doesn't.

Changing the resistance does change the current, the order of the bits doesn't

Don't simulate, make. See how it behaves.

amdlo (author)  steveastrouk2 years ago

I don't know what are you talking about. Nobody ever said that order of components changes the current. Current is constant all around the circuit, the voltage isn't. I'll test it but I don't have all the components yet, I have to wait for that step up module to be shipped and that'll be at least a few weeks. And I'll order the LM317 too and try your solution.

amdlo (author)  amdlo2 years ago

I found LM317T in a local store so it will be much sooner than I thought. Maybe in a week or so. Only thing is that they didn't have 500R potentiometer from your schematic so I ordered a 470R, I hope it'll be strong enough to dim the LEDs to the point of no visible brightness. Then I'll test it all and tell you how both our solutions worked. Thanks for your help. I'll still be glad if someone explained to me how does your solution work.

amdlo (author)  amdlo2 years ago

I was studying the LM317 and I understand now why it's better and more precise than using just a resistor. Although I still don't understand how your circuit works. I found an article about a current regulation using a LM317 and there is an example in the article in which they're using only the LM317 and just one resistor (which can be replaced with potentiometer in my case) to regulate the current. Why is your circuit different? Thank you.

amdlo (author)  amdlo2 years ago

Sorry for spamming I just found another interesting article explaining the need for a stable current source. The point this article makes (in a part titled "Problems Using Resistors to Regulate Current") about voltage instability from battery is quite obvious but that shouldn't be problem in my case because of the step-up module I'm using the voltage should be stable 5V, or shouldn't it? What do you think? Or is there another problem with the stability?

amdlo (author)  amdlo2 years ago
2 years ago

I am not sure what all happened there between you and steveastrouk, and I am not sure why he is trying to push you into that more complicated and expensive solution. But I will try to clear up any confusion about this.

"Will this circuit with 3x LED work?" YES. There is nothing wrong with it.

Your minimum resistance in series with the LEDs is 110 ohms, and the corresponding LED is 3.5V. You can treat the LED as a voltage drop when the allowable current is flowing through it. So, thats 5V-3.5V = 1.5V = A*110 ohms

A = 13.6mA maximum. Thats fine. a 100 ohm resistor will allow 15mA to flow, and the potentiometer will increase the resistance more, causing a greater voltage drop (thats hard to accurately calculate because the exact relationship of the current vs voltage needs to be known. The assumption that it is the LED acts like a voltage drop works best when operating at or close to its nominal rated voltage and current in real life.

The circuit he gave you would be a slight improvement on what is shown here, but probably insignificant if driving small 20mA LEDs for a non-critical applications. so ""Will this circuit with 3x LED work?" YES. There is nothing wrong with it.

Your minimum resistance in series with the LEDs is 110 ohms, and the corresponding LED is 1.5V.."

amdlo (author)  -max-2 years ago

Wow thanks for the explanation! In the meantime I have found an articles explaining how to exactly calculate the best resistor for a LED and I've got it wrong before. I wanted the current for every LED to be about 18mA so they're as bright as possible but not too close to the 20mA limit. So after my findings and now your explanation I made a recalculation and I think that a better solution would be to use a resistors with 82 ohms (for the 3.5Vf LED), 100 ohms (for the 3.2Vf LED) and two resistors with 160 and 6.2 ohms (for the 2Vf LED). When calculating the resistance before I used a simulating software and later when I was trying to find out how it was calculating the current I realised that the software was using a wrong voltage drops for the LEDs (for example when I set Vf to 3.5V it dropped the voltage only by 3.09V) and that's where I came up with the random looking values for the resistance. Thanks for the explanation I really appreciate it :)

Wired_Mist pointed to another flaw in my circuit - the sudden turn off of LED when the resistance reaches a critical limit and there would be lower voltage in that branch than the Vf of LED. Can that happen in my circuit? I really don't know how to calculate this resistance limit if there is one. I'm just learning that's why I'm asking so many questions :)

2 years ago

I personally never have experienced a "sudden cutoff" or "dropout" like he described, the higher the resistance is, the dimmer the light will get to the point is completely impossible to see it give off any light at all. The point at which it is completly invisible will happen at different levels, since the manufacturing of each LED is a tad bit different, and at really low brightnesses, any tiny difference in efficiency becomes very obvious.

Cool fact: To closer emulate a current source, increase the source voltage, and the resistor value proportionally. If you could theoretically increase the power supply in infinity volts, and the resistor to some percentage or multiple of that infinity (yes, in calculus, with limits, it IS possible to have different rises on infinity) then you can end up with a perfect constant current! In real life, you can just get closer and closer to that. Anyway, just a fun fact. You can search into "impedance matching" and "impedance bridging" to learn loads more than that!

amdlo (author)  -max-2 years ago

Thanks! When I'll have the components I'll try all three solutions and see which suits my needs the best. That fun fact sounds interesting but it is out of my league for now :) I checked it on wikipedia though but for now I'll stick with the basics :D

2 years ago

I don't blame ya, It took me a long time to finally understand it too! You will see impedance matching pop up in everything in physics from acoustics, electricity (and signals/waves), light waves/radio, heat and thermal, etc etc etc! That compelled me to look into it some more, and now I sort of kind of understand it, at least well enough to understand how certain aspects of electronics are designed!

2 years ago

Cool fact: if you do, the dissipation in the pass resistor will also be infinite.

2 years ago

That's wrong.*

If my load resistance is infinite^2, then the power dissipated is approaching ZERO (thats infinity over infinity squared, which simplifies down to 1/infinity once you do the math and ohms law.)

Say that the load resistance is equal to that of the source impedance: Then the total efficiency is exactly 50%, that means only half of the power is dissipated in the load, and in he source. Anyone with a decent understanding of calculus and that theoretical topic would be able to figure that out.

In calculus, we must talk about infinity, not as a number, because you will end up with garbage nonsense, like 0/0. It needs to be close to it, approaching it. It is nonsense to say that the load will have infinite resistance, (unless it burned out, but even then...) and the same is true for a source with infinite series resistance.

If you are implying that when there is a finite resistance on the load, that the power dissipated by the resistor is infinite, then you are correct, because the current is held constant, the voltage drop across the load resistor is finite, and the V drop across the infinity resistor is infinite.

What is the purpose of your comment, to prove that this is not a practical to have this fundamental understanding, I'm don't know about you, but I think small things like that should be the underlying foundation of practical engineering. Things like that than aid in the understanding of what happens in reality. Obviously infinite voltage sources and infinite impedance are completely theoretical, and do not exist. I just think it is food for thought, and something to consider when making a "crude" current source, and what must be done to optimize it. And after all, I called it a fin fact for a reason: It in it of itself is not absolutly necessary to understand to just build a simple LED dimmer thing.

2 years ago

You have successfully beaten the topic to death, and amazed us all with your deep theoretical understanding. Happy now ?

2 years ago

I am not trying to beat anything anywhere, nor do I have a deep theoretical understanding of anything, but I did not appreciate your sarcasm, especially since it was not exactly correct anyway.

I wish to teach others things that I have learned though lots of research, and hopefully bring up some cool points and stuff. I am here answering Q's the same as you, and considering you have over 11 comments on the Q, compared to my 7 (some of which are redundant), I could say the same thing.

Anyway, I am done with this stupid foolish arguing, it has taken away time from more important matters.

Wired_Mist2 years ago

Wow, Soooo many comments for a simple Night-Light?

If you want precision, go with Steve.

I'm assuming you just want something that looks Pretty and Shiny right?

Now this may not be an elegant or efficient solution, but I can see your Schematic working. Keep in mind you may see the lights dim or flicker ! As long as the current is limited by the first resistors, all your doing is adding more resistance with the pot's and reducing the current to the LED.

I mean how much do a few resistors and pot's cost?

Buy what Steve suggested ( if only for your own research; this is a good technique to learn ! ) and buy the resistors/Pots anyway. If it doesn't work the way you want it to then I guess your out an extra \$2-4,... Meh

2 years ago

EDIT

""As long as the current is limited by the first resistors To the maximum current the Led can handle, all your doing is adding more resistance with the pot's and reducing the current to the LED, and dimming the Led""

also at a certain point the led will stop working altogether :'(

Still why not test it out anyway?

Also are you using 3 individual lights or a RGB ?

amdlo (author)  Wired_Mist2 years ago

I'm planning to use three insividual LEDs, one for each color In the schematic - the top one is red then the green and the last at the bottom is blue. And yes as you said, that's how I plan it to work. The resistors are calculated to limit the current to about 18 mA for each LED (maximum they can handle is 20 mA) and the potentiometers limit the current event further for dimming of the each LED.

What do you mean by "at a certain point the led will stop working altogether"? You mean at a certain point when turning the potentiometer when the current would be too small? If yes, that's my point too. Or you ment something else?

And why will be the lights flickering or dimming? Aren't the resistors stable enough or is there some other flaw in my circuit? I would like to try the steveastrouk's solution but I was trying to understand it before the components I need for his solution will be shipped (which will take weeks). I still don't understand how it works and therefore I don't know why it's better. But as you say I can try.

2 years ago

"at a certain point the led will stop working altogether"

when the forward voltage drops too low the led will drastically reduce the light coming from it ( Steve said something similar; check your data sheet if you have one)

The flickering and/or dimming will be because of slight variations in the voltage/current. Again Steve's Recommendations address those problems; Most ppl won't see the difference unless they know what to look for.

Steve's approach is how an electrical engineer would approach it. Each Chanel is individually regulated for the voltage and current the channel requires.

For a simple 20ma led, I wouldn't worry about it. they are really quite flexible @20 ma :)

amdlo (author)  Wired_Mist2 years ago

Oh thanks for the answers :) But that's a real flaw in my design... I want to regulate the individual LEDs only with changing the current continuously from a full brightness to a fully dimmed light. If there is a sudden turn off then I will use the other solution for sure. Or maybe if the "voltage cutting" resistance is high enough then there wouldn't be such a sudden jump in dimming. For example if the voltage drops below forward voltage when the current would be 5 mA then the LED would have pretty low brightness anyway.

amdlo (author)  amdlo2 years ago

I accidentally found a similar solution in the makershed store. This one is using RGB LED but the regulation looks (from the photos) like exactly the same as mine. I already ordered the components for both solutions, so in a week or maybe two I'll post here how it worked :) Maybe even with photos/video.

2 years ago

I'll be looking forward to seeing what you come up with :D

amdlo (author)  amdlo2 years ago

Sorry, I forgot to put in the link for the mentioned kit:
http://www.makershed.com/products/color-visualizer...

iceng2 years ago

Nice divide of each color, but the 1K pots are probably a problem.

When you reach the near zero of a pot, the 0.05w short resistive element will see the full wattage meant for the whole and probably burn out.

amdlo (author)  iceng2 years ago

Yes, that's what I'm afraid too. That 0.05W isn't enough I'll just switch it for 0.25W that would be enough I think. 5V * 0.020A = 0.1 W

As I wrote in the comment below, I think that it would be better to move the LEDs to the left just before the resistors so that they will receive full 5V no matter what resistance will be in the circuit. What do you think? Would it be better or am I wrong about that?

2 years ago

Mm. No, because the OP still has ~100 Ohm limiting resistors.

-max-2 years ago

I actually covered how to power LEDs in my video: It is about 7:38:

amdlo (author)  -max-2 years ago

The basics of a LED with a resistor are nicely explained in the video, thanks!

-max-2 years ago

It will work fine. It may not be the most efficient method for driving LEDs, but will be suitable.