Go Down

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

SirNickity

#15
Oct 12, 2013, 06:01 am Last Edit: Oct 12, 2013, 06:03 am by SirNickity Reason: 1
Well, as I think you are starting to see, when all three LEDs are lit in parallel, the one with the lowest Vf turns on and conducts, shunting the voltage away so that it's not high enough to meet the Vf of the other LEDs which require higher voltage to turn on.

Now, I've looked at the board design and datasheet for the transistors, and it looks OK to me.  The most likely reasons for this that I can see are:

1) Your transistors are all turned on by default somehow.  Check by supplying power, but not a digital input.  Instead, ground the base of all three transistors.  This should ensure none are turned on.  If one of the LEDs is still turned on, that leads to likely problem #2:

2) The transistors are bad.  Perhaps a slip-up during testing somewhere fried them.  If the LEDs all go out during test #1, but red turns back on if you short any base to Vcc (through the resistor!), then it could be that...

3) The LED cathodes of the LED are shorted somewhere.

polymorph

Quote
if forward bias (+lead to P side and - to N side, should read close to zero


No. All the DMMs I've seen with a diode check function will give you a direct readout in volts. So a forward biased silicon junction will read somewhere between 0.4V and 0.7V.

A transistor is made of a couple of PN junctions. In this case, NPN indicates that to a meter on diode check, a good NPN transistor will give you readings consistent with two diodes pointing "out" from the base. So with the red lead on the Base, you'll get about 0.6V drop with the black lead on either the Emitter or Collector lead. With the leads reversed, black on Base, etc., it should read OPEN or OL (Overload) or whatever method your meter uses to indicate out of range. Also, measured from Collector to Emitter should also read as OPEN or OL, in either direction.

But other components connected will disturb those readings, that's why I have you disconnecting the LEDs and the Arduino. The one point of contact on the Emitter will not disturb this test, because current requires a complete path to flow, and in this way the only complete path is with the meter.

I meant for you to measure those voltages with reference to Ground, aka common. So put the black lead on the Arduino ground and use the red lead to measure voltages on the transistor base and collector terminals.

Perhaps you were sent the wrong transistors, and they are wired differently. If the Base is on terminal 3, then it would just have a forward biased PN junction from there to pin 2, no matter if that is the Collector or the Emitter. I am hoping for the diode check to reveal a problem with this.

Sometimes the continuity function on a meter also serves as a diode tester. In that case, it may not read out in volts, but it should read something in the range of a few hundred or less with a forward biased PN junction, and OPEN or OL when it is reverse biased. You can test your meter on a known good silicon diode.

Oh, yeah... just so you know, a transistor is not simply two diodes stuck together. When I was first learning about transistors, I got that idea in my head and started sticking diodes together, anode to anode or cathode to cathode, and trying to get them to amplify. But it does have the structure of, for an NPN, a thin layer of P type semiconductor sandwiched between two N type semiconductors.
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

whew... thats alot to take in at once. :)

lets see if I have things correct in what Im being asked to do:

@SirNickity-

first thanks for taking the time to go over the board layout and datasheet for the transistors.. (glad I'm not crazy and that it looks to be set-up/designed correctly) :)


ok....

1.) keep batery/power to the PCB.. disconnect the Arduino signal/control lines)
*(what do you mean by GROUND the BASE onall transistors?)

meaning black probe on battery GND? and red probe on the BASE of each transistor? (or vice versa?)

** I connected RGB again....  powered it up.. same deal (RED led on)..
I take out the Arduino signal lines tot he PCB.. and each one (led) goes out..  when all Arduino lines OUT..LED is OFF.


2.) when I take RED prob, put it on Vcc (positive supply voltage).. and touch BLACK probe the BASE (pin 1) on the transistors..
* (actually I am touching it to the RIGHT side of the resistor, and not directly tot he BASE pin of the transistors)

Each of the leds light up respectively..  (not very bright or anything.. but about the same it did before)
(Im sure changing the 1K resistor values and the 3.9k > 3.9Ohm will help on this a bit though...right?) :)

3.) checking the RGB led with a PSU & meter doesnt seem show any signs of shorted LED?



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

@polymorph -

