Help Needed with driver circuit design

viperstd

Newly Enlightened
Joined
Apr 4, 2008
Messages
11
Hi! My first post! I have spent a while digging around here since I was pretty stuck on how to make my project for a "reasonable" amount of money and I am completely new to electronics.

I programmed a 16F84A to make patterns and everything worked great up to there! However, I want to take the TTL from the PIC and use it to control some much higher load sources. I kept coming back to SSRs since I knew relays from cars, but they were very expensive and big.

1. Take the 5V TTL and put it into a TLP250 optocoupler (Toshiba Photocoupler) ~$1.90

2. Take the 10-15V DC from my power source (aka a car) and send it to an LM317 (national semiconductor adjustable regulator) ~$1.00

3. Use the current regulated out from the LM317 to my load (3 luxeon rebels in series) $5.00x3

Well, maybe a bit more information is needed. The signal coming from the PIC is already PWMing the signal. The end-project that I am working on is for an emergency signaling device for my father's (a firefighter) personal vehicle. Rather than buy a commercial one, I wanted to make him one as a surprise.

I am strobing the individual light segments at varying duty cycles (up to ~45Hz strobe). Additionally, flash patterns mean that any given light is not on for more than .4s at a time.

Am I calculating the power dissipation in R2 correctly?
Assuming that I have 0.689 A to the string of LEDs, and each LED sees a 3.85V drop, that leads to (3*3.85)*(0.689) =~ 7W...

or is the voltage seen by R2 the difference between the supply voltage (10-15V) and the voltage drop on the leds...
@ worst case: ~15.0V-3*3.85V->3.45V*.689A= 2.38W
@ (12V-3*385V)*.689 = .31W


What happens if the auto voltage drops below 11.55V in this case? Does my seen current just drop and I get a graceful fade-out, or will the LM317 crap out?

I know that the LEDs are going to eat up some power no matter what... but they are only 1W each. It seems wrong that I am going to have 10W in the resistor and 3W on the series of LEDs. Seeing as I am planning on having 7 segments, that would be a whopping 91W! That seems way out of hand. How can I get it closer to the 21W from just the LEDs?

p.s. sorry about the napkin-esque drawing here and please be gentle, this is my first serious project and I slept through my only two EE classes about 5 years ago. :ohgeez:


project1.JPG


project2.JPG





I noticed IsaacHayes has used an LM317 before. I am itching to go and buy parts! But I am not comfortable with this solution yet.
Should I be considering different LEDs for this? I was specifically considering the LXK2-PD12-S00 and PW12-S00 both driven at 700mA. Would I gain much from driving at a higher current, or will I kill the LEDs if the strobes are left on for an extended period?

Thank you so much, and I am glad to have stopped lurking as "anon" and become a member.

Cheers
 
Welcome to CPF. Great first post and interesting project! I have not had a good read of it but looking at your schematic, you will need to switch the Adj/Out pins on the LM317 for the constant current driver. Cheers,

Paul
 
The voltage across R2 is 1.2V; this is how changing the value of R2 allows the LM317 to adjust I to a constant value. R2 has the same amount of current flowing through it that the LEDs have, so in your example that would 0.689A. Power dissipated in R2 is V*I, so 1.2V * 0.689A = 0.8268W. Figuring another way, P = I^2 * R, or 0.689A*0.689A*1.74ohm = 0.826W.

The LM317 is what ends up dissipating any additional power as heat.

If your Vin falls below 1.2V (R2) + 3*Vf (LEDs) + 1.5V (LM317 dropout voltage), current will decrease proportionally based on the voltage-current curve of the LEDs. Ie, you will get "a graceful fade-out."
 
Welcome to CPF. Great first post and interesting project! I have not had a good read of it but looking at your schematic, you will need to switch the Adj/Out pins on the LM317 for the constant current driver. Cheers,

Paul

I don't follow. This was my inspiration for the constant current per the LM317 spec. sheet:
project3.JPG


And I was rereading my original post and I realized that they aren't 1W LEDs... sheesh! I'm not sure where my head was (maybe it is this terrible cold/fever I have right now). If a given led is seeing 3.85V @ .7A, P=2.7W per diode... at 1A they would be 3.85W! Hot little suckers. So, 70W in LEDs.
 
I don't follow. This was my inspiration for the constant current per the LM317 spec. sheet:
project3.JPG


And I was rereading my original post and I realized that they aren't 1W LEDs... sheesh! I'm not sure where my head was (maybe it is this terrible cold/fever I have right now). If a given led is seeing 3.85V @ .7A, P=2.7W per diode... at 1A they would be 3.85W! Hot little suckers. So, 70W in LEDs.

This schematic is correct for a CC LM317. It's not the same as your sketch. The load is connected directly to the Out pin on your sketch. It is connected directly to the Adj pin in the spec sheet schematic. Cheers,

Paul
 
The voltage across R2 is 1.2V; this is how changing the value of R2 allows the LM317 to adjust I to a constant value. R2 has the same amount of current flowing through it that the LEDs have, so in your example that would 0.689A. Power dissipated in R2 is V*I, so 1.2V * 0.689A = 0.8268W. Figuring another way, P = I^2 * R, or 0.689A*0.689A*1.74ohm = 0.826W.

The LM317 is what ends up dissipating any additional power as heat.

If your Vin falls below 1.2V (R2) + 3*Vf (LEDs) + 1.5V (LM317 dropout voltage), current will decrease proportionally based on the voltage-current curve of the LEDs. Ie, you will get "a graceful fade-out."

Ok. I think I get it. It sounds like I am not going to have enough voltage to drive these guys! I might have to drop to 2 leds per segment then.
1.2V (R2) + 3*3.6 (LEDs) + 1.5V(LM317) = 14.4 V... a strong alternator

1.2V (R2) + 2*3.6 (LEDs) + 1.5V(LM317) = 10.8 V... "normal" full brightness on a run down battery.

at 13V(source)-1.2(LM317 Vref)-1.5V(LM317 drop) = 10.3V
10.3/3=3.43V per LED?

According to the datasheet on luxeon's site. I am going to lose quite a bit of light... Is this correct? ~580mA at this voltage?
 
This schematic is correct for a CC LM317. It's not the same as your sketch. The load is connected directly to the Out pin on your sketch. It is connected directly to the Adj pin in the spec sheet schematic. Cheers,

Paul

Whoops!! Thank you. Even when I double checked I didn't catch that. :oops:
 
Ok, more of an actual light-output question. Upon even further inspection, it seems that I will only be able to run 2 LEDs at a time and .7A will be pushing it.

Am I better off running 3 in parallel or 2 in series? I am planning on using the base here: http://www.luxeonstar.com/item.php?...d=&link_str=1394&link_catg=&partno=OPK2-1-003
and different lensing depending on the location on the lightbar.

Would I be better off just using a bunch of high-flux LEDs and scrapping the K2s? I know it would be cheaper... :sigh:

This is more of an opinion question. Which is better, more spiders in a parallel/series system or just 2 K2s being their bad selves? Better ideas? I am holding off pulling the trigger on the part orders until I figure this out!
 
Hi Viper, I think I may be able to offer some assistance here.

See if I have this straight. You would like to run seven segments each with 3 LED's in series. So you have a 5V signal that you would like to use to switch the LED's on and off.

Alright, I little math.
The power dissapaited by each segment is fairly simple to calculate if you are using an analog driver (which you are)
P = V * I
So starting at 12V, 12*0.7 = 8.4W per segment. However, car voltage is not always 12V. At 15V the power dissapaited by each segment would be 10.5W or 73.5W for all the segments.

Lets do a little more math on power dissipation. The LED's will dissipate (3*3.85)*0.7 W = 8.085W, your resistor 0.8W, so ~8.8W for the LED's and resistor. Total power dissipation calculated above was about 10.5W with at an alternator voltage of 15V. So the LM317 will be dropping ~1.7W as pure heat. Looking at the datasheet, the unit may run with no heat sink, however it will be HOT! I would suggest using some kind of heat sink on the 317. However, assuming your car voltage doesn't go up a lot over 15, there shouldn't be any problems driving these LED's in this setup.

The only way you are going to improve on this is to scrap the analog regulator (LM317) and go to a "digital" method, that uses a swithing converter. This will be more expensive, possibly way more expensive.

I don't think the gain to a switching converter would justify the cost in this application, unless heatsinking the 317 is a big problem.

