Introduction: Neopixel Led Ring Ornament

Hi and happy holidays to you all! If you take look at my profile, it's clear that I'm somewhat of an LED addict. This addiction more or less began a few years ago when tinkering with commonly available WS2812B (aka Neopixel) rings. My mom suggested putting the rings on our Christmas tree, and so, after some soldering (and some crafting help from mom!) my LED ornament was born. I have since updated the ornament, which I'll present to you today. (please note that the LED colors look much better in person than in the video above)

The ornament is assembled from WS2812B LED rings. You can usually find these rings as a nested set, so soldering them together is fairly straight-forward. You also can make the ornaments smaller or larger by adding or omitting rings (you would have to change a couple of lines in my code though). The ornament I'm presenting to you today uses 61 LEDs distributed across 5 rings. The outer diameter of the ornament is about 90mm. At this size, it's small enough to comfortably hang from a tree, while still having plenty of LEDs for animations.

In this instructable I will show you how to make both the ornament and my control board, including battery and wall powered versions. However, there a a ton of different ways you could control the ornament, so I encourage you to use whatever setup that you prefer.

I will provide versions of my code for both Arduino (Uno, Nano, etc) and ESP8266 (specifically the Wemos D1 Mini). Hopefully this will be helpful if you want to do your own control setup.

If you have never worked with WS2812B's before, I would suggest reading Adafruit's guide for an overview.

To control the ornament I'm using a Wemos D1 Mini mounted on a custom PCB that I've designed. The PCB can be adapted to be run from a LiPo battery or from a 5V wall adapter. Using the battery should yield about 3-4 hours of run time using my default settings. This can probably be extended quite a lot by limiting the effects and brightness.

Everything on the PCB is through-hole mounted (except for a few 0805 resistors used in the wall powered version), so it should be easy to solder.

Before deciding between the wall or battery powered versions, I highly encourage you to read the whole instructable before choosing, as the parts needed differ slightly.

My custom PCB also includes mounts for a MAX4466 microphone board (for audio based animations) and a HC-05 Bluetooth board. Likewise, using the Wemos D1 Mini allows for wireless control. Unfortunately, at this time, my code doesn't include support for these, but I hope to add it in the future!

Finally, if you have any questions at all please post a comment and I'll get back to you :)

Github links:

Ornament Code / Files: Link

Control PCB Files:

  • For Battery Powered: Mk2 Board (You can also use the Mk3, the only difference is the inclusion of a logic level converter, which you can bypass)
  • For Wall Powered: Mk3 Board

If you are interested, you can view the PCB's layout and schematic here. (The Mk2 and Mk3 boards will be used in this Instructable)

3D Printed Control Box Files: Link

LED PCB Ring Files (designed by me): Link to files and Link to schematic. The files are only needed if you want to have a set of rings manufactured by someone like JLCPCB. This will probably save you money if you want a lot of rings. You can see instructions for ordering assembled PCBs in step 4 of my other Instructable.

Supplies

Custom PCB:

For both battery and wall powered options you'll need a custom PCB designed by myself. If you've never ordered a custom PCB before, it's easy. I briefly go over it in Step 2 of one of my other instructables here. As with that instructable, all the ordering defaults should be fine for this project.

For the battery powered version you can use the PCB files found here.

For the wall powered version you can use the PCB files found here.

The only difference between the wall and battery boards is that the wall version includes a spot for a logic level converter. This can be bypassed, so if you want to be flexible, you can just order the wall powered PCB version.

Electronic Parts:

(You might be able to find most of the parts for lower cost at places like Aliexpress, Ebay, Banggood, etc)

