Constant current source to drive three LEDs with 2xAAA batteries? - Page 1
Forum section: electronics / beginners

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 12:50:51 am
content: Hi there, guys & gals.I'm building a head tracker clip, it's one of those things with 3 LEDs that you attach to your headphones so that the LEDs point to your webcam, and a software (opentrack in my case) is used to track the movement of your head.My problem is that i'm using two AAA batteries in series and a resistor for a current source, so the LEDs get dimmer as the batteries run down.I simulated thisbut it looks like it's no good for supply voltages lower than 2.4V, also the efficiency is atrocious at about a 15%, if my simulation is correct, and I guess it makes sense since both transistors are in the lineal zone at all times.Is there a simple solution to this that would work reasonably well, please?Thanks

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 02:23:18 am
content: Put the 3 LEDs in series and use a joule thief.https://en.wikipedia.org/wiki/Joule_thief

author: ledtester
author_rank: Super Contributor
timestamp: September 06, 2021, 02:47:05 am
content: How much current are you sending through your LEDs? And how long do you want your AAA batteries to last?

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 03:16:47 am
content: Thanks guys. I will try that Joule Thief.I'm looking at something like 500uA to 1mA through each of the 3 LEDs, preferably adjustable. As to how long I'd want it to run for, well, as much as possible.I have breadboarded the circuit in the OP with all 3 LEDs in parallel and it looks like it might work alright. Interestingly, I previously had them running in parallel with a single resistor and that also worked well (with no current regulation, of course). Was I lucky that they were closely matched?Measured 1.784VA at the LEDs at 2.55V supply and 1.94A through the LEDs, 2.15A through the batteries, which means the efficiency is a decent 63%

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 03:39:04 am
content: Quote from: dazz on September 06, 2021, 03:16:47 amI just re-watched BigClive make a joule thief. See below.I think you can change the current draw by increasing the resistor to 10k vs the usual 1k and/or use 10 turns vs 20 turns. Experiment.The joule thief circuit must have a supply voltage less than the total forward voltage of the LEDs you're driving. That's why I said you should put them in series. Also, you don't have to worry about needing to pick closely matched LEDs unlike when they're in parallel. According to Clive, it works down to 0.35V; sucking every last drop of energy.I totally didn't understand your last sentence. Did you really mean amps?

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 03:55:31 am
content: Quote from: dazz on September 06, 2021, 03:16:47 amOkay, I had another look at your original CC circuit. If R is 1ohm or 0.5ohm then the current limit is set for ~650mA or 1.3A, respectively!You managed to pull that from 2xAAA batteries? Wow, do you really need a searchlight clipped to your headphones? :-)Yet your design goal is only 1mA? I'm confused.

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 04:14:53 am
content: Quote from: pqass on September 06, 2021, 03:55:31 amHaha, no, no. I used 270R for R and 5K1 instead of 2K2 for the other resistor. Above I meant to say that Vf was measured at 1.784V at the LEDs, with 1.95A passing through them, while at the input I had 2.54V and 2.15A through the batteries. That gives me 1.784V x 1.95A = 3.48W dissipated at the LEDs and 2.55V x 2.15A = 5.48W at the batteries. so 3.48W / 5.48W = 63% efficiency. Is that right?

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 04:51:44 am
content: Quote from: dazz on September 06, 2021, 04:14:53 amI think your meter is set for milli-amps.See simulation:http://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAUgoqoQFMBaMMAKABcQAWQzkTFCp178o4EAxhhOCMHmJhIaMgshgBMQlLAZSkIdgyQEKbMioATOgDMAhgFcANm3aDhePFx593oiBOianNq6+obGpjAICMSc2NLycDi4ECoglraOzgBOrt4eCEIg2IQeVJiQLADmucX5hZxwohUA7jUlnry1UCyt3J3tfUV63TmDIoNghFS0KixxIFbN5lkA9gAOADoAjmDQGHi8EMTQ2CiMzFCwnAIo0MR4hHEEeHpw2DFIVKyTAgWHU7kUAhCHwFktVpsdnsDmJppdVD0OiBiCC-siQRUAEq5FG5TilUQNPjQApNS4IOaGHGowqTL5NSlUQa4iYAiDTFhrECEYF5bm8rrs8CInkgrporotfkglA+NGy0qI+W8hAYGW8qVo3Gi9HdLk67W8oEgoUVfVG3k6hWw4U-Chq8AA1XqmVg5brba7faHMkwBF2qYeOnc-B8I1uiGe6E+uF+1itZ2O2i0gFSwNJ+0m1Mi0PGzNhjEii0g9N5ipAASee attached schematic.So you're measuring voltage across the  LEDs and then across the battery terminals? Giving: 1.784V and 2.54V, respectivley.Then measuring current entering just the  LEDs and current exiting the positive battery terminal to the combined LEDs+5.1k resistor paths? Giving: 1.95mA and 2.15mA, respectivley.That should yield 1.784V x 0.00195A = 0.0034788W or 3.5mW for the LED power draw.And 2.54V x 0.00215A = 0.005461A or 5.5mW for the total draw.3.5mW/5.5mW = 64%, so yeah, you got the efficiency correct. :-)

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 04:58:29 am
content: Right, sorry about that, got my units all messed up. It's mA and mW, not amps and watts. Doh!

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 05:06:10 am
content: Quote from: dazz on September 06, 2021, 04:58:29 amGood.Now that we got that straight, play with the Joule Thief circuit.I've made several for indicator-type LEDs but never for a searchlight.

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 05:13:48 am
content: Quote from: pqass on September 06, 2021, 05:06:10 amHahaha, thanks again, I'm playing with the simulation and searching for info online for now, but will build one shortly, what a great little circuit!. As far as I could gather, you pick the current by selecting the number of turns in the coil, right? What's the expected efficiency of a Joule Thief if anybody knows?ETA: according tothisa regular JT is between 40 to 60% efficient, close to what I have right now (although I think the circuit with two transistors will get more efficient as the batteries run down). But if the JT can use more of the batteries juice it may very well be the better option.