So your most of the way there, only one problem with the circuit you have layed out. I don't think the tlp250 will work to drive the LM317 directly, all the LED current would need to push through the optocoupler. While it is designed to handle currents up to 1.5A, it is not designed to do so continuously, the datasheet says that the 1.5A rating is for a pulse of no longer than 2.5uS and a frequency less than 15kHz.

There is an easy fix to this problem, however it will require the addition of one more part to your circuit. Use a mosfet to switch the power on and off to the circuit, you can find mosfets that can handle lots of current in a continuous on state. Perhaps even simpler, eliminate the optocoupler completely and drive the mosfet on and off directly from you uController. I would use an n-channel mosfet and make sure you wire it like follows:

Batt+ -> LM317 -> LED1 -> LED2 -> LED3 -> MOSFET Drain

Then connect MOSFET Source to ground.
Connect the MOSFET Gate to either your optocoupler or uController

Do not try to put the MOSFET on the high side of the circuit (between Batt+ and LM317) an N-Channel mosfet needs the Gate-Source voltage to be at least a few volts to stay in the on position. With the source connected to ground this is easy, with it above ground this is difficult.

Alright, I think I'm done, let me know if you have any questions.

Ed
 
Hi Viper, I think I may be able to offer some assistance here.

See if I have this straight. You would like to run seven segments each with 3 LED's in series. So you have a 5V signal that you would like to use to switch the LED's on and off.
exactly!

Alright, I little math.
The power dissapaited by each segment is fairly simple to calculate if you are using an analog driver (which you are)
P = V * I
So starting at 12V, 12*0.7 = 8.4W per segment. However, car voltage is not always 12V. At 15V the power dissapaited by each segment would be 10.5W or 73.5W for all the segments.

Lets do a little more math on power dissipation. The LED's will dissipate (3*3.85)*0.7 W = 8.085W, your resistor 0.8W, so ~8.8W for the LED's and resistor. Total power dissipation calculated above was about 10.5W with at an alternator voltage of 15V. So the LM317 will be dropping ~1.7W as pure heat. Looking at the datasheet, the unit may run with no heat sink, however it will be HOT! I would suggest using some kind of heat sink on the 317. However, assuming your car voltage doesn't go up a lot over 15, there shouldn't be any problems driving these LED's in this setup.
Ok, I am with you to here.

The only way you are going to improve on this is to scrap the analog regulator (LM317) and go to a "digital" method, that uses a swithing converter. This will be more expensive, possibly way more expensive.

I don't think the gain to a switching converter would justify the cost in this application, unless heatsinking the 317 is a big problem.
Keeping cost low is great. I am already looking at a BIG budget in LEDs. :duh2:

So your most of the way there, only one problem with the circuit you have layed out. I don't think the tlp250 will work to drive the LM317 directly, all the LED current would need to push through the optocoupler. While it is designed to handle currents up to 1.5A, it is not designed to do so continuously, the datasheet says that the 1.5A rating is for a pulse of no longer than 2.5uS and a frequency less than 15kHz.
Since I am only at 700mA (less than 50% of max) and I am already PWMing the signal and Strobing it, is this a concern??

There is an easy fix to this problem, however it will require the addition of one more part to your circuit. Use a mosfet to switch the power on and off to the circuit, you can find mosfets that can handle lots of current in a continuous on state. Perhaps even simpler, eliminate the optocoupler completely and drive the mosfet on and off directly from you uController.
I was trying to use a photocoupler to have a large isolation from the high current of the light segments. I don't want to fry the PIC.

I would use an n-channel mosfet and make sure you wire it like follows:

Batt+ -> LM317 -> LED1 -> LED2 -> LED3 -> MOSFET Drain

Then connect MOSFET Source to ground.
Connect the MOSFET Gate to either your optocoupler or uController

Do not try to put the MOSFET on the high side of the circuit (between Batt+ and LM317) an N-Channel mosfet needs the Gate-Source voltage to be at least a few volts to stay in the on position. With the source connected to ground this is easy, with it above ground this is difficult.

Alright, I think I'm done, let me know if you have any questions.

Ed


I will check out the mosfets now. :twothumbs
 
