Page 1 of 1

Neopixel strange behavior fast update

Posted: Sat Feb 08, 2020 2:27 pm
by francescofact
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