For Battery and Wall Powered Versions:

  • One set of WS2812b Rings. Found here. Should include 24, 16, 12, 8 and 1 length rings.
  • One Wemos D1 Mini V3. Found here.
  • One 19 x 6 x 13mm Slide Switch (these are pretty common, the actuator should be 4-5mm tall). Found here or here.
  • Two JST-XH 2.5mm 3 Pin Male Connectors. Found here
  • One Right Angle JST-XH 2.5mm 3-Pin Female Connector. Found here.
  • One JST-XH 2.5mm 3-Pin Female Connector. Found here.
  • Six JST-XH Crimp Terminals (although you should buy spares). Found here.
  • Male 2.54mm headers.
  • 22Ga stranded wire.
  • One MAX4466 breakout board mic Found here. (optional)
  • One HR-05 Bluetooth board. Found here. (optional)

Extra Parts for Battery Powered Version:

  • One 1S 720 mah LiPo battery. Found here. (you can use other LiPo's, but they should fit within about a 50x34mm area to stay hidden behind the ornament)
  • One TP4056 LiPo charging board. Found here.
  • One Right Angle JST-PH 2.00mm 2 Pin Female Connector. Found here.

Extra Parts for Wall Powered Version:

  • One DC 3.5mm (1.35mm internal diam.) female connector. Found here.
  • One 5v 2A(min) wall adapter. You have a number of options for this. Ideally you'd find one with a 3.5mm DC jack, but those are uncommon. Most have a 2.1mm DC jack (like this one), so you'll need to buy an adapter down to 3.5mm (like these). As another option, you can use any USB phone charger capable of providing 2A and a USB to 3.5mm DC jack like this. For all the options, make sure your adapter has over-current/short protection, most UL-listed adapters should have this.
  • Three 6x6x9mm tactile buttons. Found here. (optional)
  • One 74AHCT125 Logic Level Converter. Found here. (optional, but recommended)
  • One 1000uf, 10V Electrolytic Capacitor. Found here (somewhat optional)
  • Three of each 0805 size 100K resistor, 1K resistor, and 1uf capacitor. Found here, here, and here. (optional, for buttons)
  • Two 4mm M2 screws (optional, for 3D-printed box)

Other Parts:

  • White/cream felt. I don't have a specific source for this, but you can probably find some at your local craft store. The stuff I used is about 1mm thick, which seems to diffuse the LEDs well while keeping them visibly bright. If you can't find or don't want to work with felt, you can probably use some other material as a diffuser, but you'll have to experiment.
  • Felt in a color of your choice. This is for the cap at the top of the ornament. Can be as thin or thick as you like.
  • 95mm Diam. die cutting disk. Used for cutting the felt circle. Found here.
  • Rolling pin or some other hard cylindrical object. Used for cutting with the die
  • Needle and thread. You'll want to use thread that closely matches the color of the white/cream felt. Everyday sewing thread should work fine; it doesn't have to be particularly strong.
  • Striped string in the color of your choice. This is for hanging the ornament. You can probably get a single spool of a specific color at your local craft store, but I found this bundle with a bunch of colors that should work.

Tools:

  • Scissors.
  • Soldering iron + solder.
  • Superglue.
  • Tacky glue. (For the felt parts, you could also probably just use hot glue)
  • Hot glue + hot glue gun.
  • Wire cutters and strippers.
  • Tweezers. (For soldering)
  • Crimper for JST terminals. Found here.
  • Conformal Coating (or you can just use hot glue)
  • 3D printer (for box for wall powered version) (optional)

Step 1: Deciding Between Battery or Wall Powered

I'll show you how to make both battery and wall powered versions of the ornament in this instructable, but since you'll need slightly different parts for each option you'll need to choose before you start building.

My custom PCB doesn't really care what it's power source is, as long as it's 5V or under. Normally, the board is powered via a 2-pin JST-XH connector, but this won't work directly with wall adapters. You could make a DC jack to JST adapter, but fortunately the pin-out and spacing of this 1.35mm female DC jack roughly match those of the JST connector. So, you can easily substitute the 1.35mm connector, keeping things clean and simple. The only other possible issue when using 5V power is level shifting the data to the LEDs. I go over that in more detail in Step 18, but the short version is, is that it probably won't be an issue for you.

So overall, the decision on whether to use wall or battery power mostly depends on your specific decorating situation. For example, I generally use wall power when hanging the ornaments from a tree, since it's easy to conceal the wires, and I'd like to keep them on for the whole day. But, if I were hanging them on a wall, drawer, shelf etc, battery power might be easier. With battery power you should get around 3-4 hours of runtime with the default settings, but you could extend this greatly by limiting the animations to those that light-up fewer LEDs at once.

For either option you can technically separate the controller from the ornament. For example, you could have the controller at the base of your Christmas tree, and run data/power/ground cable up to the ornament. This allows you to do three things. Firstly, it reduces weight of the ornament, which may be helpful when hanging it. Second, you to drive multiple ornaments at once (I have alternate version of my PCB for doing this). Finally, you get easy access to the controllers buttons for adjusting the animations. I have also designed a 3D-printable box for holding the controller.

However, due to the LiPo's reduced voltage (4.2V) and since the voltage will drop as time goes on, you should keep the distance between the ornament and the controller as short as possible to minimize the voltage drop. If you do want to keep the controller and the ornament separate, you should follow the steps for the wall powered version, but use a LiPo for power.

Step 2: Making the Ornament Step 1:

The first step in making the ornament is removing the outer 32 pixel LED ring (if your set came with one). This should leave you with five rings. You can separate the rings by cutting the four connection between each ring using wire cutters.

Most of the WS2812B ring sets you find online come as six rings with 32, 24, 16, 12, 8, 1 LEDs each. While you could make an ornament using all the rings, it would have a diameter of ~112mm, which, in my opinion, is a little too large to hang on a Christmas tree. Removing the outer 32 LED ring gives the ornament a diameter of ~91mm, which is just about okay to hang on a tree, while also giving you 61 LEDs in total to play with.

Note that there's not problem with using all the rings, but you will need to cut a larger felt circle in step 4, and also change a few lines in my code.

Step 3: Making the Ornament Step 2:

Next, take a female 3-pin JST-XH connector and solder it to the outer ring as pictured. The pins of the connector should be attached to the DIN, 5V, and GND pads on the ring. The JST connector will be used to connect to the controller, providing power, and data to all the rings.

Next, we'll connect all of the rings' 5V and GND pads together so that the share a common power source. The pads should all be in a line across all the rings. There are a bunch of different ways to connect the pads; you could use two lengths of solid wire, a bunch of small lengths of wire, etc. I chose to use the pins from male 2.54mm headers because it's easy to slide them out of their strip, I have a bunch of them lying around, and they're just the right length to bridge the gaps between the rings. This saves you having to measure and strip a bunch of wire sections.

As pictured, solder header pins between all the GND pads and then between all the 5V pads to connect them in two rows. You'll probably need to use tweezers to hold the pins in place while you solder.

Step 4: Making the Ornament Step 3:

Now we'll connect the data pins between the rings.

WS2812B LEDs are intended to be assembled into one long chain where each LED passes data onto the next using a single data pin. On most WS2812B strips and boards, DI represents the data input side of the strip (ie the first LED on the strip), while DO or DOUT represents the data output of the strip (ie the last LED on the strip). This is true for the rings, each having a DI and a DO pad.

We want to wire the rings so that data from one ring feeds into the next, starting with the outer ring and heading inward. In other words, we want to connect the DO pad of the outer ring to the DI pad of the next inner ring, moving inward one ring at a time.

To do this, I soldered lengths of stranded 22Ga wire between the pads as pictured. I used stranded wire in place of header pins to make it easier to distinguish the data pads at a glance. Please note that different versions of rings may have the DI and DO pads all on the same side (instead of alternating like mine do). In that case the data wires will need to cross over the 5V and GND wires for each data connection.

Once all the connections are finished, you should coat them with either a conformal coating or some hot-glue to protect against accidental shorts.

Step 5: Making the Ornament Step 4:

Next, we'll make the felt cover for the ornament.

To begin you should cut a ~95mm dia. circle of white felt. To do this I used some card cutting dies, which you can find here. You could try to cut the felt by hand, but using a die will give you perfect results. Officially, the dies are meant to be used with a die press machine like the Sizzix Big Shot (which I used because my mom has one), buuuut I'm fairly certain you could just use a rolling pin instead.

Using a Rolling Pin:

The die has a raised bump along it's middle. This is the cutting edge. To use the die place it on top of the felt with the cutting edge down. Make sure you are doing this on a smooth, hard surface; you don't want the die to leave a mark on your cutting surface. Next take your rolling pin and roll it over the die, applying downward pressure. This should cut the felt, but you might have to repeat it a few times to get a complete cut.

In the end, you should be left with a perfect felt circle.

Step 6: Making the Ornament Step 5:

Next we'll attach the felt circle to the LED rings. You could use glue for this (classic Tacky Glue should work), but it might effect the light diffusion of the LEDs, leaving some areas darker than others. Instead I choose to use a needle and thread to affix the circle.

The process is a bit hard to describe, but hopefully you'll get the idea.

Starting at the top of the ornament, take your needle and thread and pass it down through the top of the felt circle, going through the gap between the outer two rings (24 and 16 LEDs). Flip the ornament onto it's back and pick a spot somewhere in the gap between the 12 and 16 LED rings and slightly counter-clockwise of your first insertion. Push your needle back up through the felt, through the spot you chose. The needle and thread should now be back on the top side of the ornament. You have now completed one loop.

Now repeat the entire process. You should slowly be walking the single thread around the ornament, tying down the felt as you go. You can use as many loops as you like, but about five should be good enough to hold the felt in place.

Eventually you'll wrap back round to the first insert. When this happens, pass the needle under the first loop thread. Pull the thread end taunt so that the felt is secure, then take the end and tie it in a knot around the first loop, holding it in place.

I know this may be a bit confusing, but if you just start threading the needle between the rings, you'll probably figure it out. If you have any questions, please let me know!

Step 7: Making the Ornament Step 6:

Next we'll add the ornament cap.

I don't have a huge amount of advice here. Just cut out a cap shape from felt using sharp scissors. It helps to lightly sketch your cut lines using a pen before cutting. If you're like me you'll probably have to make a couple of caps before you get one you like.

Once you have your cap, glue it to the top of the ornament using hot or Tacky Glue. Make sure it's over the JST connector, because that's where the ornament will hang from.

Step 8: Making the Ornament Step 7:

Finally, we'll add the hanging string.

As pictured, take a length of string of your choosing and pass it through the gap between the 24 and 16 LED rings, under the ring connection wires.

Tie the two string ends together and you're done with the ornament!

Next I'll go over building the battery powered controller. If you're looking for the wall powered version, skip ahead until you reach the wall controller steps.

Step 9: Battery Powered Controller Step 1:

For this series of steps I'll go over how to make a battery powered version of the ornament. Please note that this version uses a LiPo battery. If not handled correctly, these can be dangerous and pose a fire risk. If you are not familiar with LiPo batteries, I encourage you to do some safety research.

Also, since the PCB supports microphone and Bluetooth breakout boards, some pins will not be used in this instructable. This is intentional.

To begin, grab my custom controller PCB and a TP4056 LiPo charging board. As pictured, hot-glue the TP4056 to the top of the controller. Make sure you leave room to add the Wemos D1 Mini later (you can see its outline on the PCB).

Next, solder lengths of 22Ga wire between the B+ and B- pins on both the controller and the TP4056. The B+ and B- are labeled on the reverse side of the controller PCB.

Step 10: Battery Powered Controller Step 2:

Next, solder the slide switch, 3-pin JST-XH, and 2-pin JST-SH connectors into position as pictured. You may want to add a bit of hot-glue to add some extra rigidity to the connections. The 3-pin JST connector will be used to provide power and data to the ornament rings, while the 2-pin connector provides power input from the battery. The slide switch controls power to both the controller and rings.

You should also solder male 2.54mm headers in place for the Wemos D1 Mini. The Wemos will be mounted to the same side of the controller PCB as the other components.

You may want add a 1000uf electrolytic capacitor to the board. This protects the LEDs from current surges on start-up. This is more imporant when using wall supplies, but adding it doesn't hurt. It isn't shown in the images above, but you can add it using the through-holes next to the "1000uf" silkscreen label. Electrolytic capacitors do have a polarity preference, so make sure you match positive to "+" and ground to "-". To keep the board compact, you should lay the capacitor on its side before inserting and soldering the leads.

Step 11: Battery Powered Controller Step 3:

Finally, solder the Wemos D1 Mini in place using the headers you added in the previous step.

At this point the controller is complete. You can use hot-glue to attach it and the battery to the back of the ornament as pictured. Make sure that you are able to plug a micro USB cable into both the Wemos and the TP4056. You should also make sure that the ornament's connections underneath the controller are not being shorted out by any of the controller's pins; you may need use a bit of tape to cover any clashing pins.

To power the controller, plug the battery's JST-SH connector into the controller's 2-pin JST connector. Make sure that the plug's polarity matches the controller's connector!Positive should go to VCC and ground to GND as labeled on the PCB. On most batteries, positive is the red wire while ground is the black. You should confirm this with multi-meter if possible. If the pins are reversed on your battery, you can slip them out of the connector using a pair of tweezers and swap them over.

When the slide switch is in the "off / chg" position you should be able to charge the battery using the TP4056. When the battery is charging, the red LED on the TP4056 should be lit. Please note that you cannot charge the ornament while it is on.

Step 12: Battery Powered Controller Step 4:

Finally, using two male 3-pin JST-XH connectors, you should make an adapter to connect the controller to the ornament. Follow the wiring order as pictured; black is ground, red is positive, and blue is data.

Connect the adapter to the ornament and the controller as pictured. Make sure the wires match correctly.

At this point the ornament is complete! You can skip over to the coding step the upload the code and get your ornament twinkling. :)