(trying to understand it all)  I dont have any kind of DIODE setting? (but I could be missing it? not sure what it looks like?) I have a continuity setting?

1.) NOT POWERED
Red probe to BASE
Black probe to Emitter/Collector
Results:
755-756, (from 1),... on all 3 transistors.. at each Emitter & Collector

Reversed..
Black probe to BASE
Red probe to Emitter/Collector
Results:
1 (no change)... on all 3 transistors.. at each Emitter & Collector


2.) "I meant for you to measure those voltages with reference to Ground, aka common. So put the black lead on the Arduino ground and use the red lead to measure voltages on the transistor base and collector terminals."

I will do this again.. but I wanted to ask.. if ann GNDS are connected  isnt that the same thing?

I have battery pack connected to Arduino.. and battery pack also connected to breadboard coming from same point/wire..

anyways.. tapping one of the GND pads on the Arduino... (Black probe)

and testing the BASE & COLLECTOR pins on each transistor:

1.) Base-
T3:  0.77v
T2:  0.77v
T1:  0.77v

when fired.. the 'active' pin drops to:  0.067v


2.) Collector-
T3:  0.03v
T2:  0.03v
T1:  0.03v

when fired.... NO CHANGE


Thanks guys...

Im hoping to finally solve this (one way or another) and but this rest today.. either order more parts.. fix whatever it is Im doing wrong..  or something. :)

swapping out the resistors now.. :)

I'll check back in a few after the surgery is done. ;)


xl97

I have swapped out the resistors..

* 3.9K to a 3.32Ohm  (all I could get my hands on for the moment, until I order some true 3.6Ohm ones to get a solid 350mA)
* 1K resistors (3) all switched to be 220ohm value


this will just give me a super BRIGHT, non-functioning board now.. :)
(as it still is "ON" when powered up) 

thanks.


polymorph

When in continuity check on your meter, what does the display say when the leads are not connected to anything, and not touching each other? Is that a blinking "1"? If so, it should be indicating out-of-range, aka Open. In that case, the transistors sound OK.

So when you disconnect the Arduino pins from the base resistors, the LEDs go out? That sounds like the Arduino is the culprit.

With the Arduino powered up but with the LED driver board disconnected, what voltage do you measure on the Arduino pins that are driving the transistors? They should be at 0V or very close to it when the LEDs are supposed to be OFF, and go up to or close to 5V when a given LED is supposed to be ON.
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

polymorph

As for Ground or Common, unless we are measuring very tiny voltages at high current, you can use the same ground point to measure all those voltages from.

A voltage is measured from a reference point, and we use a circuit Common which we usually call Ground.

From the numbers you gave, it sounds like your meter's Continuity setting also works as a Diode Check. Most meters are built that way, now.

Quote
2.) when I take RED prob, put it on Vcc (positive supply voltage).. and touch BLACK probe the BASE (pin 1) on the transistors..
* (actually I am touching it to the RIGHT side of the resistor, and not directly tot he BASE pin of the transistors)

Each of the leds light up respectively..  (not very bright or anything.. but about the same it did before)
(Im sure changing the 1K resistor values and the 3.9k > 3.9Ohm will help on this a bit though...right?) smiley


Do you mean the black and red probes of your voltmeter? What kind of meter do you have? A typical DMM (digital multimeter) has a resistance of 10M ohm (10 million ohms) and shouldn't cause more than a glimmer of light in the LED, just because that minuscule uA (millionths) of current is being amplified about 100 times by the transistor. Is that what you are seeing? If so, that should mean the transistors are working.


So... with the Arduino disconnected from the LED driver, the LEDs are not lit, correct? If you connect your meter from V+ to the base resistor, that LED lights very dimly, correct?

Ah... with a 220 ohm resistor in place of the 1k, I suggest you also put a 10k (or anything up to about 100k, whatever you have on hand) from the Base to the Emitter/ground.

If I'm reading what you are saying correctly, you have the Arduino switching the wrong way round. Pulling down to light up. Complicated by the fact that tiny bits of leakage current in the transistor may be amplified to light up the LEDs.

I missed that before. You were driving low current 20mA RGB LED before, now with the driver transistors acting as inverters, your code must send a "0" to turn them off, and a "1" to turn them on.

