AC constant current LED driver controlled by output pin
PropRocks
Posts: 3
Hi all!
I'm a newbie at building circuits and using the propeller so I'm wondering if the following circuit makes sense/would work. In a nutshell I want to, with a minimum of fuss, do PWM of a constant current LED driver (1watt LED) with a propeller chip. The added wrinkle is that I want to power it all from 12V AC low voltage lighting transformer. I've simulated it with Paul Falstad's on-line circuit simulator (a very cool tool) - the link to the simulation is below and I've attached a pic of the schematic. For the simulation I had to add ground (basically so that the 3.3V pin worked correctly), but in real life I plan to use a LM7805 to regulate the rectified/smoothed 12VAC output and power the propeller board. I realize its not the most efficient circuit, but neither is a current limiting resistor (my 2nd option ATM.)
The next question is how would I go about finding an appropriate NPN transistor?
Thanks,
Rob
Link (requires Java and I've only tested with IE):
http://tinyurl.com/6g5sof9
I'm a newbie at building circuits and using the propeller so I'm wondering if the following circuit makes sense/would work. In a nutshell I want to, with a minimum of fuss, do PWM of a constant current LED driver (1watt LED) with a propeller chip. The added wrinkle is that I want to power it all from 12V AC low voltage lighting transformer. I've simulated it with Paul Falstad's on-line circuit simulator (a very cool tool) - the link to the simulation is below and I've attached a pic of the schematic. For the simulation I had to add ground (basically so that the 3.3V pin worked correctly), but in real life I plan to use a LM7805 to regulate the rectified/smoothed 12VAC output and power the propeller board. I realize its not the most efficient circuit, but neither is a current limiting resistor (my 2nd option ATM.)
The next question is how would I go about finding an appropriate NPN transistor?
Thanks,
Rob
Link (requires Java and I've only tested with IE):
http://tinyurl.com/6g5sof9
Comments
Welcome to the forum!!
To sustain at least 1Watt over the 60Hz ripple you need to increase the 220uF to at least 2200uF... ideally 4700uF.
The transistor you choose, depends on the PWM duty you plan on chopping the voltage. For example if your PWM is 50% duty cycle, your transistor is going to need to handle peak currents of 191mA, while a PWM duty cycle of 30%, the transistor would need to handle 249mA peak currents....80% ; 120mA
The question is, what are the peak currents that the LED can withstand under PWM drive? ... because essentially, the LED's would see the same current.
The better and more efficient way to do it would be to PWM the output similar to a switch mode voltage regulator in a way that you maintain a voltage/current in parallel with the LED... additionally, replace the transistor with a mosfet ... This leads to the question, what is the voltage of your LED(s)?
To set a fixed maximum (100%) current, the transistor should be driven in the so-called common base configuration. The resistor goes between the emitter and ground, and the 3.3V PWM comes directly into the transistor base. For a maximum current of 300 mA, the emitter resistor would be about (3.3 - 0.6)/0.3 = 9 Ω. That sets the 100% current. The 0.6 volts is the transistor base-emitter voltage, and that will vary a bit from transistor to transistor and with temperature.
The rectified AC voltage is input to a pin on the propeller through a 100K resistor to provide a timing reference (the AC 0V crossing), and the output pin to the transistor is turned on for the length of time required for the current brightness level/duty cycle.
The down side to this circuit is that you can not get to a 100% duty cycle or reach the absolute maximum brightness a led can produce, but you can get very close to 100%.
On the plus side the circuit reduces the need for a hefty power supply regulator and large capacitors, the zero crossing signal can be used for time of day/date generation, and as a power fail indicator.
You could use this MOSFET - http://www.fairchildsemi.com/ds/RF/RFP12N10L.pdf.
Any rail-to-rail signle voltage opamp would do. Power it from from the 5V (don't forget the decoupling cap). The cap on the 12V should be as big as possible (as someone mentioned it in the previous post) otherwise the LED will blink at 60Hz. Othwerwise synchronize with 60Hz as Kwinn suggested.
Calculate the resistors so that at 3.3V from the Propeller output pin you'll get the max current on the LED.
Hope this helps.
Your circuit is a constant-voltage drive. LEDs should be current-regulated, not voltage-regulated. For current regulation, put a sense resistor where the LED is in your circuit, and put the LED in between the MOSFET's drain and the positive supply.
-Phil
You're right. What I wanted to achieve was to regulate the voltage across the LED which will cause the constant current. For the high power diodes brightness veries with temperature hence controlling the voltage is not such a good idea as for the lower power LEDs.
Changing this circuit to the constant current source requires a beefy sense resistor R. Its power depends on the average voltage across it and the LED current.
Here's the circuit update:
-Phil
Well, maybe I am just lucky to choose the LEDs whose I/V curves don't differ so much for the same part number...
-Phil
I have used this method for several years and it generally works well and lasts a long time.
The LEDs are 3 watt RGB leds (1 watt per color) from superbrightleds.com. For red forward current is 400ma @ 2.5V. Green and blue are 350ma @ 3.4V. They vary quite a bit with voltage, are plenty bright, and I'd actually prefer to run them around 250ma.
I'm concerned about smoothing caps causing current spikes on the 12VAC power wire (and hence voltage drops.) I'm sorry I didn't describe better the application, but I want to control 6 RGB floods (so a total of 18 LEDs) by each propeller, and I'll have multiple propellers (probably around 3 propellers/18 floods/54LEDs total.) Everything will be powered by the same 12VAC/300 watt low-voltage lighting transformer, but the propeller boards will each have their own rectifiers, smoothing caps and regulators (ie. not the rectified output used by the LEDs.) Because of the # of LEDs I'm trying to keep it simple/parts count low for their PWM control. I'm OK if the LEDs have a 60Hz flicker, and I want to use a 12VAC low-voltage lighting transformer for safety reasons (don't like the idea of 110VAC or 12V/25A power running through the yard.)
Tracy, if I understand your reply I would adjust the schematic as shown in the attachment? Running it in the simulator I get ~2.8ma current on the 3.3V output pin. Out of curiosity I deleted the 220uF smoothing cap (for the reason above - it lowered the 12VAC current spike from amps to 284ma), but the issue of the propeller output pin trying to source all 287ma when the rectified output goes to 0V comes up. I'm worried that even if I keep the smoothing cap what happens to the propeller if the cap goes bad? Is there anyway to protect against that and/or run without the smoothing cap, or would doing so not damage the propeller's output pin?
Rob
The circuit is not power efficient and you have to include power in your design considerations. Supposing that the emitter resistor is 10 ohms, and the LED current is steady 250 mA, the power in the resistor will be 0.625 W, so you'd want to use at least a 1W resistor. Then there is the power the transistor has to handle. It has to handle the same current as the LED and resistor, and it holds off the 12V power - 3V across the LED - 2.5 V across the 10Ω resistor. That is 6.5 volts. And the power is 6.5 V * 0.25A = 1.625 W. So, that calls for a good size transistor, maybe a metal plate heat sink. All this is back-of-envelope estimate, and the power will be less for PWM at lower duty cycles. It could be less demanding with a lower supply voltage, say 8V instead of 12V.
The worst case power dissipation for the resistors would be 0.58W for the red led and 0.56W for the blue or green led. For the transistors worst case power dissipation would be 1.53W for the red led and 1.35W for the green or blue led.
One watt resistors and 3 watt transistors with a heatsink would be adequate for that. You might want to consider using a darlington transistor so as not to have any concerns regarding the transistor gains. Lots of choices in the 5-25W range and well under a dollar.
Thanks again for all your help!
Rob
More importantly with these LEDs is the issue of thermal run-away. Diode forward voltage drops with increasing temperature, so if you drive a constant voltage then increasing temp leads to rapidly increasing current, leading to increasing temp...
I'm also worried about the heatsinking requirements of this whole thread - 250mA at 16Vdc or so is 4W in the transistor (12Vac rectifies to about 18V, less LED forward drop...) Why use 12Vac for a single LED when 5Vdc would do?
The 4 Watts is the peak dissipation of the transistor. With a rectified AC waveform the worst case average dissipation is 1.53W and 1.35W - see post #15. Using 5V would work but it requires a more expensive power supply. Since he already has a 12VAC transformer for outdoor lighting it makes sense to do it this way. It also allows for putting more than one led in series.