Skip to content

RGB LED Wireling Python 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

    Hardware

    Required Software


    Hardware Assembly

     Wireling cable connecting to RGB LED Wireling

    Please note the orientation of the cable connection to the RGB Wireling to ensure correct functionality

    Plug your Wireling into the port you plan on using! The example program discussed in this tutorial uses port 1.

    If you want to use a different port, you just need to change the port value in the program mentioned later.


    Software setup

    Install the necessary package directly from the command line by typing:

    sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel
    

    If you have Python 3 installed as your default, you can just type pip instead of pip3.


    Programming

    Lets look at the beginning of one of the TinyCircuits examples:

    rgb_blink.py
    # This example shows how to create a single RGB with a specific color channel
    # order and blink it.
    # Library by: Adafruit
    # Hardware by: TinyCircuits
    
    import time
    import board
    import neopixel
    import tinycircuits_wireling
    
    wireling = tinycircuits_wireling.Wireling()
    
    
    # Configure the setup
    RGB_PIN = wireling.getBoardPin(1)
    ORDER = neopixel.GRB   # pixel color channel order
    COLOR = (150, 0, 150)  # color to blink: purple
    CLEAR = (0, 0, 0)      # clear (or second color)
    DELAY = 1              # blink rate in seconds
    
    # Create the RGB Wireling object using neopixel library
    pixel = neopixel.NeoPixel(RGB_PIN, 1, pixel_order=ORDER)
    
    # Loop forever and blink the color
    while True:
        pixel[0] = COLOR
        time.sleep(DELAY)
        pixel[0] = CLEAR
        time.sleep(DELAY)
    

    Some things to note on this example with the RGB Wireling:

    • The color order needs initialized to GRB as shown in order to be compatible with our LEDs, and produce the correct color when an RGB code is input.
    • Pin 0 has some inconsistent behavior with the RGB Wireling, so for the best results use pins 1, 2, and 3 for any RGB LED Wireling needs
    • Brightness can be changed on a scale of 0-100% using the optional brightness input when initializing the pixel (this can be seen in the rgb_rainbow.py example included under the Software section)

    Run Program

    Navigate in the terminal to the directory with the package file parent to the examples folder. Place the downloaded example in the examples folder.

    Run the program from the root so that you have the correct access to peripherals:

    sudo python3 examples/rgb_blink.py
    

    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!