Author Topic: Need help - 8 LEDs fade on/off  (Read 1637 times)

0 Members and 1 Guest are viewing this topic.

Offline DylanRose

  • Newbie
  • Posts: 3
Need help - 8 LEDs fade on/off
« on: September 19, 2017, 01:11:31 am »
Hey guys! I'm hoping to get some help on a project. I need to light up 8 blue LEDs (Seven 3mm and one 5mm) with as small a battery as possible. If i could get away with using two 2032 coin cells that would be awesome but not a necessity.

So these would be wired to a simple on/off switch, and if it's possible to do a 'fade-in/out' effect when they are turned on or off that would be ideal.

I will be building a custom housing for these and have a desktop cnc machine that I can make a board for. What i really need help with is with a wiring diagram and parts list. I'm ok with wiring things up but i'm totally lost when it comes to what parts i actually need and the correct order to wire them.

Let me know if anyone can assist!
 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 58
  • Country: gb
Re: Need help - 8 LEDs fade on/off
« Reply #1 on: September 19, 2017, 02:20:41 am »
This should probably be in the beginners section, but the attached may help you get started. If you don't have LTSpice already, go download it and play with the values.

You'd be best to stack three CR2032s in series to give 9V, or use a 9V PP3 instead (if you can). Blue LEDs need about 3V to light up, so 6V may not be enough. Red or green LEDs would be better for two CR2032s, blue may require three. You could also try the LEDs in parallel to run on a lower voltage, but they may have to run at a lower current as well.

Just put a switch between the supply and R1.

Component values aren't critical, any transistor should work. R1 and C1 delay the transistor switching on to create the on-fade, R2 delays the off-fade. C2 and C3 are used for both on and off, and basically you need quite a bit of capacitance here. About 10,000uF seems reasonable. Use several smaller caps in parallel if you have to.