author: james_s
author_rank: Super Contributor
timestamp: September 06, 2021, 05:29:32 am
content: Seems like what you want is a boost converter, which the Joule Thief is, but there are lots of other boost converter circuits and ICs out there, many of which can offer better efficiency. I don't recall what it was, but I once used an IC designed to boost the output of a single AAA battery up to 3.3V, I think the efficiency was well over 90%.

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 05:34:30 am
content: Quote from: dazz on September 06, 2021, 05:13:48 amhttps://en.wikipedia.org/wiki/Joule_thief#Kaparnik"After testing three transistors (ZTX450 at 73% efficiency, ZTX650 at 79%, and BC550 at 57%), it was determined that a transistor with lower Vce(sat) yielded better efficiency results. Also, a resistor with lower resistance would yield a high current."Yeah, as is, similar efficiency but you get more energy out.The two transistor version at the bottom of page seems to just use one for an on/off control. I don't see how it would improve the efficiency.Continue to Google around for other variations.

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 05:46:56 am
content: Quote from: james_s on September 06, 2021, 05:29:32 amBut I would still need a way to set the current constant, right? BTW, does the Joule Thief do that? because I really need the LEDs to run mostly at a constant brightness.

author: magic
author_rank: Super Contributor
timestamp: September 06, 2021, 06:14:54 am
content: Very crude but perhaps good enough for AustraliaIt relies on multiplication of R1 current by β of Q2. The increase of current with supply voltage is due to Early effectQ1 transfers LED voltage to R1.D1 somewhat reduces current draw from depleted batteries (good for NiMH) and compensates thermal coefficient of the LED (~ -4mV/°C) together with Q1 (~ -2mV/°C each).R2 may be necessary for startup, otherwise both Q1 and Q2 could stay turned off. Maybe 1MΩ would suffice.If the LEDs are matched, just parallel them. If not, parallel multiple (matched) PNP. Transistors from one batch will likely be OK. If not, small resistors in series with the emitters could help but that's starting to get complex and dropout voltage increases too.

