Skip to content

RGB LED Strip Driver

Keir Rice edited this page Oct 16, 2018 · 6 revisions

RGB LED Strip Driver

Photo of LED driver board

These LED driver are designed to drive a 5m strip of LED lights at up to 12V with the color controlled from an Arduino. These drivers can be daisy chained together sharing the control signal and operating on lockstep.

Connections

The 2 wide screw terminal is for the power supply. The 4 wide terminal is for the output to the LED strip V+, Green, Red, and Blue. The 4 wide input is for Clock in (CIN), Data in (DIN), +5V (VCC), and GND.

Details

The board is using a P9813 chip set to manage the serial data from the Arduino and drive transistors to modulate the amount of current to each color channel.

P9813 Data sheet

Code

The easiest way to get up and running is to use the FastLED library.

  1. Wire everything up.
  2. Set your CIN and DIN pins.
  3. Set the number of LEDs to 1. (This chipset doesn't support addressable LED strips, the whole strip acts as a 'single LED address')
  4. Initialize the library to the P9813 chipset.
  5. Do lighting calls.
#include <FastLED.h>

#define NUM_LEDS 1
CRGB leds[NUM_LEDS];

static const char DATA_PIN = 12;
static const char CLOCK_PIN = 13;

void setup() {
    FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
}

void loop() { 
  // Turn the LED on, then pause
  leds[0] = CRGB::Red;
  FastLED.show();
  delay(500);
  // Now turn the LED off, then pause
  leds[0] = CRGB::Black;
  FastLED.show();
  delay(500);
}

Performance

If you use pins backed with hardware SPI the FastLED library will use hardware rather than bit bashing for the communication.

On the Arduino Uno or Duemilanove that is pin 11 for data and pin 13 for the clock. SPI docs

Clone this wiki locally