If you have any questions, please leave a comment and I'll get back to you.

Step 13: Wall Powered Controller Notes:

In this next series of steps I'll go over how to build a wall powered version of the controller. This lets you power the ornament using a common 5V wall adapter. You also get access to the controller's push buttons (which are inaccessible on the battery powered version) letting you control the LED effects. Please note that the controller does not feature any over-voltage regulation or over-current protection, so make sure you use a 5V adapter with over-current protection built in (most modern, UL listed adapters should have this).

The adapter must be able to output enough current to drive the ornament. For a single ornament, the maximum current draw (max brightness with all LEDs at full white, 60ma per LED) is about 3.5A. However, maximum brightness is waaaay brighter than you'll ever need, my code limits the brightness to 150 out of 255, while the default is 50. So on default the maximum current draw is about 1A, while at 150 it is about 2A. Likewise, none of my pre-programmed effects get close to full white, so the actual current draw will be much lower than max. So, for a single ornament, a common 2-2.5A adapter should be fine.

I've also designed a 3D-printable box for the controller to protect it.

If you are interested in driving multiple ornaments at once, I have designed an alternate controller PCB for up to three ornaments here. I won't go over it's assembly in detail but it is largely the same as the single ornament controller. You will need to use three vertical JST-XH 3-pin connectors in place of the single right angle one. Furthermore, if you want to drive multiple ornaments, you will need a bigger adapter for the higher current draw. Likewise, you'll need to be careful about some of the components on the board, namely the power connector and slide switch. Both should probably only be driven up to about 3A or so. This will be fine on the default setting, but if you need more brightness you'll need beefier components.

Step 14: Wall Powered Controller Step 1:

To begin, grab the controller's PCB. Please note that your PCB will look slightly different from mine, with an extra row set of pins inside the TP4056 outline. These are for mounting a 74AHCT125 logic level converter. I added this after assembling the first PCB, I have tested your version, but did not do a full assembly. I will go over the converter in a later step.

On the top of the PCB (the side with the TP4056 outline), solder the SMD resistors and capacitors in place as pictured. Their values are indicated on the PCB. These are for a debouncing the push buttons.

You should also bridge the pads labeled "LLC Bypass" near the D8 pin. This by-passes the 74AHCT125 logic level converter and sends data straight to the LEDs.

Step 15: Wall Powered Controller Step 2:

Next we will solder the DC jack connector and 3-Pin JST-XH connector to the PCB. The DC jack provides power input, while the JST connector provides power and data to the ornament.

Fortuitously, the pins of a common 3.5mm DC jack connector (linked in the supplies) happen to closely match those of a 2.54mm 2-pin JST-XH connector. This allows us to use the two connectors interchangeably on the PCB as long as we pay attention to the pin polarities, so that positive goes to VCC, and ground to GND. I have designed the PCB to accommodate the 3 pins on the DC jack. For a center positive connector (the most common type), the outer pins will be ground, and the inner positive.

Make sure you confirm that your wall adapter is center positive. Most should be, but if it isn't you'll have to use a different one.

Next, take the DC jack and a right angled 3-pin JST-XH connector and solder them to the PCB as pictured.

Step 16: Wall Powered Controller Step 3:

Now we'll add the Wemos D1 Mini.

Before you do this, you should confirm that you can program the Wemos, and that it's working correctly.

Begin by following the instructions here to install the ESP8266 core for the Arduino IDE.

This allows you to program the Wemos as if it was an Arduino. Once installed, open the IDE and connect the Wemos to your computer using a micro-USB cable. Under tools->board, select "LOLIN(WEMOS) D1 R2 & Mini". Also under tools, select the port that the Wemos is connected to. Try uploading blink (or your own favorite test program). If everything's OK, the Wemos's LED should start blinking once a second.

Flip he controller PCB over and solder 2.54mm male header rows to the Wemos D1 Mini area as pictured.

Next, push the D1 mini onto the headers, and solder it in place.

Step 17: Wall Powered Controller Step 4:

Next, solder the slide switch and tactile push-buttons in place as pictured. You'll probably need to trim the side tabs off the switch. Make sure that the switch body isn't shorting out any of the pads underneath. You may have to add a small strip of tape over the pads.

You may want add a 1000uf electrolytic capacitor to the board. This protects the LEDs from current surges on start-up. It isn't shown in the images above, but you can add it using the through-holes next to the "1000uf" silkscreen label. Electrolytic capacitors do have a polarity preference, so make sure you match positive to "+" and ground to "-". To keep the board compact, you should lay the capacitor on its side before inserting and soldering the leads.

If you aren't 3D-printing my box for the controller, you're finished! You should read logic level notes in the next step, but otherwise you can skip on to the code section.

If you are going to 3D-print my enclosure for the controller, you should print out one copy of "Switch Cap.stl" and three copies of "Button Cap.stl". You can find all the files here.

As pictured, push the switch and button caps onto the slide switch and buttons.

  • The slide switch cap is square and will probably need a bit of glue to stick to the switch lever.
  • The button caps are round. They should be a friction fit onto the buttons.

Step 18: Wall Powered Controller Logic Level Shifting:

WS2812B LEDs are 5V devices, while the Wemos is a 3.3V device. This technically means that the signal put out by the Wemos will not be able to be read by the LEDs. Spec-wise, WS2812B's accept voltages down to ~3.5V. This is the voltage needed to register a digital "high" signal (0.7 * (input voltage) as per the WS2812B datasheet). This is still outside the Wemos's range, buuuut, usually the voltage drop between the controller's output and the LEDs on the ornament is large enough to bridge the data gap. So in my experience, you can generally drive WS2812B's with a 3.3V device without any intervening hardware.

However, should you experience any glitching from the LEDs, the control board has a spot for a 74AHCT125 logic level converter. This translates the 3.3V data signals to 5V, and should fix any issues.

