SMD RGB LED module

smd rgb led module

SMD RGB LED module consists of a full-color LED with a three-pin P.W.M voltage input that can be ajusted in order to achieve full color lighting effects.

Note : (red/blue/green) LED connected with a common cathode. A resistor is necessary for different voltages.

Vf [Red]= 1,8V
Vf [Green,Blue]= 2,8V
If= 20mA

Pre-resistor:

Raspberry-Pi

Rf (3,3V) [Green]= 100Ω
Rf (3,3V) [Red]= 180Ω
Rf (3,3V) [Blue]= 100Ω

Arduino

Rf (5V) [Green] = 100Ω
Rf (5V) [Red] = 180Ω
Rf (5V) [Blue] = 100Ω

Since you can’t connect the led’s directly you will need a few resistors!!
Arduino pin 9 –> 110 Ohm resistor –> Pin ‘G’ of KY-009 module
Arduino pin 10 –> 110 Ohm resistor –> Pin ‘B’ of KY-009 module
Arduino pin 11 –> 180 Ohm resistor –> Pin ‘R’ of KY-009 module

Note: Always use PWM Pins for RGB Led Module

This module provides a few LEDs – with the overlay of the different brightness levels, you can create different colors. This will be shown in the following code example. For the Raspberry Pi, only one Hardware-PWM channel is carried out unrestricted to the GPIO pins, that’s why we have used Software-PWM on this example.

// RGB LED KY-009 Module

int Led_Green = 9;
int Led_Blue = 10;
int Led_Red = 11;

int val;

void setup () {
//Output pin initialization for the LEDs
pinMode (Led_Red, OUTPUT);
pinMode (Led_Green, OUTPUT);
pinMode (Led_Blue, OUTPUT);
}
void loop () {
// In this for-loop, the 3 LEDs will get different PWM-values
// Via mixing the brightness of the different LEDs, you will get different colors.
for (val = 255; val> 0; val–)
{
analogWrite (Led_Blue, val);
analogWrite (Led_Green, 255-val);
analogWrite (Led_Red, 128-val);
delay (1);
}
// You will go backwards through the color range in this second for loop.
for (val = 0; val <255; val++)
{
analogWrite (Led_Blue, val);
analogWrite (Led_Green, 255-val);
analogWrite (Led_Red, 128-val);
delay (1);
}
}

Sunce the human eye interprets the ON/OFF as a brightness change. You  regulate the brightness of the LEDs via pulse-width modulation. By switched ON and OFF for specific time periods,  leads to a relative brightness, because of the Inertia of the human eyesight.

Show Buttons
Hide Buttons