Introduction: Flaming Flashing Pumpkin
Feel like adding a little spice to your Halloween pumpkin? Want to try simulating fire with LEDs? Well this is the instructable for you because we're going to do both and it's super easy! Best of all? NO FIRE NECESSARY.
- 1 x Arduino Uno or equivalent (Jameco.com)
- 1 x Breadboard (Jameco.com)
- 1 x 9V Battery (Jameco.com)
- 3 NPN transistors (2222 or similar)
- Handful of Jumper Wires (Jameco.com)
- Handful of LEDs:
- Wire strippers (optional)
- Your computer
- Pumpkin carving tools (optional)
Step 1: Try Before You Buy Parts.
I used the 123D Circuits simulator before wiring up the breadboard. It runs Arduino code so I was able to "build" this circuit virtually. This allowed me to rough out the code online (and for free!) and share the URL with a friend who reviewed my code.
Here's the circuit I used. You can press the "Start Simulation" button to try it out. PS. you can zoom in with two fingers or your mouse's scroll wheel.
Step 2: Putting It Together.
Once you've collected the parts listed in the beginning it's time to plug and play.
I've included some close-up pictures, so if you're able to build off the pictures, great! If not - read on.
Lets first start with the breadboard, it's what holds this whole circuit together. Lay it down horizontally in front of you with the numbers starting from zero on the left. The long rows at the top and bottom of the breadboard are intended to to connect power (+9 volts and ground) from the battery to the Arduino and the rest of the circuit. These rows are electrically connected all of the way across and act as a wire between components pressed in their holes. Eventually, the battery's negative wire (ground) and it's positive wire (+9 volts) will be connected to the two bottom rows, with an extra wire connecting ground up to the top row too. Don't do this yet. You will connect power last.
Similarly, each column of 5 holes in the center area is electrically connected. So any two things plugged into the same column are connected as if by a wire. Note that the columns above and below the empty area in the middle are electrically separate.
Tip: If you'd like to know more about how a breadboard works check out the video on this page.
Wiring: Start off by placing one wire (I used black) all the way on the right side, plug one end into a blue row in the bottom left corner, and the other end in a blue row in the upper right corner. This connects the ground "rails" on the breadboard to each other. You don't need to connect the positive, just ground.
Next if you are following my photographs: the numbers on your breadboard start at 0 on the left. Now take one of the FETs and place it in E55/56/57 with the flat side facing you. Now use a short jumper wire (mine are red) and connect the FET's left leg to the +9V rail just below it (red row).
Next add the white/blue LEDs in the upper left corner of the breadboard. LEDs have a polarity and each one needs to have it's negative ("cathode") plugged into the ground rail up at the top of the breadboard. If your LED has a flat side (look closely) on the little ridge that goes around it that's the side you should plug into the ground rail. The other way to identify the negative side is the leg's length, the negative side is longer. It's ok if you have to guess... 50 / 50 chance!
The positive side of the LED (called the "anode") should plug into the breadboard, but placement doesn't need to be too specific as long as it's near the FET and in the upper half of the breadboard. Now take a 100Ω resistor and plug one end into the same column as one of the LED's positive legs. See close up pictures if needed. The resistor should be plugged into the same column as the positive side of the LED, and on the top half of the breadboard. Now plug the other end of the resistor into the same column as the right-most pin of the FET. In my photographs this is column 57. Note: resistors don't have polarity, so they work the same in both directions.
Finally, add a long-ish wire to the circuit. One end connects to the middle pin of the FET (in my pictures this is A56). The other end will connect to the Arduino's pin "~3".
Now that you have the white/blue section wired, go ahead and repeat the same steps for the Yellow and Orange LEDs. The center pin of the FETs in these sections should connect with a long-ish jumper wire to pins "~9", and "~10" respectively on the Arduino. I used yellow and orange wires because I had them available.
Getting close! Now add the red LED, but this time without a FET. You just need the LED, a resistor, and one jumper. Just like the LEDs in previous steps, plug the Red LED's negative side into the ground rail at the top of the breadboard. Plug the LED's positive terminal into the over by G26. end into the Arduino's pin "~11".
In the next step we'll talk about power...
Step 3: Powering Up.
So you're ready to add power. You'll want to program the Arduino over USB, but when it's in a pumpkin you'll probably want to use a 9V battery.
Lets now use two wires to connect the Arduino to the breadboard: Connect the Arduino's "Vin" pin to the bottom positive rail of the breadboard (red wire in picture). Using a second wire - connect one of the Arduino's three "GND" pins to the ground rail at the bottom of the breadboard (black wire in picture).
You now have a choice that depends on your battery connector:
1) If your battery connector has a barrel jack just plug it into the Arduino. Easy. The two wires you added (above) will connect the battery through to the rest of the circuit through the Arduino.
2) If your battery connector has just two wires you will want to figure out which is positive and which is negative and plug them into the bottom rails of the breadboard. If you're unsure which is which just look closely, you can probably follow the wires back to the battery, or use a multimeter set to measure voltage. If you measure a positive voltage then you're good. If you measure a negative voltage then you've got the wires backwards.
Next step we'll give you the code...
Step 4: The Code.
The Arduino code for the flickering flames and the pulsing is a few simple functions and then a loop calling the functions. If you just want an awesome pumpkin ASAP skip to the steps.
If you're interested in the code, have a look at the comments to get an understanding of what's it's doing. If you want to make changes I recommend starting at the very end where functions are called. One more thing... this code and the code in the 123D Circuits simulation are identical and run in both the simulator and on a physical Arduino!
Steps to programming:
- Connect your Arduino Uno (or equivalent) to your computer via USB.
- Open the Arduino App.
- Open the code (attached), or get it by clicking on "Code Editor" on the simulation (from step 1)
- Paste the code into the Arduino app.
- From the Tools menu choose Board --> Arduino Uno
- From the Tools menu choose Programmer --> AVR ISP
- Press the Verify button (check mark).
- Press the Upload button (arrow).
Your Arduino should be programmed now! Since the red LED is powered directly by the Arduino you should see it flicker. For the other LEDs to flicker at their full potential you'll want to disconnect the USB cable and power the everything with the 9V battery.
Can you improve the code? Did you build it? If you do please leave a comment and/or share your code online. Thanks!
Step 5: Put the Circuit in the Pumpkin
This step is simple. You want to put the electronics into the pumpkin, but you want them to stay dry, and you want the light from the LEDs to be diffused, like they were shining through the back of a paper lantern.
Both criteria are met with a simple sheet of wax paper. One - it's waterproof, so by putting the electronics on top of it you ensure they won't get moist from the pumpkin, and two - it's a great light diffuser.
See the wax paper in the picture? the circuit is sitting on top of it, and a big flap is going up and over the electronics. Note: This works best if you crumple the wax paper first. Doing so will allow it to fit inside the spherical pumpkin easily.
That's it. How'd it go?
ScreamtotheX made it!
We have a be nice policy.
Please be positive and constructive.