The RGB LED Module is an addressable multi-colour LED that can be daisy-chained into long strings.

Module Pinout

The RGB LED Module has two sets of connections: one for input, and one as output to daisy-chain to other modules.


If you only have a single module, ignore the connections on the left and only use the connections on the right.

VCC: Connect to 5V on your microcontroller.

CKI: Clock Input. Connect to a digital I/O pin on your microcontroller.

SDI: Serial Data Input. Connect to a digital I/O pin on your microcontroller.

GND: Connect to GND (0V) on your microcontroller.

Additional connections for daisy-chaining to other modules:

CKO: Clock Output. Connect to the CKI (Clock Input) on the next module.

SDO: Serial Data Output. Connect to the SDI (Serial Data Input) on the next module.

Basic Connections

Connect GND on the module to GND on your Arduino; VCC on the module to 5V on your Arduino; CKI on the module to one of the digital I/O pins; SDI on the module to another of the digital I/O pins. In this example we used D2 for CKI and D3 for SDI.

Setting Colours

The example below cycles through red, green, blue, and white at 1 second intervals. Open the Arduino IDE, create a new sketch, and paste in the following code:

int CKI = 2;
int SDI = 3;
int colour_id = 0;

#define STRIP_LENGTH 1 // Number of RGBLED modules connected
long strip_colors[STRIP_LENGTH];

void setup() {
  pinMode(SDI, OUTPUT);
  pinMode(CKI, OUTPUT);
}

void loop() {
  // Pre-fill the color array with known values
  strip_colors[0] = 0xFF0000; // Red
  strip_colors[1] = 0x00FF00; // Green
  strip_colors[2] = 0x0000FF; // Blue
  strip_colors[3] = 0xFFFFFF; // White
  post_frame(colour_id); //Push the current color frame to the strip
  colour_id++;
  if(colour_id == 4) {
    colour_id = 0;
  }
  delay(1000);
}

void post_frame (int colour_id) {
  for(int LED_number = 0; LED_number < STRIP_LENGTH; LED_number++)
  {
    long this_led_color = strip_colors[colour_id]; //24 bits of color data

    for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
      //Feed color bit 23 first (red data MSB)

      digitalWrite(CKI, LOW); //Only change data when clock is low

      long mask = 1L << color_bit;
      //The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.

      if(this_led_color & mask) 
        digitalWrite(SDI, HIGH);
      else
        digitalWrite(SDI, LOW);

      digitalWrite(CKI, HIGH); //Data is latched when clock goes high
    }
  }

  //Pull clock low to put strip into reset/post mode
  digitalWrite(CKI, LOW);
  delayMicroseconds(500); //Wait for 500us to go into reset
}

Upload the sketch to your Arduino.