Could you post your code? Don't forget to use the Code tags. Click "Preview", then look for the button labeled with a "#".
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


When in continuity check on your meter, what does the display say when the leads are not connected to anything, and not touching each other? Is that a blinking "1"? If so, it should be indicating out-of-range, aka Open. In that case, the transistors sound OK.

So when you disconnect the Arduino pins from the base resistors, the LEDs go out? That sounds like the Arduino is the culprit.

With the Arduino powered up but with the LED driver board disconnected, what voltage do you measure on the Arduino pins that are driving the transistors? They should be at 0V or very close to it when the LEDs are supposed to be OFF, and go up to or close to 5V when a given LED is supposed to be ON.


1.) When in 'continuity' mode..
it is a static '1'.. when not touching anything..


2.) When metering the Arduino pins/leads..
I was getting close to +5v..  (not +0v)...  and when 'pressing the button'... it would only drop a little bit..  (not down to +0v, only around +4.8xv)

So I opened up the IDE.. and looked to see if I had inadvertantly made the pins HIGH..

I 'did'!!

so I corrected it:

  //set-up main barrel led(s)/pins
  pinMode(ledR, OUTPUT);
  //digitalWrite(ledR, HIGH); //no float
  pinMode(ledB, OUTPUT);
  //digitalWrite(ledB, HIGH); //no float
  pinMode(ledG, OUTPUT);
  //digitalWrite(ledG, HIGH); //no float


by commenting out those lines..

then I tried to the original, low powered RGB led (common anode)..  and as soon as I powered it up.. all channels in the RGB were on!!!  (an odd mix of 'white') 

so I removed that.. and plugged in the high powered RGB led (through the constant current board)..

and the leds were "NOT" on this time???..

I tried out the sketch.. and they didnt turn off?  (however Im fairly certain that is because the sketch (which initially had them all HIGH on initialization).. turn then HIGH for off)

so now Im a bit confused... about the behavior between the two RGB leds? and the code?

isnt LOW = "ON" for common anode RGB LEDS?

Im mixed up somewhere?  lol



xl97

#22
Oct 12, 2013, 08:10 pm Last Edit: Oct 12, 2013, 08:15 pm by xl97 Reason: 1
for a sanity check..

I checked Radioshack part number to see WHY these two 'common anode' leds behave differently/opposite.
http://www.radioshack.com/product/index.jsp?productId=3020765

only difference is one is high powered/needs a constant current driver..... and the other was driven directly from Arduino pins

I went back to the sketch.. and reversed my logic:
added a new boolean variable called: commnoAnode

and then for all my digitalWrite() lines.. I did a quick conditional check;

Code: [Select]

if(commonAnode){
    digitalWrite(currentFireColor, HIGH);
}else{              
    digitalWrite(currentFireColor, LOW);
}


and NOW the high powered LED sems to work FINE.. and how it should (using the constant current board).. its bright too..


but now.. when I go back to the accent RGB led from RadioShack...

I plug it in.. all leds are ON..
I change to commonAnode = false;
(just to check)
same thing.. all leds are ON.....

HOWEVER... as soon as I press the button (for each color).. they turn off, and then behave normally.. (when commonAnode = false;)

(like they are not initialized correctly or something?)..then one 'used' they work?

IMHO... these two RGB leds should be interchangeable?.. right?

either plug in directly the small/accent RGB led directly..
or replace with t he pins/lines from the constant current board?

So right now..  

Im left with a WORKING board.. using the high powered LED.. (YEAH!.. thanks!)..

but I am can not get the small RGB led to work? (and Im confused as to why?)


editL

*DOH!..

I totally missed your other post!   :smiley-eek:

"I missed that before. You were driving low current 20mA RGB LED before, now with the driver transistors acting as inverters, your code must send a "0" to turn them off, and a "1" to turn them on."

ok.. this make total sense now!  and is the behavior I am getting..

thanks!  :)

westfw

Quote
I will change 3.9K value to 3.9Ohm value

