Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Filling up led strip - weird behaviour
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Filling up led strip - weird behaviour

by matulik on Thu Feb 27, 2020 2:43 pm

Hello,

I'm writing python script to control WS2813 led strips. At the beginning, I want to implement fade in animation with particular color.

I use rpi_ws281x and adafruit-circuitpython-neopixel python3 libraries.

My init script looks like this:
Code: Select all | TOGGLE FULL SIZE
import board
import neopixel
import time

PIXEL_COUNT = 50
pixels = neopixel.NeoPixel(board.D10, PIXEL_COUNT, bpp=3, auto_write=True, brightness=1.0, pixel_order=None)

Fade in it's simple loop to fill from 0 value of the red to 255:
Code: Select all | TOGGLE FULL SIZE
for i in range(0, 255, 1):
    pixels.fill((i, 0, 0))
    time.sleep(0.01)

For this code my leds behaviour is strange. It's flickering on blue with desired color alternately. Look on video: https://streamable.com/32qye (it's in slow-motion to show what's going on).

But I tried to change step value of for loop to 2, like this:
Code: Select all | TOGGLE FULL SIZE
for i in range(0, 255, 2):
    pixels.fill((i, 0, 0))
    time.sleep(0.01)

and behaviour is as I expected: https://streamable.com/pkwgy

What is a reason of strange behaviour of blue color blinking when I set step value to 1? I tried also to change sleep value, even to 1second and it doesn't work.

matulik
 
Posts: 3
Joined: Thu Feb 27, 2020 2:16 pm

Re: Filling up led strip - weird behaviour

by matulik on Thu Feb 27, 2020 6:12 pm

I made a few test and it looks like that led strip reacts correct only on even values. I wrote a simple method which rounding value to next even value down (for example from 191 to 190) and it works fine.

But, of course, I'm still don't know what is the problem and in this case I can lose 50% of color of my led strip.

Could everyone explain what's going on? Is it possible that it's a wiring issue?

matulik
 
Posts: 3
Joined: Thu Feb 27, 2020 2:16 pm

Re: Filling up led strip - weird behaviour

by danhalbert on Thu Feb 27, 2020 6:31 pm

Have you tried the same code with ws2812 strips, from us or others? I don't know that we have much experience with the WS8213 strips, which are supposed to be upward compatible, but it sounds like there might be timing differences.

danhalbert
 
Posts: 2037
Joined: Tue Aug 08, 2017 12:37 pm

Re: Filling up led strip - weird behaviour

by matulik on Thu Feb 27, 2020 6:37 pm

Unfortunately I have only WS2813 led strips to test.
What timing differences do you mean?

matulik
 
Posts: 3
Joined: Thu Feb 27, 2020 2:16 pm

Re: Filling up led strip - weird behaviour

by danhalbert on Thu Feb 27, 2020 7:07 pm

I am just looking at the differences cited here: https://www.seeedstudio.com/blog/2019/0 ... different/

It's possible that the RPi driver which we depend on is marginal in some way for these strips, or is wrong in a way that doesn't affect WS2812s, but does affect the '2813s. Our experience has been that the quality and behavior of WS28xx RGB LEDs can vary a lot: it depends on the manufacturer, and sometimes even on the batch. But we haven't seen this kind of of even/odd thing.

If you have an Arduino or Adafruit board you can try this on, with Arduino or native CircuitPython, you might get some further insights.

danhalbert
 
Posts: 2037
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.