Controlling RGB strips with Arduino
The RGB (Red Green Blue) LED can be controlled using Arduino programming also we can bring the varies colors in a single strip.
Today, I want to show you how you too can control that powerful little LED in your own and make your place as smarter.
Incandescent light bulbs are slowly becoming a thing of the past with LEDs kicking in, especially RGB LEDs. So, why not learn how to control your RGB LEDs the way you want?
Our RGB and multi-color LED strip light allows customers to have full control over the color of their lighting. With three or more LEDs on each node, users can seamlessly blend colors to achieve the perfect hue. … Use your imagination and choose your desired color to set the mood
List of things you’ll need
- Arduino uno board
- 5v LED strip
- USB cable (or something else to power your Arduino)
- 330ohm resistor
What is a light strip?
An LED strip light (also known as an LED tape or ribbon light) is a flexible circuit board populated by surface mounted light-emitting diodes (SMD LEDs) and other components that usually comes with an adhesive backing.
What is RGB color value?
A color’s RGB value indicates its red, green, and blue intensity. Each intensity value is on a scale of 0 to 255, or in hexadecimal from 00 to FF. RGB values are used in HTML, XHTML, CSS, and other web standards
In this tutorial we’ll be setting our RGB LED to any color.
Let’s go!
Make the connections as shown below.
Once you completed the final circuit please download (fast led) library file in Arduino then go with program listed below:
Procedure for downloading FastLED.h library file:
Open Arduino Software –> Tools –> Manage libraries –> seach for FastLED.h –> install
#include "FastLED.h"
#define NUM_LEDS 60
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
}
void loop() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 255, 0);
FastLED.show();
delay(5);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(255, 0, 0);
FastLED.show();
delay(5);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 0, 255);
FastLED.show();
delay(5);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(51, 0, 102);
FastLED.show();
delay(5);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(245, 30, 30);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(55, 255, 0);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 102, 51);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(250, 0, 190);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(55, 255, 10);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 243, 122);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(255, 0, 255);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(122, 106, 0);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(135, 255, 12);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(255, 255, 255);
FastLED.show();
delay(15);
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
}
When the circuit get completed compile and run the program in a circuit
Color codes for controlling RGB LED to various colors
These are some of the color code for controlling RGB led to bring various color, you can use these values and change the color code as your convenience.
These are some of the color code for controlling RGB led to bring various color, you can use these values and change the color code as your convenience.
Written by
Lalithkumar Rameshkumar
Junior Embedded Engineer, Dotworld Technologies