The 74AHCT125 is soldered in place of the TP4056 LiPo charger as pictured above. Make sure that you de-solder the "LLC Bypass" pad near the D8 pin.

Finally, in case you are interested, the reason why the battery powered version does not need a logic level converter is that the LiPo's output voltage is only 4.2V. So, the voltage needed to register a "high" is only 4.2 * 0.7 = ~3V, which the Wemos can deliver.

Step 19: Wall Powered Controller Step 5:

If you are 3D-printing my control box enclosure, you should print out one "Box.stl" and one "Lid.stl". The files can be found here.

To begin, attach the lid to the box at the hinge. You can use a section of 1.75mm filament as the hinge pin.

Next, insert the control board as pictured. The DC jack, JST-XH connector, slide switch, and push-buttons should all align with cutouts in the box and/or lid. Secure the controller with hot glue.

After closing the lid, you can optionally secure it using two 4-5mm M2 screws.

Step 20: Wall Powered Controller Step 6:

The controller is now finished! To connect the ornament and wall adapter you can follow the pictures above. You'll need to make a female JST to JST connector to get data/power to the ornament. Make sure you get the pin order's correct! Just match the VCC/Data/GND pins to those on the ornament input and controller output. Try not to make the cable too long, or you'll have too large a voltage drop, and the LED's colors will fade. My longest cable is about 6ft. This should let you hang the ornament in a Christmas tree while keeping the controller at ground level.

You can now upload the code and get your ornament twinkling! :)

Step 21: Code

I've written code for the ornament that includes 28 different effects. I've added versions that are compatible with both ESP (Wemos, ESP8266, etc) and 8-bit Arduino boards (the Uno, Nano, Pro-Mini, etc), in case you want to use your own controller. The effects are the same for each, but there are a few small differences that I'll go over below.

You can find both sets of code here.

My code doesn't currently support WiFi, but I hope to add it in the future. In the meanwhile, if you would like to take advantage of the Wemos's WiFi capabilities you could look into using WLED, which has it's own set of effects.

Before you can upload the code to the Wemos, you'll need three libraries:

  • My "PixelStrip" library
  • The Adafruit "Neopixel" library
  • The "TimerOne" library by Paul Stoffregen (only needed for Arduino code version, should already be installed by default in the IDE)

You can download the PixelStrip library from here. Download all the files and place them in a folder named "PixelStrip" in the libraries folder of your Arduino install directory.

You can install the Adafruit Neopixel and TimerOne libraries using the Arduino IDE's library manager.

Once you've installed both libraries you can upload the code to the micro-controller of your choosing.

Both sets of code support button inputs and EEPROM saving. EEPROM is used to save the effect number, brightness, and effect rotation settings when the ornament is powered off. By default both of these features are turned off. You can turn them on by setting the "BUTTONS_ENABLE" and "EEPROM_ENABLE" flags at the top of the code to true. The code is fully commented, but let me know if you have any questions.

The button usage differs between the Arduino and ESP boards. This is explained below.

Wemos/ESP Button Usage:

  • Button 1: Next Effect (or restarts current effect if effect rotation is off)
  • Button 2: Effect Rotation on/off. This makes the current effect repeat indefinitely
  • Button 3: Brightness cycle. You can adjust the increments by changing the "brightnessLevels" array in my code.

Arduino Button Usage:

The way my library is written requires using interrupts for button presses. Most Arduino boards only have two interrupt pins, so we have to do some tricks to replicate the ESP's functionality:

  • Button 1:
    • Single Press: Next Effect (or restarts current effect if effect rotation is off)
    • Double Press: Enter brightness adjust mode, another single press will exit this mode
  • Button 2:
    • Normally sets effect Rotation on/off. This makes the current effect repeat indefinitely
    • When in brightness adjust mode, changes the brightness

If you've made it this far, thanks for reading! I hope you found this Instructable useful. If you have any questions, please leave a comment, and I'll get back to you.

And finally, happy holidays to you all! :)