Project

The MIT-i Color Blender! RGB LED Color Blending

November 08, 2017 by Ryan Jones

Blending colors may sound elementary but it is vital in drawing attention to your project with RGB LEDs!

Blending colors may sound elementary but it is vital in drawing attention to your project with RGB LEDs!

BOM:

Why?

If you've found this project, you've most likely used an LED before. LEDs are a great feature to many projects, especially for indication lights. They can be used to signify whether or not a project is powered, to notify you of which "mode" you are in, or simply just for their cool looks. But what if you have the need for multiple LEDs but no room in your project? An RGB LED is a great choice!

RGB simply stands for "red, green, blue." So an RGB LED is an LED consisting, really, of three separate LEDs in a single package: red, green, and blue. These colors can be mixed together in various ways to create many shades of color. Maybe red is "startup," yellow is "ready," and green is the "operating" identifier for your project. Of course, you can just use them for flashy effects and attention, too!

 

The RGB Triangle.

How?

In the everyday world, red, green, and blue are primary colors used in an additive color model, meaning they can be added together in various ways to create up to 16 million shades of color. Of course, not all colors can be created—some exist outside of the "RGB Triangle." When these three color LEDs are put together in the same package, the same laws apply.

These three colors can be controlled individually, which is why you'll notice on an RGB LED there are 4 leads—a common cathode and three individual anodes, or a common anode and three individual cathodes. Applying various voltages to each lead will create many different shades. This means you will need three output pins on your microcontroller to control a single RGB LED.

 

A typical RGB pinout, courtesy of Amazon.

With the help of Cypress' PSoC 6 BLE kit, we can conveniently control the color of it's an on-board RGB LED without having to tediously change many lines of code. When you open the RGB section of the app, you'll notice its own RGB color blob. Simply move your finger across it and you'll see the colors change in real time! It's just like being back in kindergarten!

Red and green make yellow. Red and blue make pink, and so on and so forth. But who needs just one?! These little guys are sold by the meter on an adhesive strip which already includes necessary resistors and capacitors. All you need is a few beefy transistors and a 12 V power supply and you're good to go! Don't be afraid to get crazy, if you've "blinked" or "faded" LEDs before you can do the same with an entire strip. 

Remember to always look for libraries and example code when you get stuck! Thanks for checking this out!

 

PSoC 6 RGB.

Give this project a try for yourself! Get the BOM.

 

Other MIT-i Innovations: