How to program RGBWW LED strips with Arduino? In this blog, I’ll show how to connect everything, upload code with Arduino IDE, and make your lights show different colors and white.
1. The materials you need
5V LED Driver
- Output Voltage: DC5V
- Maximum Current: 40A
- Power Rating: 200W
- Input Voltage Range: AC 110V/220V (switchable via switch)
.
Feature:
- Power the RGBWW LED strip and Arduino board
- Can provide sufficient current for longer LED strips
- Great heat dissipation and excellent stability
Arduino UNO R3
The Arduino UNO R3 uses the ATmega328P microcontroller. It works at 5V and runs at 16 MHz. There are 14 digital pins in total and 6 of them support PWM output. It also has 6 analog input pins. You can power it with 7 to 12 volts or connect 5V directly from a power supply. Programming is done through a USB Type-B port.
This board is popular for learning electronics and building prototypes. Many beginners use it for projects such as reading sensor data or controlling lights and motors. It is easy to use and there are plenty of community resources and expansion parts available.
Usage and Function in this setting:
- Functions as the controller that transmits digital signals to the addressable RGB chip and regulates PWM signals for the W+CW chip.
- Connect the Arduino board’s 5V pin to the V+ of the LED driver, and the GND pin to the V-.
- Data output pin (such as 7 or 8) connects to the “DIN” of the RGBWW LED strip , PWM pin (such as ~3 Or ~5) connects to the “W/CW”.
RGBWW LED Strip
Type: This LED strip can be considered as an addressable RGB LED strip plus a tunable white LED strip. An LED strip consisting of addressable RGB LEDs with built-in WS2812 ICs and non-addressable warm white and cool white LEDs.
Operating Voltage: DC5V
Signal Protocol: Single-wire SPI/TTL Protocol, 800kHz, and warm white and cool white LEDs have no signal protocol.
Features: RGB LEDs feature an integrated control chip, enabling full color and brightness control for each pixel, while W and CW LEDs are non-addressable.
LED Density: 180LEDs/m
Others:
- Wires for connecting LED driver, LED strip, and Arduino board.
- 3.3V level shifter for Arduino protection (optional).
2. Wiring Diagram of RGBWW LED Strip
Here’s a schematic wiring diagram of connecting the Arduino board, RGBWW LED strip, and LED driver from LEDSuntech.
Note:
1.The current of the arduino board should be less than 500mA;
2.If there are too many LEDs causing excessive current, please use an external driver;
3.Without a level shifter, the DC3.3/5V in is the voltage output port of the control board and should not be connected to the power supply;
4.RGB LED chips are addressable, while W&CW LED chips are non-addressable. Please ensure that the code is written for this design.
3. Connection Diagram
Please refer to our detailed connection photos. When wiring, keep the data cable from the Arduino to the DIN as short and direct as possible. Make sure all power terminals are securely connected, and always disconnect the power before making any changes.
4. Code Upload
Using Arduino IDE and the FastLED library, you can achieve various lighting effects with code provided by LEDsuntech. If you have any questions about the code, please feel free to contact us.
#include // For controlling addressable RGB LED strips
// Addressable RGB LED configuration
#define RGB_PIN 4 // D2
#define RGB_LEDS 80 // Number of addressable RGB LEDs
Adafruit_NeoPixel rgbStrip = Adafruit_NeoPixel(RGB_LEDS, RGB_PIN, NEO_GRB + NEO_KHZ800);
// Non-addressable WW+CW LED configuration
#define WW_PIN 12 // D6 - Warm White
#define CW_PIN 13 // D7 - Cool White
// PWM range setting (0-1023 for ESP8266)
const int pwmRange = 1023;
void setup() {
Serial.begin(115200);
// Initialize addressable RGB LED strip
rgbStrip.begin();
rgbStrip.show(); // Initialize all LEDs to OFF
// Set WW/CW pins as output
pinMode(WW_PIN, OUTPUT);
pinMode(CW_PIN, OUTPUT);
analogWrite(WW_PIN, 0);
analogWrite(CW_PIN, 0);
Serial.println("RGBWW LED Controller Ready");
}
void loop() {
// Example 1: RGB rainbow effect + warm white light
rainbowCycle(10);
setWhite(255, 50); // Strong warm white, weak cool white
// Example 2: Static RGB blue + cool white light
setRGBColor(0, 0, 255);
setWhite(50, 255);
delay(2000);
// Example 3: RGB theater chase + white gradient
theaterChase(0, 255, 0, 50); // Green theater chase effect
for(int i = 0; i <= 255; i++) {
setWhite(i, 255-i);
delay(20);
}
}
// Set RGB color (0-255)
void setRGBColor(uint8_t r, uint8_t g, uint8_t b) {
for(int i=0; i<rgbStrip.numPixels(); i++) {
rgbStrip.setPixelColor(i, rgbStrip.Color(r, g, b));
}
rgbStrip.show();
}
// Set white light ratio (0-255)
void setWhite(uint8_t ww, uint8_t cw) {
analogWrite(WW_PIN, map(ww, 0, 255, 0, pwmRange));
analogWrite(CW_PIN, map(cw, 0, 255, 0, pwmRange));
Serial.print("Set White - WW:");
Serial.print(ww);
Serial.print(" CW:");
Serial.println(cw);
}
// Rainbow effect function
void rainbowCycle(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256*5; j++) { // 5 cycles of all colors on the wheel
for(i=0; i< rgbStrip.numPixels(); i++) {
rgbStrip.setPixelColor(i, Wheel(((i * 256 / rgbStrip.numPixels()) + j) & 255));
}
rgbStrip.show();
delay(wait);
}
}
// Theater chase effect
void theaterChase(uint8_t r, uint8_t g, uint8_t b, uint8_t wait) {
for (int q=0; q < 3; q++) {
for (int i=0; i < rgbStrip.numPixels(); i=i+3) {
rgbStrip.setPixelColor(i+q, rgbStrip.Color(r, g, b)); // Light up every 3rd LED
}
rgbStrip.show();
delay(wait);
for (int i=0; i < rgbStrip.numPixels(); i=i+3) {
rgbStrip.setPixelColor(i+q, 0); // Turn off
}
}
}
// Helper function for the rainbow effect
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return rgbStrip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if(WheelPos < 170) {
WheelPos -= 85;
return rgbStrip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return rgbStrip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
5. Demonstration Video of Lighting Effects
This RGBWW LED strip has addressable RGB LEDs and regular warm and cool white LEDs. You can create many lighting effects. Use it with Arduino and a driver to make your lighting ideas real.
Please contact us if you require any support with RGBWW LED strip control on Arduino.