Go Down

Topic: Help on (non-working) LM317 constant current circuit (Read 17060 times) previous topic - next topic

xl97

Hey gang-

I need some help troubleshooting an LM317 constant current circuit (pcb) that isnt working (as I believed it should)..

well the pcb's came in.. and I assembled a couple..

Here are the files schematic, board layout and a pic of the assembled board.

board:


schematic:


and a pic of the assembled board:


before these boards came, I was using a simple Common Anode RGB led from RadioShack (not a high powered led, simple 20mA spec..etc)

I thought, when the board came... after being assembled and the 3Watt RGB LED star also connected...  it would be a simple 'drop-in' replacement......(meaning just give the board the +7.4v directly from the battery source, and connect the 3 Arduino control/signal lines)....  and it would be 'good to go'.. (so to speak)

however.. I obviously have made an error somewhere.. Im assuming on the board somewhere...

I dont mean physically during assembly, but in design perhaps?  or maybe I'm missing things elsewhere on how this works?  (I had posted the schematic/board for review while designing it)

I have taken the led wires.. connected it to my PSU (+3.3v/1A)..  and tested the LED to ensure it IS common anode, does work, (is super bright)..and wasnt faulty there.

The transistors I'm using:
BC817: http://www.digikey.com/product-detail/en/BC81725MTF/BC81725MTFCT-ND/1305367

And the:
LM317: http://www.digikey.com/product-detail/en/LM317DCYR/296-12602-1-ND/443738

When connected.. it acts as if there is a short somewhere?

the led (RED) is ON...??

RGB in use,...the notoriously 'backwards' labeled DealExtreme 3W RGB star:
http://dx.com/p/3w-led-emitter-on-star-multicolored-rgb-4530

Where can I begin to troubleshoot this?  (I'm hoping I dot need new boards for some reason?)

Im measuring +7.4v at the INPUT (which is right.. its from my PSU)

Im measuring roughly +6.72v on the OUTPUT (I removed the RGB LED and metered the plug/wires ends to get this)
sounds ok with voltage drop across the whole board/components?  (but makes me worries since thats WAY over the vF of the RGB led I'm using)
not sure how to try and measure the current output?

nothings getting hot... (so thats good) LOL  :)

thanks!



Pelleplutt

I'm not sure but what I can se you use an 3900? resistor instead of an 3,9? (R4).

Pelle

polymorph

Yes, I agree. It should be labeled 3R9.

Additionally - do you know that you cannot light all three at the same time? If you try, the one with the lowest VF will light and the rest will not or will be dim.

And red will be the lowest voltage drop.

I would also drive those transistors a little harder. 4.3mA IBE for 320mA of ICE is not pushing it very hard into saturation. A little variation in Beta could cause one or more transistor to dissipate a bit more power, and there isn't much room for that in those tiny transistors. In fact, that requires a Beta of 75, but the minimum rated beta for that transistor at 300mA is only 60.

As for measuring the current in operation, connect a 0.1 or 0.01 ohm resistor in series and measure the voltage drop. If you want to see it operate without an LED, at 320mA a 10 ohm resistor will drop 3.2V, about what the LEDs will drop. So stick a 10 ohm 2W or better resistor in there and measure the voltage.

You did use a resistor when connecting to your 3.3V source, right? If not, you might fry the LED.

Of course the output is high with no load connected. It is regulating the current, and with no current draw, the voltage reaches the maximum it is capable of supplying.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

xl97


Yes, I agree. It should be labeled 3R9.

Additionally - do you know that you cannot light all three at the same time? If you try, the one with the lowest VF will light and the rest will not or will be dim.

And red will be the lowest voltage drop.

I would also drive those transistors a little harder. 4.3mA IBE for 320mA of ICE is not pushing it very hard into saturation. A little variation in Beta could cause one or more transistor to dissipate a bit more power, and there isn't much room for that in those tiny transistors. In fact, that requires a Beta of 75, but the minimum rated beta for that transistor at 300mA is only 60.

As for measuring the current in operation, connect a 0.1 or 0.01 ohm resistor in series and measure the voltage drop. If you want to see it operate without an LED, at 320mA a 10 ohm resistor will drop 3.2V, about what the LEDs will drop. So stick a 10 ohm 2W or better resistor in there and measure the voltage.

You did use a resistor when connecting to your 3.3V source, right? If not, you might fry the LED.

Of course the output is high with no load connected. It is regulating the current, and with no current draw, the voltage reaches the maximum it is capable of supplying.



whooosh..lol..

thanks for the reply.. lets see if I can find some answers in there (they're there.. just over my head a bit) :)

1.) yes.. I will swap out the resistor.. (silly mistake on my end not being more careful grabbing the resistors)

2.) yes.. this set up IS NOT intended to use more than 1 channel at a time.  (no PWM, no color mixing)
depending on the button press/event.. it will toggle/open that specific transistor only.

