Part

Two-color LED, KY-011

Red and yellow-green dice under one lens on a shared leg. PWM the two legs for orange and yellow.

See every part
  • 3 pins
  • 1 setting
  • In 2 projects
Drawn live by the editor's own code, at the size you see it.
Two-color LED, KY-011 as drawn in the Mokxi simulator
At a glance

The Two-color LED, KY-011 in brief

What it is, and every setting the properties panel gives it.

The KY-011 is a two-color LED, a red and a yellow-green die under one 5 mm lens with a shared middle leg, the KY-029 at 3 mm. Its legs are R, C and G. On the usual common-cathode part C goes to ground and each colored leg gets its own 220 ohm resistor from a PWM pin, 9 and 10 on an Uno, or any two GPIOs on an ESP32, where 3.3 volts still lights both dice with less current. Lighting both mixes orange and yellow, so analogWrite() walks the color between red and green. Mokxi models each die as its own LED, 2.0 volts for the 644 nanometer red and 2.2 for the 571 nanometer green, about 13.4 and 12.5 milliamps through 220 ohms from 5 volts, with an 8 millisecond eye average that turns PWM into a mixed color. The common property switches to common anode, where a low leg lights. The classic mistake is one resistor in the common leg, so the two dice share its current and turning one off brightens the other; the modules have no resistors on board either. The two-lead bipolar kind, reverse breakdown and heat are not modeled.

Family
Outputs
Pins
3
common
cathode (or anode)
cathode (the usual part, and the KY-011's), where C goes to ground and a high leg lights its die, or anode, where C goes to the supply and a low leg lights.
Pins

3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
R
Anode of the red die.
C
The common, the middle leg: both dice's cathodes (or anodes, see below).
G
Anode of the yellow-green die.
How to use it

How to use the KY-011 two-color LED with an Arduino

The middle leg, C, goes to ground; R goes to PWM pin 9 and G to PWM pin 10, each through its own 220 ohm resistor. The KY-011 module has none on board. Light both dice and the lens glows orange or yellow, so analogWrite() on the two pins walks the color from red to green.

The level light here reads a knob on A0: below halfway the red die stays full and the green one comes up, above halfway the green stays full and the red goes down. Put one resistor in the common leg instead of two and the dice share its current, so turning one off brightens the other.

Part pin
Board pin
R
Pin 9, through 220 ohm
G
Pin 10, through 220 ohm
C
GND

On an ESP32 any two GPIOs do, with analogWrite() or ledcWrite(); 3.3 V still lights both dice, with less current through the same 220 ohm.

Arduino Uno: level lightlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
The color walk, from the level light
int level = analogRead(A0);  // 0 to 1023
int red = level < 512 ? 255 : (1023 - level) / 2;
int green = level < 512 ? level / 2 : 255;
analogWrite(RED_PIN, red);
analogWrite(GREEN_PIN, green);
How it is modeled

What is true about the Two-color LED, KY-011, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

Two dice, two currents. Each die is the same Shockley-equation LED as the LED, conducting on its own between its leg and the common, so one die on does not change the other's current.

The drops of this part. The KY-011 sheet gives 644 nm red and 571 nm green, both at 2.0 to 2.5 V and 20 mA. 571 nm is the yellow-green GaP die, not the 3 V InGaN green of a modern single-color LED, so the model uses 2.0 V for red and 2.2 V for green. On 220 ohm from 5 V they run at about 13.4 and 12.5 mA, nearly even, which is why one resistor value suits both legs here when it does not on an RGB LED.

Perceived color. The brightness is an 8 ms average, the plain LED's, so PWM reads as the mixed color rather than a flicker between red and green.

Not modeled

The two-lead bipolar kind, whose two dice sit back to back across two legs and change color with the direction of the current. Reverse breakdown, heat, and the small differences in brightness between a red and a green die at the same current: here 20 mA is full brightness for either.

From Two-color LED (KY-011), in full.

Projects

See the Two-color LED, KY-011 in a project

2 built-in projects use it. Each opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Two-color LED, KY-011 in it.

Wire up the Two-color LED, KY-011

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.