Average rainfall 2001-2016, global tropics

Map: Average rainfall 2001-2016, global tropics

project: RGB led alternative

Thomas Gumbricht bio photo By Thomas Gumbricht

Introduction

Several products with separate light-emitting diodes (LED) for red (R) green (G) and blue (B) exists, and they require different wiring and sketching. This post goes through some of the RGB LEDs that are available, both as breakout boards and as simple components. This post is restricted to LEDs where each color is controlled by its own cord.

Common cathode or anode

All RGB LEDs with individual cords have 4 connections, three for controlling the power supply and one common that closes the circuits of all three power supplies. The common one can either be the cathode (the most common and standard solution) or the anode. There is no physical difference that can be used to distinguish whether the common (the longest leg) is the cathode or the anode.

Common cathode

To have a common cathode is standard, you connect the longest leg of the LED component to the Arduino board ground (GND). If you only intend to light one color at the time it is sufficient to have one 220 Ohm resistor on the common cathode.

Wiring of an RGB LED with a common anode. The wiring with the 220 Ohm resistor on the anode is only applicable when a single color (red, green or blue) is lit at the time.

All color combinations

If you want to mix two, or all, colors you need to put a 220 Ohm resistor on each.

Wiring of an RGB LED with a common cathode. The wiring with a 220 Ohm resistor on each power supply allows any combination of lit LEDs.

Common anode

As noted above, also the anode can be the common connection point, in which case the longest (anode) leg is connected to power (5v).

Only red, green and blue

If you only intend to light one color at the time it is sufficient to have one 220 Ohm resistor on the common andode.

Wiring of an RGB LED with a common anode. The wiring with the 220 Ohm resistor on the anode is only applicable when a single color (red, green or blue) is lit at the time.

All color combinations

If you want to mix two, or all, colors you need to put a 220 Ohm resistor on each.

Wiring of an RGB LED with a common anode. The wiring with a 220 Ohm resistor on each power supply allows any combination of lit LEDs.

KY-009 Breakout board

The KY-009, built on the SMD 5050 RGB component gives a more homogenous beam compared to the above LEDs and is probably the better choice for use with a spectrometer.

The KY-009 breakout board comes in two versions: with and without integrated resistors. You just have to inspect the breakout board to see if there are resistors built in. Below are two different sketches and two different wirings. The first sketch is more basic and applies different resistors for each power source (R=180 Ohn, B = G = 100 Ohm). The second wiring assembles all resistors (to 390 Ohm). The function does not seem to change dependent on the wiring.

Note that the fading is achieved using Pulse Width Modulation (PWM) and I am uncertain if this is really useful when it comes to using the LED as a light source for spectrometers. I will have to look into that and write a separate post. Later.

Basic

Sketch and wiring for the KY-009 3-color full-color LED SMD modules. As the red (R) diode requires a lower voltage compared to green (G) and blue (B) you need to use 100 Ohm resistors for G and B and a 180 Ohm resistor for R.

Wiring of th KY-009 breakout board with individual resistors for R (180 Ohm) G (100 Ohm) and B (100 Ohm).

Basic sketch for looping over red, green, blue, cyan, magenta, yellow and white.

Sketch for testing the fading of all three colors uisng PWM. It works for G and B, but not for R.

Comprehensive

Here is a more advanced Testing RGB LEDs and the KY009 Three Colour LED. According to that test the function of the KY-009 breakout board is not great, which is also my experience. First the wiring and then the sketch as described on that page.

Wiring of an RGB LED with a common anode and a common 390 Ohm resistor.