Library Install and Strip Example

Adam Haile edited this page Jul 1, 2017 · 30 revisions

First: Follow the BiblioPixel installation instructions.

pyserial

pyserial is required. Install with pip install pyserial --upgrade. If you are running on a Raspberry Pi, pyserial is already installed but it's too old and owned by the OS. To upgrade, use sudo pip install pyserial --upgrade --ignore-installed

IMPORTANT: BiblioPixel v3 now requires Python 3.4+! If you must use Python 2, please follow the BiblioPixel v2 install instructions

IMPORTANT: You must either install the 300 Ohm resistors or short the jumper pads at R6 and R7 for the AllPixel to communicate with the LEDs!

The AllPixel has been designed in conjunction with the BiblioPixel Python library, allowing it to be controlled from anything that supports Python and USB Serial. Testing the AllPixel for the first time is easy. The supported LED types are listed below. Be sure to change your LED type on line 8 of the below code example ('ledtype = LEDTYPE.xxxxxx').

  • LPD8806
  • WS2801
  • WS2811
  • WS2812
  • WS2812B
  • NEOPIXEL
  • APA104
  • WS2811_400
  • TM1809
  • TM1804
  • TM1803
  • UCS1903
  • SM16716
  • APA102
  • LPD1886
  • P9813
import bibliopixel
# causes frame timing information to be output
bibliopixel.log.setLogLevel(bibliopixel.log.DEBUG)

# Load driver for the AllPixel
from bibliopixel.drivers.serial import *
# set number of pixels & LED type here
driver = Serial(num = 10, ledtype = LEDTYPE.WS2812B)

# load the LEDStrip class
from bibliopixel.layout import *
led = Strip(driver)

# load channel test animation
from bibliopixel.animation import StripChannelTest
anim = StripChannelTest(led)

try:
    # run the animation
    anim.run()
except KeyboardInterrupt:
    # Ctrl+C will exit the animation and turn the LEDs offs
    led.all_off()
    led.update()

Since you are changing the type and number of LEDs that the AllPixel is controlling, it will quickly reboot as it re-configures itself. You will see something like this:

INFO - serial_driver - Using COM Port: COM5, Device ID: 0
INFO - serial_driver - Reconfigure and reboot needed, waiting for controller
INFO - serial_driver - Reconfigure success!

It should display something like this:

No matter how many LEDs you configured above, you will only see the first 10 light up in this case because that is all this test animation controls.

If the RGB ordering is correct, the pattern should start with 1 Red, 2 Green, and 3 Blue LEDs. If you see different colors, the count of each color tells you the position for that color in the channel order. So, for example, if you see 2 Blue, and 1 Red, and 3 Green LEDs then the channel order should be RBG (Red, Blue, Green) and the driver should be configured as such:

driver = Serial(num = 10, ledtype = LEDTYPE.WS2812B, c_order = ChannelOrder.RBG)

For more details on controlling strips of LEDs, check out the LEDStrip documentation on the BiblioPixel Wiki.

Connecting the LEDs | Matrix Example

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.