*however you saying the rest.. is sorta seems like what is happening?
the led should be OFF when powered on.. (like its little, low powered, matching, common anode RGB led from Radioshack behaves)

I put in the small, accent RGB led.. works as it 'should..

I swap out the accent led for the LM317 board and 3W RGB LED STAR.. and its 'on' as soon as it is powered.. not bright either... but 'on'..

logic in the code should be the same..no?  both common anode leds?  I am using internal pull-up resistors on those pins.


3.) I think your saying that the 1k resistor value between the transistor and Arduino pin is too high?  lor is so I get more/full saturate of the gate, allowing the led to get full (constant) current?  suggested value to use?

Im not following on how to measure the current.. (sorry).. and I dont have any LARGE resistors like that around (no 1-2 watt fattys)  just regular old SMD and through hole resistors.. of 1/8, 1/4, 1/2 watt..etc..


4.) Use a resistor when? you mean when 'testing' the LED on my PSU?  I just cranked the voltage down to +3.3v.. and did a quick TAP on the leads.. to ensure it was working/is bright..

no resistor.. (I dont recall if I dialed down the AMPs or not? usually it at 1A or so)


I appreciate the feedback/reply!.. (just trying to take it all in and understand some of the last stuff.. and see how it applies to my project and what specifically I need to changes things to.)

thanks!!


p.s.

I dont understand this:
"Of course the output is high with no load connected. It is regulating the current, and with no current draw, the voltage reaches the maximum it is capable of supplying."

this is my first time using the LM317 chip..and trying to make a constant current circuit ever.  (working my way through it) :)







123Splat

xl,

Check out this site, might help.  http://www.reuk.co.uk/LM317-Current-Calculator.htm

xl97

Thanks...

I used a similar one to get the 3.6-3.9Ohm value I am using now..  to get 320-350mA of current though it..

Im still not clear on how to FIX this though.. (at least as to why the leds are on when connected?)

I will change 3.9K value to 3.9Ohm value (or as close as I can get/find to the value..seems to be a special order value?)  :(

I will lower the value on the 1K resistors to ensure full saturation/opening of the transistor gate as well..
(simple equation for calculating that one?)
All the Beta and Ibe and stuff confuses me still :(

thanks.

polymorph

Quote
logic in the code should be the same..no?  both common anode leds?  I am using internal pull-up resistors on those pins.


Internal pullup? That is only for input pinmode, it has no effect when using a pin as an output.

Quote
3.) I think your saying that the 1k resistor value between the transistor and Arduino pin is too high?  lor is so I get more/full saturate of the gate, allowing the led to get full (constant) current?  suggested value to use?


Yes, too high. (5V - 0.7VBE)/1k = 4.3mA. The practical maximum current from an Arduino pin is 20mA, that is about 1/16 of 320mA, so let's use roughly that. (5V - 0.7VBE)/0.02A = 215 ohms, so closest standard value is 220 ohms.

Quote
Im not following on how to measure the current.. (sorry).. and I dont have any LARGE resistors like that around (no 1-2 watt fattys)  just regular old SMD and through hole resistors.. of 1/8, 1/4, 1/2 watt..etc..


Because it is a constant current regulator, you could put a much lower value resistor in there to test it. It will then drop a lot less voltage across the resistor, therefore require a smaller lower wattage resistor. If you have a 0.1 ohm resistor, 320mA will read 32mV dropped across it, and that is only about 10mW (0.32A x 0.032V = 0.01024W) so even a 1/8W resistor will work.

Quote
4.) Use a resistor when? you mean when 'testing' the LED on my PSU?  I just cranked the voltage down to +3.3v.. and did a quick TAP on the leads.. to ensure it was working/is bright..

