Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Daniel Porrey
Published © GPL3+

NeoPixel Holiday Candle

Create a candle array with NeoPixels that can be decorated for each holiday.

IntermediateFull instructions providedOver 1 day2,446

Things used in this project

Hardware components

Adafruit NeoPixel Mini PCB
×1
Adafruit Perma-Proto Quarter-sized Breadboard PCB
×1
Adafruit 5mm Plastic Flat LED Holder
×4
SparkFun 5 mm LED: Blue
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
5 mm LED: Green
5 mm LED: Green
×1
Adafruit Pro Trinket - 3V 12MHz
×1
Adafruit USB LiIon/LiPoly charger - v1.2
×1
Adafruit Lithium Ion Polymer Battery - 3.7v 1200mAh
×1
Arduino Stackable Header – 6 Pin
×2
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
Slide Switch
Slide Switch
×1
22 AWG Solid Lead Wire
1 set of wires is required. The project uses 5 colors.
×1
Resistor 330 ohm
Resistor 330 ohm
×1
500-Ohm, 1/2 Watt, Multi-Turn, Top Adjust, 3/8" Square, Cermet Trimmer
×1
Nylon Spacer
OpenBuilds Nylon Spacer
×4
Soap Molds by ArtMinds
×1
ArtMinds® Basswood Canvas
12" x 12" x 1.75"
×1
Ashland® Glass Cylinder Candle Holder 6"
×1
Ashland® Glass Cylinder Candle Holder 8.75"
×1
Ashland® Glass Cylinder Candle Holder 10.5"
×1
Ashland™ Decorative Fillers, Gems
Used a total of 6 42 oz bags
×6
Ashland® Floating Candle, Gardenia
Recommend buying extras in multiples of 3
×3
Distilled Water
1 - 2 Gallons to fill the glass candle cylinders.
×2
Semi-Gloss Spray-Paint - White
×1
White Electrical Tape
×1
Scotch Tape
×1
Hot Glue Stick
×1
Heat Shrink Tubing
Various colors; 3/32"
×1
Glad Press'n Seal
Optional
×1

Software apps and online services

Arduino IDE
Arduino IDE
Adafruit NeoPixel Library

Hand tools and fabrication machines

Standard Drill
3/4" Wood Boarding Drill Bit
17/64" Drill Bit
Hot glue gun (generic)
Hot glue gun (generic)
X-Acto® Knife
Micro Jet Butane Torch
Soldering iron (generic)
Soldering iron (generic)
1/2" Standard Drill Bit

Story

Read more

Schematics

Fritzing File

Breadboard

Code

Arduino Sketch

C/C++
This is the basis sketch used on the Trinket Mini 3V
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

// ***
// *** The first NeoPixel is connected to pin 0
// ***
#define NEO_PIXEL_PIN 0

// ***
// *** The pin on which the power LED is connected
// ***
#define POWER_LED_PIN 3

// ***
// *** Number of NeoPixels
// ***
#define NEO_PIXEL_COUNT 3

// ***
// *** Create the NeoPixel instance
// ***
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NEO_PIXEL_COUNT, NEO_PIXEL_PIN, NEO_GRB + NEO_KHZ800);

void setup()
{
  // ***
  // *** Trinket 16MHz
  // ***
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);

  // ***
  // *** Setup the power LED
  // ***
  pinMode(POWER_LED_PIN, OUTPUT);

  // ***
  // *** Turn the Power LED on
  // ***
  digitalWrite(POWER_LED_PIN, HIGH);

  // ***
  // *** Setup the strip
  // ***
  strip.begin();
  strip.show();
}

void loop()
{
  rainbowCycle(60);
}

void rainbowCycle(uint8_t wait)
{
  uint16_t i, j;

  for (j = 0; j < 256 * 5; j++)
  {
    // ***
    // *** 5 cycles of all colors on wheel
    // ***
    for (i = 0; i < strip.numPixels(); i++)
    {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }

    strip.show();

    delay(wait);
  }
}

uint32_t Wheel(byte WheelPos)
{
  WheelPos = 255 - WheelPos;
  if (WheelPos < 85)
  {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }

  if (WheelPos < 170)
  {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }

  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

Credits

Daniel Porrey

Daniel Porrey

50 projects • 319 followers
I am a developer and creator. As an Amazon Associate I earn from qualifying purchases.
Thanks to EZGIF.COM.

Comments