Ok, I'm a bit confused now. I plan on getting most of my components (sans LEDs and reflectors) from:
http://www.futurlec.com/

There are many transistors to choose from, but I don't know what I am looking at really. Would a power NPN be right (e.g. 2N5191 Power Transistor)?
That is listed as a 4A, 40W, 60-80V... too much?

I would appreciate it, if you would please give me an example of an acceptable transistor.

Cheers
 
I have used the IRF530 numerous times to control LED's with PWM circuits, that would probably be my reccomendation.

As far as using the opto-coupler, my gut feeling tells me that the configuration you have in your circuit would not be reccomened for long term circuit survival. While, you might be within specs for the chip depending on your PWM frequency and on-time of the PWM signal, your use of that chip is not what it was designed for, and I would expect you would have problems with failure with that design.

I think the easiest solution would be to do away with the opto-coupler and connect the PIC directly to the FET. Damage to the PIC is fairly unlikely, the only event wich would cause voltage to feedback to the PIC would be a failure of the FET, the FET has a breakdown voltage of 100V, so you would need a fairly large voltage spike of over 100V while the FET is in the off position. A spike this large would also most likely destroy the LED's and LM317. So at that point, might as well destroy the whole circuit right? :grin2:

If it were me, I would wire the PIC output directly to the FET. Some of my more cautions co-workers would wire a ~300ohm resistor (value not critical, 100ohm-400ohm will work) in series to help minimize any large current flow either to or from the PIC. However, if your like me then you hate wiring extra stuff in, and you'd go without. :D

My suggestion to add some overall circuit protection and prevent damage to any of your components in the event of some sort of massive failure would be to place a big zener diode rated at about 24V accross the +Bat and GND of your circuit, then use a fuse inline before the zener:

+Vbatt -> Fuse -> Zener (Cathode to Fuse, Annode to Gnd) ->
Circuitry (Also Connected to Cathode of Zener)


That way, if a voltage spike above 24V hits your circuit, the Zener would counduct the overvoltage away, if the spike duration is long enough, the Zener will conduct enough current and blow the fuse. Thus saving the rest of your circuit. Your fuse should be rated just over the max current of your circuit, which would be .7*7 = ~5A. I would probably use a 6A fuse to prevent accidental fuse blows. For a Zener, the 5W 24V 1N5359B from Futurelec would work nicely.

Give that a read through and let me know if it makes sense.

Ed

Edited to fix original drawing of Zener diode which formatting did not come through properly.
 
Last edited:
I've never made anythign with transistors before. Is this what you where driving at?

project4.JPG



I don't know if I got the D&S in the right place... The good news of this method, is it is cheaper than buying the TLPs! :thumbsup: Do you think this will work? A big benefit that I see is avoiding the big voltage drop across the TLP250 so that I can have full power at only 12V. (I didn't take into account the drop across the FET since I couldn't comprehend what I was looking at on the data sheet. :rolleyes:)

Thanks again. I really appreciate your help with this!

Off the immediate subject, do you recommend the K2 over these CREE or other high power LEDs I've been reading about? I was planning on using the K2s with the base 3* optics and different lenses depending on the segment location.
 
You've got it pretty close. I drew up the following real quick which shows the placement of the FET.
driverzc3.jpg


I moved the protection circuit, since you will only need one for all seven segments and might as well include the PIC part of the circuit in the protection too. The 6A fuse was sized to allow for all segments to be on and not blow.

The placement of the FET wasn't quite right, this is the correct use. One note, the Tab on the FET is tied to pin 2 (Drain), which is not the same as ground when the FET is off. Make sure that if you mount this to a heatsink that other FET's are on, or if the heatsink is grounded, you use an isolation pad. Lucky for you Futurlec sells an isolation mounting kit TO220MK :D You will also want to use that isolation kit on the LM317's Note: You will not need to heatsink the FET if you are switching "slow" (less than say 10khz), however you may want to screw it down just to mount it, so if you screw it to metal, I would use the isolation kit. But remember, you WILL need to heatsink the LM317

The voltage drop on the FET relates to the on resistance of the FET, Rds. For this part Rds is 0.16ohms. So V=IR, V=.7*0.16 = 0.112V drop.
Power dissipated by the FET with it on P=VI, P=.112*0.7 = 0.0784W which is why a heatsink is not needed.

