RGB Wireling with Pi
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!
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
- Voltage: 3.0V - 5.5V
- Current: (depends on color and brightness)
- Red: 30mA
- Green: 20mA
- Blue: 30mA
- White: 65mA
- A5/SCL - I²C Serial Clock line
- A4/SDA - I²C Serial Data line
- 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)
- Python 3 (Python 2 is not supported!)
- All Python packages mentioned in the Pi Hat setup tutorial (tinycircuits-wireling, Adafruit-Blinka, adafruit-circuitpython-ads1x15, and adafruit-circuitpython-busdevice)
- RGB LED Blink Example
- RGB LED Rainbow Example
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.
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.
Lets look at the beginning of one of the TinyCircuits examples:
# 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 = COLOR time.sleep(DELAY) pixel = 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)
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