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

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

 

Layout

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

Download

code on github