Skip to content

RGB LED Wireling Tutorial

TinyCircuits RGB LED Wireling product photo

This Wireling features a 3.5mm Serial 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. This Wireling also features a second connector, allowing you to string multiple LEDs together while using just one pin!

Technical Details

SK6812 Mini Specs

  • Built-in power on reset and reset circuit
  • Refresh rate 30 frames per second with data transmission frequency of 800 Kbps
  • 24-bit resolution color

    Power Requirements

    • Voltage: 3.0V - 5.5V 
    • Current: (depends on color and brightness)
      • Red: 30mA
      • Green: 20mA
      • Blue: 30mA
      • White: 65mA

    Pins Used

    • A5/SCL - I²C Serial Clock line
    • A4/SDA - I²C Serial Data line 

    Dimensions

    • 10mm x 11mm (.393 inches x .433 inches)
    • Max Height (from lower bottom of Wireling to upper top Wireling Connector): 4.70mm (0.19 inches)
    • Weight: 1 gram (.04 ounces)

    Materials

    To interface with any TinyCircuits Arduino board, you will need the Arduino IDE and a Micro USB Cable

    There are multiple processor/adapter combinations that can be used with Wirelings. Use the following table to find the combination that works for you.

    Processor Adapter
    * and
    *
    *
    N/A
    * N/A
    Arduino
    Raspberry Pi

    * These processors have a 32-pin connector and can have multiple Wireling Adapter TinyShields stacked to increase the number of Wireling ports up to a maximum of 32 total Wireling ports.

    In order to interface with Wirelings, you'll need the appropriate number of Wireling Cables and the Wireling.h Library (You can download this from GitHub as linked, or from the Library Manager in the Arduino IDE).

    You will also need the RGB LED Wireling and the included example Arduino sketch.

    Wireling Code
    Port 0

    Hardware Assembly

    Depending on the development system you choose, you will need to put together a TinyDuino stack using the 32-pin tan connectors, or you will just need to plug in your Wireling to Port 0 using a Wireling Cable. (You can change this port in the included Arduino Sketch by editing the Analog pin used as noted in the program.)

    NOTE: Be mindful when inserting Wireling Cables - the connector pins inside the 5-pin connectors on Wirelings can be bent when cables are inserted at an angle.

    WirelingZero with Wireling cable connecting from port 0 to RGB LED Wireling
    Please note the orientation of the cable connection to the RGB Wireling to ensure correct functionality


    Software setup

    For this Wireling, you will need to download the FastLED library:

    To install an Arduino library, check out our Library Installation Page.

    Then you just need the RGB LED Arduino sketch that can be found above under the Materials section. Download the example and open it in the Arduino IDE.

    Make the correct Tools selections for your development board. If unsure, you can double check the Help page that mentions the Tools selections needed for any TinyCircuits processor.


    Upload Program

    RGB LED Wireling Program
    /*********************************************************************
     * RGB LED Wireling Example:
     * This example shows how to program an RGB LED Wireling. The default 
     * program when uploaded will cycle NUM_LEDS attached through the 
     * RGB colors at half brightness.
     * 
     * Hardware by: TinyCircuits
     * Written by: Laveréna Wienclaw for TinyCircuits
     * 
     * Initialized: 7/1/2018
     * Last Updated: 12/4/2019
     *********************************************************************/
    
    #include <FastLED.h>
    #include <Wireling.h>
    
    #define LED_PIN A0 // Corresponds to Wireling Port 0 (A1 = Port 1, A2 = Port 2, A3 = Port 3)
    
    #define NUM_LEDS 1 // This is the number of RGB LEDs connected to the pin
    #define COLOR_ORDER GRB
    CRGB leds[NUM_LEDS];
    int brightness = 128; // Brightness is on a scale of 0-255, 128 is 50% brightness
    
    void setup() {
      // Enable & Power Wireling
      Wireling.begin();
    
      // Initialize RGB LEDs attached to LED_PIN
      FastLED.addLeds<WS2812, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
      FastLED.setBrightness(brightness);
      pinMode(LED_PIN, OUTPUT);
    }
    void loop() {
      for(int x = 0; x < NUM_LEDS; x++) // cycle through all LEDs attached to LED_PIN
      {
        leds[x] = CRGB( 255, 0, 0); // RED
        FastLED.show();
        delay(500);
        leds[x] = CRGB(0, 255, 0); // GREEN
        FastLED.show();
        delay(500);
        leds[x] = CRGB(0, 0, 255); // BLUE
        FastLED.show();
        delay(500);
      }
    }
    

    There is a lot you can do with LEDs, especially RGB ones! Some of the most common ways to personalize the lighting effects are by changing the brightness, the colors, or adding more LEDs.


    Brightness

    The default brightness for the attached program is set to 128 out of a scale of 255, so the LEDs are set to 50% brightness. If you want your LEDs dimmer or brighter you would edit the line:

    int brightness = 128;
    

    to a different value.


    Color

    You can edit the RGB arguments in the example program from this tutorial in order to make any color you need. If you want more complex effects, the FastLED ColorPalette example has many predefined color effects, including a rainbow sequence. The example should be downloaded with the FastLED library, and you can find it under FastLED/examples/ColorPalette. You will just need to change the LED_PIN to match the Wireling port you are using (A0-A3).


    Adding more LEDs!

    If you want to string along more RGB LEDs, it is made easy with the Wireling platform. You just need another Wireling Cable, and RGB Wireling to string along as many as you want. Then just change the variable #define NUM_LEDS 1 at the top of your program to match the number of LEDs you have attached.


    Downloads


    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!