LED Pumpkin Light controlled by Arduino

 by Sky-Monkey
litPumpkins.jpg
The initial vision for the project was to set up an LED to turn on and off by itself based on ambient light, and to flicker and vary intensity to simulate a candle.

Parts required:
1 x Arduino
1 x LED (preferably a bright amber one for realism)
1 x LDR (Light dependent resistor)
1 x 1000 ohm resistor
1 x 220 ohm resistor


 
Remove these adsRemove these ads by Signing Up

Step 1: Carve a Pumpkin

Carving.jpg
Carve a pumpkin
wirenut1980 says: Aug 23, 2011. 10:34 AM

Give this a try


// flickering LED
int ledPin = 11; // asign LED to pin 11
void setup() // setting things up
{
pinMode(ledPin, OUTPUT); // sets pin 11 to output
}
void loop() // starting loop
{
analogWrite(ledPin, random(50)+255); // outputs a random brightness between 206 and 255 on a scale of 255
delay(random(100)); // maintains that brightness for a random interval between 1 and 100 milliseconds
}
Sky-Monkey (author) in reply to wirenut1980Aug 23, 2011. 10:38 PM
Nice. Far more elegant than mine.

I'm still curious how efficient the power consumption of the system can be made so that with an LDR, the setup can be left alone for a week or more, and not need to be turned on/off daily. So any suggestions regarding that would still be appreciated.

Thanks
fungus amungus says: Oct 12, 2009. 9:17 PM
You should also enter this in the Arduino contest.
rivetgeek says: Oct 9, 2009. 2:56 PM
Im a little confused why you have additional resistors in the project?  The arduino has built in resistors for leds
Sky-Monkey (author) in reply to rivetgeekOct 9, 2009. 4:30 PM
I  know that pin 13 is set up for a led, but I dont know of a way to output from any of the PWM pins (3,5,6,9,10,11) at a voltage less than 5v. There certainly may be a way, and if you know how i'd appreciate you explaining. The 1000 ohm on the LDR was put in place becausse I saw someone hook one up that way and it worked- no reason beyond that. Im still learning, so there is likely a better way to do it - and I was hoping that someone would show me how. Thanks in advance if you can :)
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!