My other piece of advice would be to put a 0.1uF cap across pins 5 and 14 (power and ground) of your PIC. This is called a decoupling capacitor, and is often times needed for reliable operation of a microcontroller or any IC. It help prevents accidental resets due to voltage drops. Ceramic or Tantylum will work as a decoupling cap nicely.

Oh yeah, one other thing. Your pinout of the 317 does not seem correct to the datasheet I was looking at. While the pictures used in the applications suggest the pinout is In-Adj-Out (similar to the 7805) If you look towards the top of the sheet it is actually Adj-Out-In, one of those nice confusing attempts to make things less confusing I guess. :)

About the LED's, the CREE XR-E Q5 is arguably the brightest single die LED you can buy. the K2's with TFFC are possible able to output more lumens, however I know there was a recall on the K2's with TFFC and I don't know if they are shipping again (I think they are, but may be hard to find). I guess the simple answer to your question, is where are you planning on buying your LED's, and how much do you want to pay. One consideration, these LED's will need to be mounted to heatsink (fairly large with all these LED's). Most Luxeon Star products need to have electrical insulation between the star and heatsink (a real pain in the butt) LEDDynamics makes a K2 board that does not need isolation. I was unable to decipher from the Lumileds datasheet if the Luxeon brand star needed isolation, it did say the emmiter itself did. I would assume you would want to use stars, since they are much easier to mount. CREE LED's are supposed to have a electrically neutral thermal path, and as such do not need isolation. There was a thread active in the last few days about where to buy CREE LED's.

I'm glad I can help. I have taken enough info from message boards over the past few years, it's the least I can do to repay the favor in a field I know a thing or two about :D
 
:bow: AWESOME. Thank you again. I have ordered the parts. :twothumbs

Now I just need to figure out the LEDs for sure. I want the K2s put I don't want to pay the K2 star prices. I am not comfortable with my ability to heat sink and isolate something that small. I was planning on buying from luxeonstar.com:
$4.39/red and $5.99/white.
The stars ~double those costs I want the optics and lenses to go with it, so I'm not sure if there is a better option.

I will definitely keep this post active throughout the buildup process, and of course, with pictures of the output when she lights up for the first time.

Cheers :D
 
Will these:
http://www.led-tech.de/en/High-Power...51_106_81.html
work with the stock K2 emitters and optics found on luxeonstar.com? Particularly, with the L2 3° Spot Base Module For Luxeon K2 LEDs.

It looks like it will be substantially less expensive for me to make my own stars (even though the soldering is sure to drive me crazy) and then bond my DIY stars to the aluminum c-channel that will be the housing of the project.

Does this seem adequate?
progress.gif
 
You can build your own stars, however it is not a super easy task. Hand soldering is not reccomened in the datasheet, however I have done it before (as have others). Just be carefull how long you hold the iron to the lead! only a few seconds max! Also, the slug on the K2 (heat transfer path on the bottom in the middle) Is not electrically neutral, so somewhere you have to isolate it since you will be placing multiple LED's on one piece of aluminum. (when you get the stars, you can check with a multi-meter if the slug pad is isolated from the other side of the board, if it is your all set.) Since you'll probably be hand soldering and not reflow soldering, you'll have to use some kind of thermal compound between the slug and the slug pad. Something like arctic alumina epoxy will probalby work the best, but most any kind of thermal transfer paste or epoxy will probably work.

I would highly reccomend you order at least one spare K2, if you damage one soldering, it will be cheaper to have a spare then to have to pay shipping costs to order a replacement.

If your order just the emitters, I would suggest futureelectronics, they will be cheaper thatn luxeonstar.com Check out the lumileds website, products in stock will have a little shopping cart next to them which will redirect you directly to Future.

You may also want to check out cutter for CREE options http://www.cutter.com.au/index.php

I don't see a problem with using the L2 optics on home made boards. I've used L2 optics before, they work well, just don't expect the doublesided adhesive to hold them down reliably.

A big piece of c-channel will probably be fine. :)

I have this thread subscribed to send me e-mails, but I will be working a lot of hours the next few weeks. Just PM me if I don't respond to a forum post.

Good Luck!

Ed
 
Top