You'll probably need to breadboard this one and tweak the values to get the desired effect. It's one of those circuits where everything is interrelated. (A 555 timer circuit might also be possible, but I don't have time to look into that at present.)

Good luck with it!



 

Offline Brumby

  • Supporter
  • ****
  • Posts: 6966
  • Country: au
Re: Need help - 8 LEDs fade on/off
« Reply #2 on: September 19, 2017, 02:47:37 pm »
First reaction - Don't parallel the LED strings under one resistor like that.

Slight variations in the Vf of each LED will most likely result in uneven illumination.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6446
Re: Need help - 8 LEDs fade on/off
« Reply #3 on: September 19, 2017, 04:51:20 pm »
This might do better.  It also eliminates the large capacitors.

 However it will need 3x CR2032 to get enough headroom for the fadein/fadeout, and so it still works as the battery voltage drops with use.  Most small N channel MOSFETs will work e.g. 2N7000.  It needs a SPDT (changeover) On/Off switch to handle the fadeout.  If you *MUST* use a SPST switch, connect it between the battery + and the gate resistor and add a 10K resistor from the switch output to battery -.

Change the gate resistor and capacitor to adjust the fade period.
« Last Edit: September 19, 2017, 04:54:29 pm by Ian.M »
 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 58
  • Country: gb
Re: Need help - 8 LEDs fade on/off
« Reply #4 on: September 19, 2017, 09:01:06 pm »
Thanks Ian! I knew there was a neater solution. (Rush job, end of the day before I went home...)

And Brumby is dead right, should have dedicated resistors on each pair. (See above!)

LTSpice is a bit sparse on choices for LEDs. The QTLP690C model is actually closer to a standard red LED, some of the others may be closer to a blue. Since you're mixing 3mm and 5mm they'll likely have different characteristics, so a bit of tweaking may be required.

Also note that CR2032s aren't great for high current loads, so don't run the LEDs too brightly. (Hence the use of parallel pairs. Needs more voltage, but the current is half than would be required for 8 LEDs in parallel.)

The wiki list (https://en.wikipedia.org/wiki/List_of_battery_sizes) suggests 3mA continual, 15mA pulse, though I've used 2032s for LEDs at 30mA continual. They tend to self-stabilise somewhat - as the voltage drops, so does the current draw, so you'll probably be OK with them.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6446
Re: Need help - 8 LEDs fade on/off
« Reply #5 on: September 20, 2017, 01:28:34 am »
Yes.  It would be advisable to check the Vf of the LEDs you want to use at the current you intend to use, and hand select pairs so the sums of their Vf are as close as possible.   The string with the d3mm and 5mm LEDs may need its series resistor adjusted to compensate.   Also, the MOSFET source resistor will need tweaking to get your desired total current.     

A further issue is the MOSFET gate threshold voltage - if its too low, the gate will charge far past the voltage required for fully On, and therefore the turnoff will be delayed and slow.  This can be fixed by adding a pull-down resistor so the gate is fed from a potential divider.  However the threshold voltage is not closely specified and will vary from part to part, so this circuit is really only suitable for a one-off hand built 'prop' or similar.  Revised sim with blue LEDs and gate divider attached.

Edit: The sim has an unrealistically low internal resistance for the stack of CR2032 cells.  18 Ohms is in the ballpark for a single cell, but it needs multiplying by the number of cells.  If your LED Vf is significantly over 3V, you may even need to go to 4x CR2032 to get enough headroom for the MOSFET.  At that point it may be worth replacing the lower resistor in the  gate divider with a Zener, to stabilise the gate voltage and thus the load current as the battery discharges. 

A few LED models may help in the future.  Just paste any or all of them as a SPICE directive directly on the schematic, or save as a file and include with .lib.
Code: [Select]
*Typ IR LED from optocoupler: Vf=1.2V @10mA
.model LED0 D (IS=1p N=1.999644 RS=0 BV=6 IBV=10u
+ CJO=10p EG=1.424 TT=500n)

*Typ RED GaAs LED: Vf=1.7V Vr=4V If=40mA trr=3uS
.MODEL LED1 D (IS=93.2P RS=42M N=3.73 BV=4 IBV=10U
+ CJO=2.97P VJ=.75 M=.333 TT=4.32U)

*Typ RED,GREEN,YELLOW,AMBER GaAs LED: Vf=2.1V Vr=4V If=40mA trr=3uS
.MODEL LED2 D (IS=93.1P RS=42M N=4.61 BV=4 IBV=10U
+ CJO=2.97P VJ=.75 M=.333 TT=4.32U)

*Typ BLUE SiC LED: Vf=3.4V Vr=5V If=40mA trr=3uS
.MODEL LED3 D (IS=93.1P RS=42M N=7.47 BV=5 IBV=30U
+ CJO=2.97P VJ=.75 M=.333 TT=4.32U)
 
*Typ small White LED: Vf=3.2V Vr=5V If=35mA
.MODEL LED4 AKO:NSSWS108T

LTSPICE already has NSSWS108T, which is a small white small SMD LED, with a characteristic similar to many 3mm and 5mm white LEDs.
« Last Edit: September 20, 2017, 01:52:13 am by Ian.M »
 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 58
  • Country: gb
Re: Need help - 8 LEDs fade on/off
« Reply #6 on: September 20, 2017, 11:00:19 pm »
Should work with a basic NPN in place of the FET, though the fading won't be as linear. (But neither is human vision.)

A simulation with the suggested -108Ts shows about 2.9V across them, which is probably close to a blue LED. Looks like it would run OK down to about 7V. For bonus points you could also replace the 100k R1 with a timmer to adjust the fade rate.

(Was thinking maybe a 12V MN21/23A battery would be an alternative option? Holders for them are pretty cheap on ebay, but their charge capacity is much lower than the 2032s. About 50mAh vs. 200mAh. Still enough for a few hours' run-time, I expect.)
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 2272
  • Country: fr
Re: Need help - 8 LEDs fade on/off
« Reply #7 on: September 20, 2017, 11:29:33 pm »
Should work with a basic NPN in place of the FET, though the fading won't be as linear. (But neither is human vision.)

A small micro doing PWM with a look-up table would work to drive the transistor. OTOH, why to bother with this when there are actually LED drivers specifically designed for such work?

E.g. something like
http://www.linear.com/product/LT3593 (~$2, SOT-23 part)
http://www.linear.com/product/LT3466 (~$3)

Add something to generate the PWM (e.g. a 555 timer or a small micro, e.g. the PIC10/PIC12) and you have a far superior solution than these "bricolages" that will work even from a single 3V cell. Some of the chips even allow analog diming by a voltage on a control pin.

Here is a good list:
http://www.linear.com/products/LED_Driver_ICs

« Last Edit: September 20, 2017, 11:31:39 pm by janoc »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf