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

Post Reply