Rainbow Lights

In this project, you'll learn how to connect and control a ring of RGB LEDs each with a built-in WS2812 controller.

This rainbow lights ring consists of 60 RGB LEDs each one with a built-in WS2812 controller.

Rainbow Lights

The WS2812_RobotsForFun library contains all of the functions for interfacing with the WS2812 controller.

Parts needed: RGB LED ring with WS2812 controller     
1 Making the connections

The WS2812 controller on the RGB LED ring has four connections: 5V, GND, DI and DO.
  • Connect the 5V to 5V.
  • Connect the GND to GND.
  • Connect the DI (data in) to pin 8.
  • Optional: You can connect several rings together by connecting the DO (data out) signal from one ring to the DI (data in) signal of the next ring.
2 Download the WS2812_RobotsForFun library.
3 Install the WS2812_RobotsForFun library by selecting Sketch from the Arduino IDE menu
  • then select Import Library or Include Library
  • then select Add Library or Add .ZIP Library
Locate and select the WS2812.zip file that you just downloaded in step 2. It should be in the Download folder.

Click the Open button

(Refer to this document for more information on how to install a library if you run into problems.)
4 Create a new program by selecting File from the menu
  • then select Examples
  • then select WS2812_RobotsForFun
  • then select WS2812_sample
In the program make sure that the #define PIN number matches the pin number that the (first) DI signal is connected to.
Also make sure that the #define LED_COUNT number matches the total number of LEDs in your RGB ring(s).
5 Upload and run the program.