LED Pumpkin Light Controlled by Arduino

About: I have a never-ending desire to try new things, build stuff, experiment, and learn. I don't really watch TV, or play video games - I prefer to get my entertainment from physically interacting with the world....

Intro: LED Pumpkin Light Controlled by Arduino

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


Step 1: Carve a Pumpkin

Carve a pumpkin

Step 2: Write Code

I wrote in several random values so that the effect is somewhat realistic. Change around the values or better yet the entire code if you want a different or more realistic effect.

I've never really had any formal programming instruction, and as a result my code is probably almost as inefficient as using an arduino to light a pumpkin.

So if anyone has suggestions on how to make the code more efficient, or all-around better I would appreciate any help.

Step 3: Solder and Plug

Solder a couple wires to the LDR to allow for positioning within the pumpkin.
solder the 220 ohm resistor to the short leg of the LED and insert it in the ground pin.
Insert the long leg into digital pin 9.
Insert one wire from the LDR and one leg of the 1000 ohm resistor into analog pin 3
insert the other end of the LDR in 5v, and the other end of the 1000 ohm resistor into the second ground.


Step 4: Bag It Up

Throw it in a ziploc bag to protect the electronics - You will want the bag to be big enough so that the LDR can be positioned in an opening in the pumpkin (so it can read the ambient light level)

Step 5: See It in Action

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest

    5 Discussions

    0
    None
    wirenut1980

    7 years ago on Step 2


    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
    }

    1 reply
    0
    None
    Sky-Monkeywirenut1980

    Reply 7 years ago on Step 2

    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

    0
    None
    rivetgeek

    8 years ago on Introduction

    Im a little confused why you have additional resistors in the project?  The arduino has built in resistors for leds

    1 reply
    0
    None
    Sky-Monkeyrivetgeek

    Reply 8 years ago on Introduction

    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 :)