The Great Pumpkin

Great Pumpkin

The Idea

My wife had an old decorative Halloween pumpkin sitting unused in the basement. It had a busted incandescent light that hasn’t been lit for at least a decade. She handed it to me and said "can you do something with this?" Pfffft… of course I can…

I was hesitant to post this on here since a lot of my recent projects are based around LEDs, a micro-controller, and some code. However, Halloween is a perfect for projects like this.

The Build

This is almost exactly like my Kid’s Wake Up Light build, but the code loops random RGB values on an RGB LED strip to simulate a flickering candle. This is also similar to my Plywood Pumpkin build, but that used an Arduino, C code, and dedicated Red / Yellow LEDs. This took maybe 30 minutes from start to finish, with most of the time spent tweaking timing and colors.

The Code

import board
import neopixel
import datetime
import time
import random
pixel_pin = board.D18     # GPIO number (not pin number)
num_pixels = 9            # total number of LEDs
BRIGHTNESS = 0.3          # value between 0.0 and 1.0
ORDER = neopixel.RGB
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=BRIGHTNESS, auto_write=False,pixel_order=ORDER)

while True:
  for n in range(0,9,2):
    pixels[n] = (147,random.randint(165,255),41)
  for p in range(1,9,2):
    pixels[p] = (random.randint(90,147),random.randint(100,210),41)
Previous: Shrimp Étouffée Next: Superhero Shelves