author: oPossum
author_rank: Super Contributor
timestamp: September 06, 2021, 06:48:05 am
content: The one part solution...https://www.mouser.com/datasheet/2/362/P22-23-CRD-1729293.pdfThe two part solution would be a JFET and  resistor.

author: pqass
author_rank: Super Contributor
timestamp: September 06, 2021, 06:49:55 am
content: Quote from: dazz on September 06, 2021, 05:46:56 amThe JT is unregulated so another means to regulate the current will be needed.I've changed the JT circuit to add current control. It seems to keep the current relatively constant ~17mA over 1.2V to 3V supply.I haven't breadboarded it so no guarantees. See:http://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCCsB0AM8MUgLAUwLQA5wGY4E4B2ZMSHAJjFkzEwDYJJYopnIMwwAoAFxAublC5fnWxCRzCOnLRCkQrEJ189ZOUiRM+ELGjkcwg2KJVYkMOTrh4IACaoAZgEMArgBseXHMhCOA7nYATgD2AA4AOgCOYHKYvhD40BQcEHqw6iCyqnQ+mOSYGfA4+MiQuuBcYHQiyPjW5MjMdQ2Y4n6BoZExcQkVzOncAEqi2MjYOGL9FU3803qQ3oqjIOMr9eD9S83V4HTNdAn7mwNcYVDIR2yXWW0nulU1qxvk1M8NsyIBweHRsYTxe4DODcaq1DbVZovN5fTq-HoAvoDXQgrgAFX4r3ABRWYBuwKQmHK0nSsCEKiaBhwYHwEkgInQ-wydHkk0KPngbQwhBR+D5XH8mKkxwK2EhD0For2gjuG1gAtu2A2bJAcoVKuVU0s2HlQSF2ImWIkFTM8sFKvFKo01nlAHMVlKVQItuaplKSK0dQrIDd3S87mb3tKLlcJatDsGWsH5XZcccPcGRA4XB4vABjVa7d27cUE+DSGDmXJ1czEJpgAEo-NcPVRv3WFXMHA4XgrHD0-XtyQnZLxFTkAcs0oUCsomo00j4apMZCGHA2ZjJtyedVY5sNo3CB7251OteA06uiYdusBrj2qMqy8Hh4hcC+buzp5UFFpLL3-jedpSOYANRCnjOLaqBcEAAIt works similar to the CC circuit in your first message.Once voltage across the 33ohm resistor reaches 0.65V, the lower transistor shuts off the other. (0.65V / 0.020A = 33ohm)The 100uF cap smooths-out the voltage.

author: magic
author_rank: Super Contributor
timestamp: September 06, 2021, 07:01:21 am
content: Quote from: oPossum on September 06, 2021, 06:48:05 amTwo word answer: dropout voltageBTW, there are dedicated LED drive current source ICs out there. But IIRC most of them also suck in terms of dropout, about 0.7V.

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 07:45:22 am
content: This one looks very similar to the circuit in the OP, doesn't it?. What's the reason for the PNP transistor, please?

author: mariush
author_rank: Super Contributor
timestamp: September 06, 2021, 09:17:34 am
content: For that low current of 1-2mA, you could use a voltage doubler , a charge pump. See for ex. Max1720, LMC7660, TC7660, LM2767 or even more fancy ones like TPS6031X (X=1,2,3) which boosts a single cell (0.9v..1.8v, 2v absolute max) to fixed 3.3v which should be enough for even 3v less and a small resistor to limit current.No inductors, no electrolytics, just a couple ceramic caps and maybe a couple diodes.

