Skip to content

RGB LED Tutorial

With the RGB LED, you'll be able to add all kinds of color to your project. By sending an RGB value to the LED, you can produce just about any color you'd want. On top of that, multiple LEDs can be connected to form a strip and create all kinds of cool lighting effects.

Although this device is primarily associated with the TinyLily, it is compatible with both the TinyDuino and TinyDuino.

To learn more about the TinyDuino Platform, click here


This sewable board features a 5mm RGB LED, enabling you to add 24-bit resolution color to your Tiny Project! This LED has a built in driver IC, so it requires special libraries and serial data, not just applied voltage. The solder tabs allow you to string together multiple LEDs with conductive thread or wire, and you can individually control every LED with just one digital pin!

Technical Details LED Specs
  • Washable
  • Four Sewtabs – 1.2mm in diameter, easy to use with standard conductive thread and needles
  • Robust Gold Finish – makes soldering easy and is non-corrosive
Power Requirements
  • Voltage: 3.0V - 5.5V 
  • Current: (depends on color and brightness)
    • Red: 30mA
    • Green: 20mA
    • Blue: 30mA
    • White: 65mA
    • 5.0mA per LED (5.0V)
  • Diameter: 10mm (0.394 inches)
  • Max Height: 2.5mm (0.1 inches)
  • Ultra-thin 0.61mm (0.024 inches) PCB
  • Weight: .192 grams (0.007 ounces)


TinyLily mini processor, USB adapeter, and RGB LED



Hardware Assembly

There are many ways the RGB LED can be connected to your project. Typically wires, breadboards, or conductive thread are used. For simplicity sake, we used a tiny breadboard for this specific example. Regardless of the method you choose, use the following steps to build your circuit.

First, connect ground from your processor board to the RGB LED marked with (-). Then connect the voltage lines marked by (+). Finally, connect your desired IO pin to the IN tab on the LED.

WARNING: If using conductive thread, be sure not to short voltage and ground when the device has power. Your thread will burn up and you could damage your board.

Software setup

For this tutorial you will need to download the FastLED Arduino Library, which provides compatability with many different types of RGB LEDs as well as a great deal of predefined color palettes and example code.

Note that these are WS2812B RGB LEDs and this will have to be specified in any code you use with this library. Reference the code below to see how this is done.

Upload Program

#include <FastLED.h>
#define NUM_LEDS 1 //this is the number of LEDs in your strip
#define DATA_PIN 1 //this is the number on the silkscreen you want to use


int brightness = 20; //value from 0-255 to manipulate brightness

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);
  pinMode(DATA_PIN, OUTPUT);

void loop() {
  for(int i = 0; i < 256; i++) {
    //fill_rainbow(targetArray, numToFill, initialHue, deltaHue);
    fill_rainbow(leds, NUM_LEDS, i, 256/NUM_LEDS);; //update the LEDs
    //delay(100); //optional delay for slower fading

The program should blend your LED(s) through the colors of the rainbow. If you're interested in creating other lighting effects, check out the example sketches included with the library. It is likely you'll have to change the defined number of LEDs, type of LED, and data pin.


Contact Us

If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

Thanks for making with us!