Flickering LED Circuit

Here’s a simple project for your Halloween celebration. The other day while looking through our box of Halloween decorations, we noticed that the incandescent lamp in one of the jack-o’-lanterns was burnt out. Instead of simply replacing the outdated bulb, we decided to build a small dark detecting circuit with 2 yellow LEDs based on this Evil Mad Scientist Laboratories design. After successfully building the circuit, we took the project one step further by incorporating an Atmel ATtiny13 microcontroller. The code switches the LEDs on and off randomly for a flickering effect and is based on this instructable. Below is the schematic we created in EAGLE and a parts list.

  • T1, T2: 2N3904 transistors
  • T3: LTR-3208E phototransistor
  • LED1, LED2: 10mm diffused yellow LEDs
  • R1: 5kohm resistor
  • R2, R3: 50ohm resistors
  • IC1: Atmel ATtiny13
  • Source: 2xAA battery case with batteries

16 thoughts on “Flickering LED Circuit

  1. Why so many components? Iirc, you can leave off almost half of it (you’ll need sw changes tho’):

    1. There’s a good amount of ADC and power saving possibilities in the Tiny13. Leave out both transistors, connect the resistor+photo-transistor to an ADC-pin of the uC (and the ground or vcc of that schematic to another pin, to make sure no current flows when it’s not necessary) and you’re done,

    2. Why the resistors? Iirc, the Tiny13s GPIO will emit 20mA or so at max. The current limiting is there, just use it :)

    3. You can even leave out the photo-transistor :) Can’t find a link right now, but it’s possible to use a LED as a photo-detector.

    Total of parts left (perhaps I’m missing a resistor): the battery, the 2 leds and the uC.

    And who said leaving out stuff was only a merit in writing? :)

  2. mad scientist projects are boring :(
    what is the use of the transistors ?
    with a tiny 45 you can take 40ma ou of single a output pin and you can connect 2 together, that is 80 ma.
    No, you do not need a resistor to drive a led (try it !) except to spare your battery life, anyway you can do pwm if you want.

  3. Actually, I got the no-resistor idea for the original from a post on LadyAda’s forums, stating the AVR chips do have regulated output.

    (BTW, thanks to hack-a-day for linking my Instructable. Twice! :D )

  4. I took this idea from evilmadscientist.com as above. I wanted more than the basic random on/off flicker. In combining a flicker program with the above circuit, I used the ATTINY45 to replace the transistors. My whole circuit is 2 resistors, 2 LEDs, the phototransistor and the ATTINY45. I use the ADC to read the phototransistor. I have the Tiny sleep and only wake on light. On waking, it lights up the LEDs, one red and the other yellow. The LEDs are driven by PWM. The each are turned on to a random level of brightness for a random duration. With minor tweaking, I got a wonderful candle effect without any harsh edges. I limit the PWM between 127 and 255 in intensity. The rate is controlled by a constant. I hooked it up to two AA batteries. The circuit ran all night in my pumpkins this season for about 2 weeks. There was fade as the batteries died, but they are still running now and I pulled them from the pumpkins about a week ago. Looks like 2 weeks ssolid performance, and 2 more weeks adequate performance. I am working on putting a schematic together in Eagle, but am having trouble locating the symbol and foot print. My first Eagle project, so it may take some time.

Leave a Reply to SolidSilverCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.