author: magic
author_rank: Super Contributor
timestamp: September 06, 2021, 09:27:01 am
content: Quote from: dazz on September 06, 2021, 07:45:22 amMine? It's similar in component count but works quite differently.Q2 supplies current to the LED, of course. And it continues to do so as long as battery voltage is at least 200mV above LED voltage.R1 generates Q2 base current and pulls it through Q1.LED1, Q1 and D1 ensure constant voltage across R1 so that the base current is constant too.

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 09:48:36 am
content: Quote from: magic on September 06, 2021, 09:27:01 amIt works much better than mine in the sim, that's for sure. I'll see if I can figure out how it works, will need to think about it. Thanks!

author: magic
author_rank: Super Contributor
timestamp: September 06, 2021, 10:10:49 am
content: It may be simpler if you remove D1, then there isn't really much leftAnd as I said before, R2 is only required for the circuit to start up and start supplying power to Q1, its current is almost nothing with such low supply voltages.The trick is to use LED voltage as a constant reference to generate Q2 base current. That's where the independence from supply voltage comes from. D1 has a small effect and the thermal compensation isn't even perfect, because there are other sources of error such as variation of Q2 β with temperature and frankly the thermal drift of LEDs is not guaranteed to be -4mV/°C either, it varies from type to type. Try different models in the sim and it all falls apart. That being said, 1% per °C is not going to make or break an LED current source.

author: gcewing
author_rank: Regular Contributor
timestamp: September 06, 2021, 03:45:05 pm
content: If I understand correctly, the LED current depends on the beta of Q2, making it highly unpredictable.

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 04:29:22 pm
content: Quote from: gcewing on September 06, 2021, 03:45:05 pmHow do you guys know these things? Total noob question right thereYou seem to be right according to Spice. The thing is I can always pick the adjustment resistor based on the transistor used. I'm not going to be mass producing this thing or anything like that, but of course it's always good to know the particular limitations of each design.

author: magic
author_rank: Super Contributor
timestamp: September 06, 2021, 06:35:42 pm
content: Because I said soQuote from: magic on September 06, 2021, 06:14:54 amI disagree about unpredictability. It's fairly predictable for any given pair of transistor and LED. Just measure the transistor with your DMM's hFE function, which typically tests common TO-92 parts at about 1~3mA - exactly as needed.You have one of those, right?

author: dazz
author_rank: Frequent Contributor
timestamp: September 06, 2021, 10:20:40 pm
content: Just breadboarded magic's circuit. Efficiency is up to 70% with fully charged batteries. Didn't need the 100K resistor and probably won't bother with the Tc diode. I'll do some tests in the fridge just in case. LOL. This one runs regulating the current for much longer if the simulation is right, which is good in a way, but on the other hand could cause me to overdischarge my Ni-MH batteries below 0.8V.

author: langwadt
author_rank: Super Contributor
timestamp: September 06, 2021, 10:46:37 pm
content: Quote from: oPossum on September 06, 2021, 06:48:05 amnot with 2*AAA, look at the voltage drop ..

author: magic
author_rank: Super Contributor
timestamp: September 07, 2021, 08:08:44 am
content: This oneweirdtrick should reduce current draw at low voltages to less than 10µAR3 bypasses a few µA of Q1 current around Q2 base before Q2 Vbe becomes high enough to seriously turn it on.It also steals ~7µA from Q2 in normal operation, so R1 needs to be reduced a bit and efficiency decreases by 7µA.I removed D1 as it doesn't seem to be necessary anymore. Reintroducing it could push the turn-on threshold even further up.As for thermal compensation, I switched to a PNP model which includes the effect of increasing β with temperature and all is good again. But I wouldn't trust SPICE simulations too much in this regard because the models just aren't great. The exact real world TC of the LED is also unknown, my figure of -4mV/°C came from some ON semi application note which said that -3 to -5 is typical. I found other sources saying it could be -2mV/°C or that it varies with current and may even become positive at high currents.

author: gbaddeley
author_rank: Regular Contributor
timestamp: September 07, 2021, 08:51:45 am
content: Sticking my neck out here. I haven’t built or sim’d it.

author: dazz
author_rank: Frequent Contributor
timestamp: September 07, 2021, 06:43:03 pm
content: Quote from: gbaddeley on September 07, 2021, 08:51:45 amThanks, I'll try that too

