Pages: [1]   Go Down
Author Topic: Halloween Display Lightning  (Read 1120 times)
0 Members and 1 Guest are viewing this topic.
Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is a really simple project.. a PWM-flickered superbright (I used a 1watt Luxeon) LED strobe for halloween decorations.  Every 2-10 seconds at random, a sequence of PWM levels are fed out, to simulate the flash of lightning.  Feel free to mess with the delays, just be careful if powering the LED for long periods, as a series resistor to regulate LED current is inefficient and generates a lot of heat which will damage components.  

Note that driving a power LED by using a power resistor is not recommended.. but since we are doing short pulses, heat isn't as large an issue.  Longer "on" times may present issues.  In addition, for the 5v supply, I tap directly off the 5v regulator.  This circuit will pull 350ma for just the LED, in addition to more from the series resistor.  I wouldn't recommend drawing that much power through the regular circuitboard traces on an Arduino.  If you use an external power supply, remember to connect the grounds!  You can use a different supply voltage for the LED as long as you adjust the series resistor accordingly, or multiple LED's in series.  The TIP120 can handle quite a bit, particularly as it's being used as a switch in this configuration.  If you're going to be doing much interfacing to arduinos, I'd get a few of them.  For lower current demand, I'd recommend 2N2222 or 3904's... pennies each and a perfect little switching transistor for projects.

TIP120 is a Darlington transistor, but any NPN that can handle 500ma or more will likely work.  To create a 5 Ohm resistor, I connected two 10 ohm resistors in parallel, which also shares the wattage (heat) dissipation.  Remember to keep heat in mind, parallel resistors of small wattage can replace a single higher wattage one in most cases.

Remember also to check the pinout of your particular transistor type, many small-signal types order pins C-B-E, while others (like TIP120) order their pins B-C-E...  This circuit is a nice general-purpose switching circuit, usable for almost any load without modification.  Inductive loads like motors or selenoids will require a diode to supress voltage spikes.



Code:
int flash[]={255,128,64,255,64,255,255,0,128,0};

void setup() {                
  // initialize the digital pin as an output:
  pinMode(11, OUTPUT);
  Serial.begin(9600);
  // Seed random number generator with noise.
  randomSeed(analogRead(0));
 }

void loop() {

  // loop through the array with our flicker pattern
  for(int i=0; i<10; i++) {
    analogWrite(11,flash[i]);
    delay(100);
  }
  
  // wait a random time from 2 to 10 seconds
  delay(random(2,10)*1000);
  
}

This is meant as a temporary circuit, any longer-term design should use a constant-current cicuit to drive the LED....
« Last Edit: October 17, 2010, 04:40:36 pm by focalist » Logged

When the testing is complete there will be... cake.

Rural Arizona
Offline Offline
Edison Member
*
Karma: 7
Posts: 1711
Incorrigible tinkerer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This circuit will pull 350ma for just the LED, in addition to more from the series resistor.

Um, no:  if there's 350mA going through the LED,  that same current is flowing through the resistor.

But there probably isn't:  the TIP120 is going to be losing about 1.2-1.4V because it's a Darlington.  As I recall,  those 1W Luxeons have a nominal forward voltage of about 3V (but do not bet on my vague recollection being correct).  That means a drop of about .6-.8V across the resistor,  so you'd only be getting about 120-150mA.

So you're probably being overly conservative in your resistor choice,  and may be able to get brighter flashes if you want.

If you do want brighter flashes,  go back to the datasheets.  I recommend assuming the worst cases on the TIP120 (1.2V) and the LED (whatever the minimum forward voltage is),  and actually measuring the 5V supply.  Then you can probably reduce the resistor value to get a voltage drop that gives you the full 350mA.

You might even be able to go over 350mA,  depending on what the spec sheet says,  if you keep the flash length short enough and the duty cycle low.  But then you have to bet that you never have a software glitch that leaves the LED on long enough to fry.  You have to ask yourself:  Do you feel lucky,  Punkin?   smiley
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You know, I totally forgot to think about the voltage drop across the transistor.. and since the recommended Vf is 3.42v on this module, that's quite a bit more breathing room than I was thinking at first.  Five ohms was a little high anyway, it was a convenient number when I was having trouble finding low-value resistors in my box of goodies.  If my math is right, the "ideal" value is about 4.7 ohms... but as you had said (and I noted in another thread), we can probably get away with overdriving the LED quite a bit because of it's intermittent use.  Heat is the issue in play, and our flashes are pretty short.  That being said, 1w LED's go for cheap money these days and I wouldn't freak out if I cooked one over the course of a full evening of trick-or-treaters..  

SO.. I may add a third 10 ohm resistor in parallel, which drops the series resistor to 3.333etc ohms.  It will be getting overdriven pretty significantly at that level, but since it's a Luxeon Star, it's mounted and heatsunk fairly well, and if needed, I can grab some heat paste and slap it onto an old CPU heatsink I have lying around.

As wired, it would be pretty good for some window display or whatever at best.. overdriving it, especially since I am Underdriving it at the moment, the light output (if it remains fairly linear, which I think it does, to a point) might be a LOT higher than it is now..

Thanks for catching that!  Once again, too many years away has left me a bit of a dolt when it comes to circuitry.. three semesters almost thirty years ago, way too easy to forget valuable info!
Logged

When the testing is complete there will be... cake.

Rural Arizona
Offline Offline
Edison Member
*
Karma: 7
Posts: 1711
Incorrigible tinkerer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
we can probably get away with overdriving the LED quite a bit because of it's intermittent use.
Probably not,  actually:  many modern LED chemistries are not as tolerant of overdriving as the ones of 30 years ago.  Back then,  you could usually do peaks of 5, maybe even 10,  times the typical 20mA,  as long as the average stayed low.

But I grabbed a Luxeon datasheet,  and they recommend a peak pulsed current of no more than 500mA.

There's a really wide range of Vf for those LEDs:  2.8-4V.  If your 5V supply is spot on,  and your LED is near the high end of that range,  you don't need a resistor at all:  the voltage drop across the TIP120 is enough to keep the current low.  Otoh,  if the +5 is near the upper end of the regulator's 5% or 10% tolerance,  and the LED is from a batch near the 2.8V end of its range,  having no resistor could mean "instant release of the magic smoke from the LED".

If you don't have the tools (a really accurate multimeter and a current-limiting power supply) to precisely measure the Vf of your LED and the output of your power supply,  the 3.3 Ohm resistor should be a pretty safe bet:  it'll drop about 1.1V at 350mA,  which will protect the LED even if all parts are near the worst-case ends of their tolerances.  If you know your Vf is higher and +5 is lower,  a smaller resistor would be okay,  but may not make a dramatic visible difference because the human eye response is not linear.
Logged

Pages: [1]   Go Up
Jump to: