Introduction: Decorative RGB Lights Using an Arduino
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
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:
- Arduino Nano: https://www.ebay.co.uk/itm/Multi-buy-Arduino-Nano-v3-0-Compatible-Board-CH340G-5V-16MHz-atmega328-Tested/262677405087
- WS2812B LEDs: https://www.ebay.co.uk/itm/WS2812B-RGB-5050-SMD-Strip-5V-Addressable-RF-Controller-Under-Counter-Lights/272910838998
- Twisted Wire: https://www.ebay.co.uk/itm/White-Round-Twisted-Vintage-3-Core-Fabric-Light-Flex-Cable-0-75mm-Electric-Wire/283407985767
Step 2: Prepare & Download the 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.
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.
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
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.
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
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.
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.
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.
If you liked this build, then please consider subscribing to our YouTube channel as your support goes a long way in helping us create such content.
Thank you for reading!