RGB Decorative Lights Using An Arduino

Published by frenoy on

Since Christmas eve is just a week away, I decided to build a simple RGB decorative light using an Arduino Nano and WS2812B LEDs. We use some plastic containers/jars to improve the visual effect. This video uses 5 LEDs but this can be increased to suit your needs. You can even add multiple patterns or create color themes based on what you are going for.

The video above talks you through everything you need to build this project and I’d recommend watching it first to get an overview of how everything comes together.

Step 1: Gather the Electronics

Gather The Electronics

The first thing we would need are the WS2812B RGB LEDs and these are available in multiple variants. Either one will work fine. We will be using the Arduino Nano for this build, but the sketch will work with virtually any Arduino compatible board that you may have. We also need some wire to connect everything together and I’m using three core, twisted wire for this build. Lastly, we need the plastic containers which are purely for decorative purpose. The light reflects off the plastic to give us a nice looking effect.

Here are links to the products if it helps:

Step 2: Prepare & Download the Sketch

Install The fastLED Library
Open the DemoReel 100 Sketch

We will be using the fastLED library to drive the WS2812B LEDs but you can also use the Adafruit Neopixel library if that’s your preference. Open up the Arduino IDE and type in “fastLED” in the library manager. Install the library that shows up and then open up the “DemoReel 100” example sketch.

Update The Sketch

We need to update the data pin, number of LEDs and LED type. I’ll be using pin 2, with 5 LEDs. Please also update the LED type to WS2812B as seen in the image.

Test The LEDs

Then, plug in the board, select the right board and COM port. Finally, hit the upload button and wait for it to complete uploading. Once done, connect the LEDs – 5V, GND and data pin to pin 2. The LEDs should display a random pattern which is an indication that everything is working as expected.

Step 3: Prepare LEDs for Final Build

Cut The Individual LEDs
LEDs With Waterproof Tubing
Remove The Waterproof Tubing
Cut Wires Of Suitable Length
Unscrew The Lids

Next, we need to cut the LEDs as we will be using wire to extend the final length. Once done, remove the LEDs from any waterproof tubing. Cut the wire for each of the LEDs and the length will depend on the final positioning that you are aiming for. I decided to use the same wire lengths for all. Also, cut some wire that will be used to connect the microcontroller to the first LED.

Use Tape To Prevent Slippage
Drill Holes In The Lid

Then, drill some holes in the plastic lid as we will be mounting the LEDs on the outer surface of the LED with the beam shining inwards.

Step 4: Final Assembly

Solder Wires To LEDs
Connect Microcontroller To LEDs

Start by soldering the wires to each of the LEDs. Make sure you connect the pins correctly. The microcontroller needs to be connected to the DI (data input) pin of the first LED. Then, the DO (data output) pin needs to be connected to the DI pin of the next LED and so on. Once you’ve soldered all the wires, power ON the microcontroller and all the LEDs should start glowing with a random pattern.

Stick LEDs To Lids
Insulate The Microcontroller

I decided to use double sided tape to attach the LEDs to the top side of the lid, but you can also use some tape over the LEDs or some glue. It is advisable to add some kapton tape or heatshrink tubing to the microcontroller board for insulation.

Screw Lids And Test

Finally, screw the other half of the container in place and power ON the LEDs. Each of the LEDs consumes about 60mA, so make sure that the power supply you are using can deliver the required power. We have previously built power supplies which can be used for this if needed.

Thank you for reading!

Categories: DIY Projects