no resistor.. (I dont recall if I dialed down the AMPs or not? usually it at 1A or so)


That is a horribly, horribly bad idea. LEDs are not light bulbs. Damage can be done to them in a fraction of a second. The LED you are using is going to be more tolerant of 1A, being rated at 1/3 of that, but that depends on whether or not you limited the current.

One of my coworkers, who (no offense to him) has forgotten nearly everything he's learned through disuse, made a 6x6 matrix of LEDs scavenged from broken equipment, in order to make a cable tester. He tested each one of these tiny LEDs on a 3.6V lithium ion battery, for "just a second". Then installed them. When I heard this, I wired up a battery with a resistor, showed him it working with a good LED, then left him to retest all his LEDs.

They were all damaged. Some were just dead, the rest were dim and orangish.

As for the Red LED being on all the time, I suspect that there is some fault in the circuit. A shorted trace, a bad transistor... What happens if you disconnect only the red LED? Do any of the other LEDs light?

What is the voltage on the collectors of all the transistors when it is connected? On the bases?

With the LEDs, Arduino, and battery disconnected, put your meter on Diode Check and confirm that you have the correct diode drops in the correct direction. Confirm that the CE connection reads as an Open.

A page on how an LM317 works when wired as a current regulator:
http://theparanoidtroll.com/electronics/primers-and-tutorials/other/constant-current-sourceload-lm317/
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

SirNickity

I've not made a constant current circuit yet, so I can't be much help there, but a few comments concern me, so I want to make sure they're addressed:

Im measuring roughly +6.72v on the OUTPUT (I removed the RGB LED and metered the plug/wires ends to get this)
sounds ok with voltage drop across the whole board/components?  (but makes me worries since thats WAY over the vF of the RGB led I'm using)


This is an incredibly common misconception about LEDs.  The Vf is NOT the voltage at which you want to run the LED.  It's how much the voltage drops going across the LED.  Just like a diode drop.  (LED = Light Emitting Diode, so it's no coincidence!  ;))  The voltage has to be higher than this for the LED to light at all.  (Well, there is a knee, but let's pretend it's a sharp cut-off for simplicity.)  There's no need to be concerned with the voltage being too high (within reason...), as long as the resistance is scaled accordingly to keep the total current through the circuit less than or equal to the operating current of the LED.  (20mA for typical indicator LEDs, more for the high-power ones.)

Speaking of which....

I dont understand this:
"Of course the output is high with no load connected. It is regulating the current, and with no current draw, the voltage reaches the maximum it is capable of supplying."

this is my first time using the LM317 chip..and trying to make a constant current circuit ever.  (working my way through it) :)


LEDs light up from current, not voltage.  This is why you are using a constant-current power supply to light them.  The regulator will vary the voltage to whatever degree is necessary to keep the current through the circuit at a set threshold.  You cannot regulate both voltage and current -- only one of the two.  The other is determined by the impedance of the circuit.

Since the LED doesn't care if the voltage is 5v or 20v, as long as the current is within its operating area, the LM317 will keep the current in check by varying the output voltage.  When there's no load (open circuit), the current is at 0mA, so the LM will increase voltage (as much as it can) to try and allow more current to flow.  This is why you're seeing it above 6v.  It's a futile effort, since there's nothing connected and no current can flow at all, but it doesn't know that.  It's just doing what it can to keep that current steady.  If you short the outputs it will drop the voltage to try and limit current instead.  (I don't know if this is safe to do -- LEDs are virtually a short circuit when the voltage is above Vf, but there may be real-world factors involved that differentiate between "virtually a short" and "actually a short".  Gap in my knowledge, apparently.)

Use a resistor when? you mean when 'testing' the LED on my PSU?  I just cranked the voltage down to +3.3v.. and did a quick TAP on the leads.. to ensure it was working/is bright..


As poly says, don't do that.  Never never never never.  If the PSU has a high enough impedance you might get away with it (like some folks do when running Arduinos at 3.3v and connecting LEDs directly to the pins).  Still, an ideal PSU has 0 ohms output impedance and is capable of delivering infinite current.  Infinite amps at 3.3v will of course toast an LED.  Reality will be somewhere in between, but unless you know the output impedance is enough to safely limit current, assume it's an ideal PSU and will turn your LED into a puff of smoke in far less time than you could possibly tap.

A personal anecdote:  I got used to using LCD screens with built-in backlight LED current limiting resistors.  Then I used one that put the onus on the designer to limit backlight current, forgot to verify with the data sheet, and connected it straight to 5v.  I didn't even see it burn out.  It just didn't light up, and never worked again.  It can go that fast.

123Splat

As stated, LEDs are current devices, not Voltage.  As long as you have Vf or Vf+ and stay below Imax, you get a light.  The amount of time it takes to kill a LED is proportional to the amount of current you feed it at any voltage above Vf.  It is actually the heat generated by passing current (yeah, I know, bad english, but the theory is correct).  The more current, the more heat. The longer you apply the current, the longer it takes to disapate the heat, and, the more damage is donr to the junction area and the bond wires.  If you burn an LED at high brightness for a long time and another at half brightness (think current levels), which one do you think will die first?
I have used red LEDs with MegOhm+ series current limiters as pilot lights in 110Vac circuits (more for continuity checking than pilots, but you get the picture.  Voltage isn't really the issue.

Have fun.

polymorph

Quote
I have used red LEDs with MegOhm+ series current limiters as pilot lights in 110Vac circuits (more for continuity checking than pilots, but you get the picture.  Voltage isn't really the issue.


Just wanted to add, you can do that only if you either have two LEDs connected anti-parallel (parallel but pointing different directions) or one LED with a regular diode connected to it in anti-parallel. That is because LEDs generally don't survive even modest current levels when put in reverse breakdown, and the reverse breakdown voltage is not very high.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

xl97

ok..

Im home..

(thanks for the replies)

lets see if I have this straight...

fixes:

1.) 1k transistor >> arduino pin resistors change to: 220ohm
2.) I could NOT find a 3.9 Ohm resistor.. I did however find a 3.32 Ohm one (0805 footprint.. but should fit).. I think that gives me roughly 370mA.. which is just a smidge over their rating.. (but I have heard people over drive these.. and it will NOT be running/on for any length of time only a quick 'blink/flash' at any given time.

*noted about not doing that with my PSU..  ensure the AMP is dialed down the appropriate level the LED needs.

turning it on right now I see its (my PSU) @ +07.3Volts & 0.34A.. which I believe was the last setting I used when checking those RGB leds..


I will address those in a little bit..



moving on though.. the current/remaining issue is that the LEDS are lit when I connect the PCB??

As you guessed it.. when I connect the PCB/LED.. the RED is on.. I disconnect the RED.. green is on.. unplug green.. blue is left.

What is going on?  You had made reference this behavior before about the red being on because it has the lowest vF..etc..
seems like you have handle on this error?  what am I doing wrong?

lastly you want me to meter voltage on the transistor(s):
collectors
bases

I need to look at the data sheet to know what is what.. :)
http://www.fairchildsemi.com/ds/BC/BC817.pdf

