3mm Two color LED module KY-011 for Arduino, emits red and green light. It uses bi-color led. You can adjust the amount of each color using PWM.

The Two-color LED is a handy little component that allows three colors (red, green and combination) in a single LED having three pins (cathode and red, green). The color of the LED depends on the input given to the red or green pin. Similar LED’s that provide two or even three colors usually have three or four pins allowing for a wide range of mixed colors. This LED can easily be applied to a circuit to visually indicate polarity direction or OK, fault conditions.

This module consist of a common cathode 3mm red/green LED and a 0Ω resistor, Since operating voltage is 2.0v ~2.5v you’ll need to use limiting resistors to prevent burnout when connecting to the Arduino.

Arduino Connections with KY-011 2-Color LED module

Figure 1: Arduino Connections with KY-011 Module

Arduino pin 10 –> resistor 330 Ohm –> Signal pin of the module
Arduino pin 11 –> resistor 330 Ohm –> Middel pin of the module
Arduino GND –> module -/GND

Figure 2: KY-011 2-Color LED Module

Arduino Code for KY-011 Module

// Arduino test code for KY011

int redpin = 11; // select the pin for the red LED
int greenpin = 10; // select the pin for the green LED
int val;
void setup () {
pinMode (redpin, OUTPUT);
pinMode (greenpin, OUTPUT);
}
void loop () {
for (val = 255; val > 0; val--)
{
analogWrite (greenpin, val);
analogWrite (redpin, 255-val);
delay (15);
}
for (val = 0; val < 255; val++)
{
analogWrite (greenpin, val);
analogWrite (redpin, 255-val);
delay (15);
}
}

With the use of analogWrite PWM you can control intensity of both LEDs to make more colors. The following Arduino sketch will gradually alternate between red and green color. In most cases just on and off of the led is enough. for example battery charging circuit Red – No battery connected, Both on (Yellow)- Battery is getting charged, Green – Battery Full. In combination of blink you can have more indications.

Responses