Shop OBEX P1 Docs P2 Docs Learn Events
LED fade in/ out — Parallax Forums

LED fade in/ out

InteractivesInteractives Posts: 83
edited 2005-09-10 07:04 in BASIC Stamp
Hello commrads, I am wondering if any of you know a quick and easy way to make an led array fade up , and fade out, when commanded to do so by our friend the STAMP. Ive got a led cluster here that rund on 14VDC, and Ive been trying to get the effect using a larger capacitor hooked in parallel to the led cluster. The result, is that the LEDs ramp up fast, ramp off slow, and never reach their full brightness. I'm thinking thats because the resistors in series with the cap. are limiting the total current getting to the cluster. I know that there is some way to do this with a PWM, but am unsure about the STAMPS ability to do this. Any thoughts? THANKS

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-09 14:25
    In the EFX group we use PWM to fade LEDs on and off to simulate things like candle flames, and it works well. If you're going to control more than one, however, what you may want to do is modulate (using PWM) a common leg of the group of LEDs in your cluster. You could use a MOSFET to switch the common leg and use PWM to moduate that. By putting the PWM instruction in a loop you'll be able to control the fade up/down timing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • InteractivesInteractives Posts: 83
    edited 2005-09-09 14:33
    OK, thanks! Ive been meaning to use that dusty old MOSFET.
  • metron9metron9 Posts: 1,100
    edited 2005-09-10 07:04
    Here is a circuit, I don't know how to make the fade in slower to match the fade out but using this circuit simulator (free java applet) you can mess around with all kinds of components to try stuff with.

    This is a screen capture movie file created with Camtasia of the circuit I made to fade the LEDs.
    it made a 4 meg avi file but reduced the file to just 293k link below.

    www.stickerpub.com/cshow.wmv

    The java applet is at www.falstad.com
    click on the math and physics link then under Electrodynamics click on Analog Circuit Simulator Applet

    When its running select File... Import and cut and paste the code below, then you can change it all you want



    $ 1 5.0E-6 5.172371070304759 50 5.0 50
    c 288 208 288 128 0 2.4999999999999998E-5 -21.187216750871283
    d 496 272 496 208 0
    r 496 128 496 208 0 200.0
    162 368 48 336 48 0 1.0 0.0 0.0
    162 336 48 304 48 0 1.0 0.0 0.0
    162 304 48 272 48 0 1.0 0.0 0.0
    162 272 48 240 48 0 1.0 0.0 0.0
    162 240 48 208 48 0 1.0 0.0 0.0
    162 208 48 176 48 0 1.0 0.0 0.0
    r 368 48 496 48 0 200.0
    r 176 48 176 208 0 100.0
    w 496 48 496 128 0
    g 288 304 288 352 0
    w 176 208 176 304 0
    w 176 304 288 304 0
    w 496 128 288 128 0
    O 176 48 112 48 0
    R 496 320 496 384 0 2 20.0 28.0 0.0
    w 288 208 288 304 0
    w 496 272 496 320 0
    o 16 64 0 2 5.0 9.765625E-5 0
    
    
Sign In or Register to comment.