Neopixel strange behavior fast update

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
francescofact
Posts: 2
Joined: Wed Nov 06, 2019 6:01 pm

Neopixel strange behavior fast update

Post by francescofact » Sat Feb 08, 2020 2:27 pm

Hi, i have my ESP32 connected to a ws2812b and a Snake game written by me in micropython.
I built a 16x16 matrix cutting and connecting the strip.
The strip sometimes turn on some random led at random color and brightness. I have enough power and all the strip parts is well connected.


This is the fps manager of the game. It's 10fps, so nothing to heavy i think. (Edit: i tried to update every 1second, but random pixel persist but they are less frequent)

Code: Select all

def fps(timer):
    global moved, snake_speed
    
    if (moved > snake_speed):
        moved = 0
        updateSnake()
    moved += 1
    drawSnake()
    drawFood()
    neopixelhelper.show()
    
def start():
    global timer
    
    timer = machine.Timer(0)
    timer.init(period=100, mode=machine.Timer.PERIODIC, callback=fps)
    
    random.seed(utime.time())
    drawFood()
    drawSnake()

neopixelhelper is just a python script that makes easier for me to do the neopixels calls.


Here is a photo of my circuit:
Image
Edit: I tried to put a 500ohm resistor between pin4 and data input without luck.
and here's the video of the behaviour:
https://youtu.be/qujBUNlemLs

Thank you for any suggestion

perbu
Posts: 9
Joined: Thu Mar 26, 2020 7:34 am

Re: Neopixel strange behavior fast update

Post by perbu » Wed Apr 08, 2020 6:13 pm

I see random artifacts on my neopixels as well, from time to time. Not as frequent as you, though. Do you have a cap on the power input of the neopixels? It has previously resolved some of my issues.

I've been told that Micropython on the ESP doesn't use the RMT, so I'm guessing it falls back to bitbanging, which is not very reliable. The ESP32 has a working RMT driver now and there is a prototype neopixel driver using it. However, it seems memory usage way to high atm so it might take some time before it enters master.

Post Reply