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
I think you have your battery symbol backwards in your schematic… Just to make sure others don’t connect it up wrong.
Wouldn’t it have been better to leave PB0/1 disconnected for ICSP?
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? :)
@sprite_tm Here’s your link: http://hackaday.com/2006/02/21/low-cost-sensing-and-communication-with-an-led/
Now are you going to build it or what? ;)
Heh, I’m tempted. Tell you what, if I have some spare time this week, I’ll build and document it if you’ll show it on hackaday. Deal? :P
@pokey: perhaps he wanted hardware PWM? (OC0A/OC0B)
@sprite_tm: I don’t think an almost empty schematic would be worthy on hackaday.
Heck, there are already too many of these little projects on hackaday.
You still need resistors to drive an LED from a microcontroller pin. Their maximum output is near 20ma, which means you shouldn’t exceed that…the microcontroller won’t actually limit it.
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.
@sprite_tm Those sound like good ideas/improvements, if you want to discuss your design further hit me up at nick@hackaday.com
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 )
these “little projects” can go a long way towards communication and networking of ideas.
Look at the ideas for refinements brought about by posting this circuit.
There are no “little projects”.
i think this simple circuit is useful for me as a reference as i’m new to these stuff, thanks!
Flicker is really great when sharing photos over friends and families. I love the resize feature of Flickr.’`~
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.
COULD YOU MAKE A VIDEO? I WANT TO DO THIS BUT I AM NOT EXPERIENCED WITH ELECTRONICS.
I have put most of my work related to this up on github as of today. https://github.com/EFH52/PumpkinCandle