Overview

When unpacking an inexpensive plastic Jack-o-lantern for this year's Halloween decorating, I got inspired to upgrade it with some NeoPixels.

This project only uses a few parts:

For tools, you will need:

  • Soldering Iron
  • Wire stripper
  • Diagonal cutter (For trimming soldered wires)

Let's light up a pumpkin!

Powering the Board

I chose to power the project with a 9v "wall wart" power supply. Check the specs on your Arduino-compatible for what power you can give it

You can also power the project off the USB port. This works well for portable installations: just plug it into a USB battery

Powering the NeoPixels

Normally, the 5v output of an Arduino is not adquate to power 16 NeoPixels, but in this application, the total brightness of the ring is limited keeps the current to to safe level.

I've added a resistor to the data line as suggested in the Adafruit NeoPixel Überguide.

Assembly

  • Step 1: Attach wires to 5V IN, 5V Ground, and Data In on the NeoPixel ring.
  • Step 2: Connect those wire to the Arduino.
  • Step 3: There is no step 3!

Here's the Details:

Wires

We're using 20 AWG wire for this project. It's a litte heavier than usual for small electronics but it provides the physical structure for the project and fits snugly into the header sockets on the Arduino.

Cut 2 pieces of wire for the power to NeoPixel Ring.

Remove 1/4" of insulation from one end and 1/2" from the other.

Cut a 3rd piece if you are not using the resistor (there's a resistor built into the NeoPixel ring so its not essential to add your own)

Even if you are using the resistor,  you may want to  cut a 1/2" piece of wire to create a "pin" for the resistor so it plugs securely into the header socket. You can just jam the resistor lead into the header socket, but it's more secure if you add the pin. You can skip this step if you're new to soldering.

Soldering

Insert the short end each wire from the "back" side of the NeoPixel ring and apply a small amount of solder.

Trim the wires.

That's the hard part! All the soldering is done!

Now just flip the assembly over and insert the wires into the correct sockets on the board.

 

Wiring It Up

The positive power goes in the socket marked "5v"

Negative wire goes in "GND"

Data wire (or resistor) goes in Pin 2.

The candle is done!

Optional Extras

Reflector

I also added a small reflector. Take a semicircle of shiny mylar and roll it into a cone shape. Tape it into the center of the assembly.

Retaining Ties

To secure the board into the pumpkin, I threaded some twist-ties into the mounting holes in the Metro. I then pulled these through the original lamp mounting hole in the pumpkin and secured them around a craft stick

The Code

Obviously, since the hardware was so simple, this project is all about the code.

But you can just grab the code and upload it to your board.

Upload the Code

Use the Arduino IDE to upload the code to your board.

If you don't already have the Arduino IDE set up, check Simon Monk's excellent tutorial.

Adafruit Metro

This was my first time using the Adafruit Metro. I chose this board because it uses surface-mount components which gives it a smooth bottom so it can sit on the floor of the pumpkin. It also has a real USB->Serial which makes development easier.

If you are running Windows or Mac, you will want to get the latest FTDI drivers.

I did that, but still had issues communicating with the Metro. Rebooting the computer solved the issue. Figuring out that I needed to reboot was the longest part of the project!

Flames

The code simulates "flames," each made of 3 NeoPixels. This allows us to use more resolution in the colors. Instead of each color channel having 256 possibled values, it has 768.

This makes color transitions smoother at low levels.

Color

Each flame ramps from "off" to a color selected from the "flamecolors" table.

You can adust the colors in that table to change to colors of your candle.

This version is mostly reds, oranges, and yellows, with an occasional blue spike.

Flicker

After a flame reaches it's peak value, it ramps back down to black.

To create a flicker effect, every time we decrease the brightness of a flame, we introduce a chance to reverse direction and start increasing brighness again.

You can adjust this with "FLICKER_CHANCE" constant. The higher the value, the more flickering.

Brightness & Speed

The functions at end of the sketch, GetStepSize() and GetMaxBrightness() specify these values.

The larger the step size, the faster the flames grow.

GetMaxBrightness() has some alternative models commented out. If you want your flame "height" to be more uniform, try those models.

Installation

In my case, the whole assembly fit in through one of the holes in the pumpkin.

I then fished the twist-ties out through the hole in the bottom to pull the board towards the hole. It took some dexterity to get the power supply plugged in, but then I just twisted the ties around a craft stick and secured everything with duct tape for extra security.

RAIN!

The first night the improved jack-o-lantern was outside it rained.

The base of the pumpkin filled with water, but the NeoPixels were still happily flickering away in the morning.

I cut some drainage holes and everything has been working great.

This guide was first published on Nov 05, 2015. It was last updated on Nov 05, 2015.