Keyes 8 RGB Led board.

.

It seems that I was wrong when I suggested this board was common Cathode, in fact it is common Anode, with the RGB pins driving the LED’s through transistors. The board can be obtained quite cheaply through eBay.

Connect the board to an Arduino as follows:

Vcc to Arduino 5 volts.
D0 to D6 connect to Arduino pins 2 to 8
D7 to Arduino pin 12
R to Arduino pin 9
G to Arduino pin 10
B to Arduino pin 11

To light a led take one of the D pins LOW, then take any of the RGB pins LOW as well,   with Vcc on the board connected to 5 volts. If you use PWM then almost any colour can be mixed. PWM is used in the following sketch which is why pin 12 is used for D7 as pins 9, 10 and 11 are PWM pins.

The following sketch fades each led from red to green to blue, then moves on to the next led and can be used to test the unit.

/********************************************************

Keyes 8 RGB LED board

This sketch fades each LED in sequence from Red, Green to Blue

LEDs are selected by taking the digit line LOW
then taking the R, G, B pins LOW to turn ON

Connect:
VCC pin to Arduino 5 v
D0 to pin 2
D1 to pin 3
D2 to pin 4
D3 to pin 5
D4 to pin 6
D5 to pin 7
D6 to pin 8
D7 to pin 12
R to pin 9
G to pin 10
B to pin 11
*********************************************************/

int ledRed = 9; // the pin that the Red LED is attached to
int ledGreen = 10; // the pin that the Green LED is attached to
int ledBlue = 11; // the pin that the Blue LED is attached to
int currentLed =0; // used in sub routine
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
// declare pins to be an output:
pinMode(2, OUTPUT); // D0
pinMode(3, OUTPUT); // D1
pinMode(4, OUTPUT); // D2
pinMode(5, OUTPUT); // D3
pinMode(6, OUTPUT); // D4
pinMode(7, OUTPUT); // D5
pinMode(8, OUTPUT); // D6
pinMode(12, OUTPUT);// D7
//
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
}
//
void loop() {
for(int i=2; i= 0;){
// set the brightness of selected led:
analogWrite(currentLed, brightness);
// change the brightness for next time through the loop:
brightness -= fadeAmount;
// wait for 30 milliseconds to see the dimming effect
delay(20);
}
brightness += fadeAmount;
while(brightness <= 255){
// fade DOWN
// set the brightness of selected led:
analogWrite(currentLed, brightness);
// change the brightness for next time through the loop:
brightness += fadeAmount;
// wait for 30 milliseconds to see the dimming effect
delay(20);
}
}
void allOff(){
// turn all LEDs off
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(12, HIGH);

}

Advertisements

4 thoughts on “Keyes 8 RGB Led board.”

  1. Hi, nice sketch! I’m going to make RGB POV with similar board. Unfortunetly you are wrong aboat common catode. They are common anode (RGB outputs must be low for turning LED on) driven by PNP: low voltage on Dx pin (base) connects Vcc (emitter) to anode (collector). Dx pins need to sink around 5mA (10k resistors 5V Vcc) and RGB pins sink (330 resistors) 15mA, thus I think it is safe for Arduino to work with that board. Anyway you can use NPN or N-MOSFET for driving RGB pins.

    Like

    1. Many thanks to Vidmo for pointing out that rather large error, I must have been asleep the day I wrote that blog. I have rewritten the blog removing the offending parts. At least the Sketch worked even if my explanation came nowhere near the truth. Thank you again for pointing out the error.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s