Shop OBEX P1 Docs P2 Docs Learn Events
trying to fade on and off a bunch of LEDs... — Parallax Forums

trying to fade on and off a bunch of LEDs...

mowglimowgli Posts: 4
edited 2008-05-29 02:19 in BASIC Stamp
I'm working on a lighting project where I want about 32 LEDs to fade randomly on and off. What I came up with is to wire one, two, or three LEDs, in parallel, to each I/O pin of my Stamp, and run the attached code. But the Stamp seems to get overloaded if more than maybe 20 LEDs are lit at once, and the script freezes and the LEDs just flash. I imagine I need more current but how can I get it and still fade?

I have a feeling I'm being a dunce here. Please forgive a newbie.

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-28 05:23
    Each Stamp I/O pin can handle maybe 40mA, but there are severe current limits on groups of 8 I/O pins and for the overall device. You can burn out the Stamp if you exceed them. To control more current, you need to use an external switching transistor that's driven from an I/O pin. Nuts & Volts Column #6 (www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol1/col/nv6.pdf) goes into detail on this.
  • Andy FoxAndy Fox Posts: 46
    edited 2008-05-28 13:12
    I don't think using transistors will get the LEDs to "fade" like you want (maybe they will--I donno). What I would do is use some LM358 op amps as voltage followers / buffers and put them between the Stamp I/O pins and the LEDs. There is am example of how to implement the LM358 in Experiment #22 in the StampsWorks book.
  • Dave-WDave-W Posts: 94
    edited 2008-05-29 02:19
    Your best bet is a simple emitter follower Transistor like a 2N2222 or even a Darlington. Collector to +5 ( OR unregulated supply )·and emitter to the LED through your current limiting resistor. Then the base would be hooked to your I/O pin through another current limiter to protect the Stamp if something goes wrong with the circuit. I always use a protection resistor on every I/O pin since the first time I blew a stamp I/O pin by accident!

    With this hookup you can dim and control the brightness of the LED. You can even add a cap to the base to smoth out the voltage to the LED making it look more smoth from dim to bright using pulse out.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D. A. Wreski
Sign In or Register to comment.