Do you want the led 'connected' to the board or off?
(or doesnt it matter for this?)


PSU settings:
+7.4v
1.00A

using the pcb (blue) pic from above....

putting red probe from meter on the battery V+ input pads/wires... (VIN)
black probe on collector:

T3- +7.4v
T2- +7.4v
T1- +7.4v

black probe on base:

B3- +6.66v
B2- +6.66v
B1- +6.66v

as far as this;"With the LEDs, Arduino, and battery disconnected, put your meter on Diode Check and confirm that you have the correct diode drops in the correct direction. Confirm that the CE connection reads as an Open."


so take the constant current board/pcb (blue one in pic above)..

disconnect battery/Arduino and LED (plain pcb)..

what setting is the DIODE CHECK?  continuity?

And there is NO DIODE on the pcb.. just the pads.. that have been bridged..(little piece of metal soldered in...in the pic?)

so.. should I be going ahead and doing number 1 & 2 above? or should I not bother yet? I mean having a little (dim) led, but working in the correct manner, just means I need to adjust values on the T resistors and the LM317 resistor..
but logically, its working..  (no, I am stuck in the scenario you mentioned about the lowest vF is being turned on..etc)

thanks!




123Splat

polymorph,
Or something like a 1A rectifier diode in series to clip the input to halfwave.  Good point!My bad for leaving it out...  (I would say "gettin' old and foggy, but I ain't gettin', I'm already there....)

123Splat

xl,
With red meter lead on batt+, :
AND BLACK lead on collector's you are measuring Batt voltage, O.K. ,  good batt,
Black lead on Base, BAD IDEA, you are putting Bat Volts (7.4) on Arduino pins, not good for arduino.

With everything disconnected,  not sure what conditions you are testing for, but Diode Check setting measures resistance of semiconductor junction, if forward bias (+lead to P side and - to N side, should read close to zero ), if reverse bias (reverse of the prior) should read SOMETHING ABOVE 1 KOhms.  maybe verifies your Q's are good and installed correctly...  ???

I would think one thing to test is: with everything, but the tri-LED, hooked up.  meter VOLTAGE between B, G, & R pads and Anode pad (red + meter lead on anode pad and black - meter lead on R pad, then B, then G , to say one of them at a time) if the circuit is working as planned, you should see the meter jitter between 3 or 4 volts and some lower reading when the software makes that pad active and then switches it off.  If that does not provide the desired results, meter VOLTAGE between the various transistor bases and ground.  should get same type of volts reading only lower,   If test 1 fails and test 2 works, the software works and the board is bad.  if test 2 fails, software is not turning the the pins on (bad software),or your arduino (the  micro controller) is fried.   That is a start. from there we can proceed to narrow down what is wrong.


xl97

ok.. well Im getting ODD results..

but lets talk about 'software' (meaning my sketch/code...yes?)
if it perfectly fine with 'regular' (low powered), RGB led (common anode, only 20mA spec)..
what , software wise, could be the problem/issue when changing the led (and add hardware/constant current board)?

now, on the (more) bad news..LOL..  hopefully this will let us (you guys) figure out what is wrong?
(I'm starting to think I have the pin out wrong for the transistor or something?)

its:

3           
1 2

---------
  collector
base/emitter


anyways.. the data...

when metering the the RGB voltage 'output' pads (red probe on common/anode pad..... black probe to each of the R-G-B output pads)
R: +6.77v
G: +6.77v
B:  +6.77v       

and I think the "G" pin was the one that was LIVE during the button press (no led)..but when metered & button pressed, the voltage dropped to around +5.9v or so..



When I had black probe on GND/Batt-.. and red prob on on the "BASE" (pin1 of the 'pyramid' pinout) of each transistor....
they metered 0.74


xl97

Im tired, calling it night.

thanks for the help so far guys..

I'll check back in, in the morning, see what anyone has to say.

thanks!   :)

Go Up