That resistor is also looking to small in terms of its power rating.
You're running 320ma through a 3.9ohm resistor, so it's dissipating I*I*R = 0.4W, so it should be at least a 1/2W resistor.
An 0805 resistor is usually 1/8W, and a 1206 is usually 1/4W.
(Yes, it's really annoying that the 317 CC supply needs a power resistor, instead of having all that power dissipated by the regulator.  Grr.  Assorted Stepper Motor Drivers are similarly annoying.)

polymorph

Cool! Problem solved.

As for the 3.9/3.6/3.32 ohm resistor, westfw is correct, you need to calculate power dissipated in it.

1.25V x 0.35A = 440mW

You should always get a resistor -at- -least- double the power rating. That is just good engineering practice. So a 1W resistor will work.

Resistor power ratings go out the window as soon as you put other hot components next to them, put them in a box, lay a wire across them, restrict the air flow, etc. So never run a resistor at close to it's rated power.
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

thanks!.. yes.. in the end, since switch from DIRECT common anode RGB led.. to a high powered one that was powered by a constant current board, I needed to invert the logic.

Outside of the update/suggestions on a more accurate value LM317 current regulating resistor... and the 1K >> 220ohm value edit...  (which I appreciate!...thanks guys!)
the logic was the main issue that is no solved. :)

Question:
being a noob/lack of experience.. I rarely give the wattage/power rating of a resistor any thought. (unless noted or am serverly trying regulate the current from a higher voltage or something)..

in THIS situation.. what can be done?  or more appropriately.. what SHOULD have been done?

if one is wantign to keep things SMD, and a very small footprint board..

how can you one use 0603/1206 components?  Are are there other smaller value components that meet these 1/2-1watt power ratings?  or just through type resistors?..etc..


that being said..  and knowing I am using a 0805 (all i could find.. I didnt have anything close in a 1206 footprint like I thought)

A.) if I could order something that would FIT on this current PCB.. to replace the 3.32Ohm resistor.. what would it be?
B.) knowing my application/use for this board/project... how much of a (negative) factor is this against me?
There will be NO color mixing (single color/channel at any given time)
There will be NO long period of time the led is on.. (simple toggle on/off...mSecs)
(its being use as a barrel/muzzle flash.. when the trigger is pulled)

Although not perfect/correct power rating on resistor..  knowing it wont be on for any length of time...  thoughts?
can I get away with it?  if not.. anything I 'can' use/get to use on the current board?

thanks!

polymorph

How short is the pulse?

You can integrate power over time, to some degree. If the pulses are very short and the time off long enough, the resistor won't heat up enough to damage it. However, even with long off times, a pulse that is in excess of the power rating can damage or even explode the resistor.

Unfortunately, I cannot tell you exactly what those times would be. If you can tell me in fractions of a second how long an LED will be on, and the minimum time it'll be off...
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

westfw

Quote
what can be done?  or more appropriately.. what SHOULD have been done?
if one is wantign to keep things SMD, and a very small footprint board..

Yes, it's easy to get into a mindset of "digital logic is low power, LEDs are low power; I don't need to pay any attention to the power ratings of my resistors."   And then you notice that resistors keep getting smaller, and even at 40mA through a red LED (~3V drop on the resistor) is more than the 0.1W rating of common resistors...

In this case, it looks like 1W SMT resistors start at about the 2512 package size, and that that would still fit on your PCB if your other smt components went down to 0805.  It would be "easy" to put a big SMT resistor on the reverse side of the PCB, but that would make for more difficult assembly.   If I had a whole bunch of your existing board, and wasn't TOO space-constrained, I'd be temped to kludge in a TH 1W resistor between the regulator tab and the "common" output; it looks like it would probably fit.  Here's a picture illustrating both possibilities:

polymorph

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

Thanks..

I think I'll just leave these 5 I have as is (or tack on the 1W bridging the regulator tab to the 'common' by the RGB output pads)
there are really no size constrains on where the pcb is being housed.(lots of room)  this is all just for fun/stage prop as well so nothing critical depending on it.

but in the future.. I think I'll just re-design the pcb, and use a '2512' 1w resistor..  to make them look a bit nicer.   (and remove the diode pads too I suppose) :)

*(I have never used a 2512 sized resistor before, so I'll need to order some of those as well) :(


Go Up