author: james_s
author_rank: Super Contributor
timestamp: September 07, 2021, 06:54:07 pm
content: Quote from: dazz on September 06, 2021, 05:46:56 amThe forward drop of an LED will remain fairly constant, so if you start with a constant voltage, all you need is a resistor in series with the LEDs to get a constant current. The *vast* majority of low power LEDs are powered from a constant voltage supply using only a resistor to limit the current. A boost converter will be regulated and will give you that constant voltage as long as the input voltage is within the acceptable range.

author: Zero999
author_rank: Super Contributor
timestamp: September 07, 2021, 08:41:34 pm
content: What's the nominal forward voltage of the LED? If you don't know that, start with what colour is it? Assuming it's white, two AA cells don't really have a high enough voltage to run a white LED off. I have a set of cheep Chinese Christmas lights, which were just wired straight to a couple of AA cells. They were different colours, made with deep blue/violet LEDs with phosphors, so they all had the same voltage drop. I connected two sets in series, powered of a 5V power supply which output slightly more than 5V and gave them to my parents, for Christmas last year.

author: dazz
author_rank: Frequent Contributor
timestamp: September 07, 2021, 09:40:40 pm
content: Quote from: Zero999 on September 07, 2021, 08:41:34 pmI'm using red LEDs with a Vf of about 1.8V, three of them in parallel. I think I'm going with magic's circuit in the end because it's so simple and efficiency is pretty damn good at 70 to 80% depending on thebatteries charge

author: james_s
author_rank: Super Contributor
timestamp: September 08, 2021, 03:02:46 am
content: If you run LEDs in parallel you need a separate resistor for each one. You may get away with running parallel LEDs if they are very well matched but often it will not work. In general it's better to run them in series if you have enough voltage available. That's why I suggested a boost converter.

author: dazz
author_rank: Frequent Contributor
timestamp: September 08, 2021, 04:19:59 am
content: Quote from: james_s on September 08, 2021, 03:02:46 amYeah, I know. Don't know why, but it's working fine without resistors... at least for now. And I didn't even bother matching them. I don't know what I was thinking.

author: james_s
author_rank: Super Contributor
timestamp: September 08, 2021, 06:00:04 am
content: You got lucky, and they're probably from the same batch. There are numerous examples of poor practice that you can get away with, sometimes, but then you might build another one later using a different batch of parts and wonder why it doesn't work right.

author: dazz
author_rank: Frequent Contributor
timestamp: September 08, 2021, 06:03:33 am
content: Quote from: james_s on September 08, 2021, 06:00:04 amI can still add them, if anything, for peace of mind. Will they work with the current source? I modded the red one in LTSpice to have mismatched LEDs and the resistors don't seem to do anything at all.ETA: Oh, wait, I need to pick different resistor values for each led to match the current flowing through each LED, right? I think I'll do that because it would help if one of the LEDs is slightly brighter than the others and I can achieve that with those resistors

author: james_s
author_rank: Super Contributor
timestamp: September 08, 2021, 09:19:36 pm
content: No you can use the same value resistor for each LED, assuming the LEDs are in at least the same ballpark. The idea is to provide some compliance to account for slightly different forward drops, say 1.75V for one LED, 1.77V for another, 1.68V for a third, etc. That handful of millivolts can make a significant difference in forward current if they are all just wired in parallel but if you have an individual resistor on each one you get a bit of wiggle room. If you're using a constant current source you don't much resistance at all, if you have a constant voltage source then pick a resistor that will result in the desired current and assuming the LEDs are all the same basic type the same resistor value will work for all.True constant current sources are rarely used with small LEDs like this, it isn't until you get into power LEDs for illumination that it makes sense to worry about that.

author: dazz
author_rank: Frequent Contributor
timestamp: September 08, 2021, 10:01:22 pm
content: Quote from: james_s on September 08, 2021, 09:19:36 pmI added 100R resistors (two 100R, one 47R for the LED that needs to be a little bit brighter) and it seems to work well.