Introduction: How-To Get Started With Addressable RGB LEDs
You’re in a bad mood, the sky is grey, and it’s been raining all day… Not to worry! We have the solution to cheer you up. Get started with the Rainbow LED and its 16-super bright RGB LEDs which will surely brighten up your day.
In this tutorial, we will show you how the device works with an easy-to-follow example using Adafruit's NeoPixel Library.
This module consists of 16 RGB5050 LEDs and has a diameter of 60 mm. The center can be snapped off and you should power these LEDs with 5V DC.
What’s are RGB5050 LEDs?
RGB LEDs mean red, blue, and green LEDs. The LEDs will combine these 3 colors to create more than 16 million new possibilities. 5050 stands for the size of the LEDs (5mm x 5mm).
Materials and Tools:
For this tutorial, you will need
- Arduino board
- The Rainbow RGB LED
- Some jumper wires (male to male)
- And a soldering iron
Let's get started!
Step 1: Connect the Arduino to the Rainbow LED
Here are the connections to make between the LED and Arduino:
RGB LED > Arduino Uno
Input (DIN) > D6
GND > GND
VCC > 5V
We won't go over soldering here because there are a lot of good guides out there that will show you how to do it.
Step 2: Install the Adafruit Library
- Download the Adafruit NeoPixel Library as a .zip file (https://github.com/adafruit/Adafruit_NeoPixel)
- Import the Adafruit NeoPixel Library
- In the Arduino IDE, go to Sketch > Include Library > Add .zip library
- Choose the file that you just downloaded. You should see that the library was added successfully
Step 3: Upload and Run the Code
- Connect your Arduino device to the computer using a USB
- Open your Arduino IDE (Install the IDE if you haven’t already at www.arduino.cc/en/Main/Software)
- Verify that you have the correct board selected under Tools > Board
- Verify you have the correct COM Port selected under Tools > Port
Now, in the Arduino IDE, navigate to File > Examples > Adafruit NeoPixel > strandtest. Upload the code and enjoy the brilliant lights!
A few notes on RGB LEDs in general:
Adjusting the hue
When RGB lights are concerned, the code used to state the colors is typically formatted similarly in parentheses. There will be 3 numbers which you change to whatever color you’d like, and typically a fourth number either in or outside the parentheses which is used to denote which LED you are changing.
For example: if you which to set LED 13 to blue, you could write in: Strip.setPixelColor(13, 0, 0, 255);
If you’re having trouble getting the LEDs to light up correctly, check to make sure you added strip.begin() to the setup and strip.show() –it sends updates to the hardware—after setting the pixel colors
If you want to change the overall brightness of the LEDs, you can add strip.setBrightness()
You're now ready to use the Rainbow LED, or other RGB LEDs, for brighter projects!
We have a be nice policy.
Please be positive and constructive.