KY-011 Two color LED module Raspberry Pi example

In this example we take a look at the KY-011 Two color LED module and connect this to a Raspberry Pi.

As you may have guessed this is a common cathode LED with a red anode and a green anode. You can adjust the amount of each color using PWM.

The module does not include resistors so you need to add these

  • Color: Green + Red
  • Diameter: 3mm
  • Case Color: None
  • Package Type: Diffusion
  • Voltage (V) :2.0-2 .5
  • Using a current (MA): 10
  • Viewing angle: 150
  • Wavelength (NM): 571 +644
  • Luminous intensity (MCD) :20-40; 40-80
  • Stent type: long-legged

Parts List

Name link
Raspberry Pi3 Raspberry Pi 3 Model B With WiFi & Bluetooth
37 sensor kit 37 IN 1 SENSOR KITS FOR ARDUINO HIGH-QUALITY FREE SHIPPING (Works with Official for Arduino Boards)
connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire



We use pins 38 and 40 (GPIO 20 and 21) in this example, you can use other GPIO pins but you will have to change the code example.

You need the current limiting resistors

pi and ky-011 layout
pi and ky-011 layout
pi and ky-011 schematic
pi and ky-011 schematic



Code Examples


code on github

Previous articleKY-003 Hall Magnetic Sensor Module and Raspberry Pi
Next articleKY-010 Photo Interrupter Module and Raspberry Pi