ESP32 + 110 ws2812b = random lighting

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ratuspro
Posts: 2
Joined: Fri Jun 21, 2019 11:46 pm

ESP32 + 110 ws2812b = random lighting

Post by ratuspro » Sat Jun 22, 2019 12:06 am

Hello all,

I'm working on a new project: a word clock.
Recently, I've switched from using an "overpowered" raspberry pi to an esp32 devkit v1. (I only needed the wifi connection from the raspberry)

Currently, I have everything running but I'm having a strange error.
You may find a video showing the error here: https://drive.google.com/open?id=1AjfNr ... dP3pOTfcGk

Notice that while the green leds are showing up, some leds randomly blink.
Does it have anything to do with the esp32 pin? I'm using GPIO18
Note that the random leds are actually random. Every time I restart the board, the leds blinking are different.

I am a bit stuck here. I've even bought a level converter from 3.3 to 5volts to see if it fixed the problem, but it didn't.
I know I haven't provided a lot of info, but if someone is willing to help I'll happily detail the set up.

Thanks in advance,
Diogo Rato

ThomasChr
Posts: 121
Joined: Sat Nov 25, 2017 7:50 am

Re: ESP32 + 110 ws2812b = random lighting

Post by ThomasChr » Sat Jun 22, 2019 6:37 am

Maybe it‘s time to put the Logic Analyser into good use. You can get one for up to 10 MHz in China (salea logic clone) for a few bucks.
It can tell you exactly what voltages/commands the LEDs see.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 + 110 ws2812b = random lighting

Post by Roberthh » Sat Jun 22, 2019 1:52 pm

Looking at the video, it does not seem to be a signal timing problem, because the green snake propagates nicely. Timing problem cause disturbances all over the LED chain. I would more assume an analog issue, like crosstalk between wires or power supply problems along the chain. You have to add quite a few buffering capacitors along the chain. The data sheet shows 100nF per device, which seems to much. But placing a few 10 µF capacitors along the chain could help.

b.t.w.: These cheap logic analyzer are available from local sources (e.g. amazon) too for about 10 USD/€. For 3.3v and 5V signals they work well. For 1.8V logic they do not. But for analog problem like Vcc glitches you need an oscilloscope.

ratuspro
Posts: 2
Joined: Fri Jun 21, 2019 11:46 pm

Re: ESP32 + 110 ws2812b = random lighting

Post by ratuspro » Mon Jun 24, 2019 12:28 pm

Thanks for the fast reply!
Just to give some context about myself, I came from a computer science background.
I can understand some of these concepts purely based on intuition but I have no formal education on these subjects.
Still, I'm open to learning more about this world. So I would like just to weight my options
ThomasChr wrote:
Sat Jun 22, 2019 6:37 am
Maybe it‘s time to put the Logic Analyser into good use.
Do I really need a Logic Analyser? I never used one, so I don't know a lot about them, but I'd guess they provide me a visualization of the signal being transmitted? So, using a Logic Analyzer, I would expect to see what info is reaching the leds. Depending on the result, what options would I have?
Roberthh wrote:
Sat Jun 22, 2019 1:52 pm
Looking at the video, it does not seem to be a signal timing problem, because the green snake propagates nicely. Timing problem cause disturbances all over the LED chain.
I also assumed this was not a problem, was just seeing all the options.
Roberthh wrote:
Sat Jun 22, 2019 1:52 pm
I would more assume an analog issue, like crosstalk between wires or power supply problems along the chain. You have to add quite a few buffering capacitors along the chain. The data sheet shows 100nF per device, which seems to much. But placing a few 10 µF capacitors along the chain could help.
I don't connect all the ground together, so I'll do it next.
I also just realized that the power supply I bought from China, is giving me 5.3v rather than 5V, I might need to buy a better supply.
Previously I tried to build this circuit with a raspberry pi, and I was able to make it work perfectly, without any random blinks. So I don't know if I really need to add the capacitors. But correct me if I'm wrong (this is all based on intuition).
I'm also gonna try to run c++ code in the board rather than micropython. Perhaps neopixel's library for python might have a bug.

Thanks a lot in advance!

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP32 + 110 ws2812b = random lighting

Post by jimmo » Tue Jun 25, 2019 1:01 am

ratuspro wrote:
Mon Jun 24, 2019 12:28 pm
Do I really need a Logic Analyser? I never used one, so I don't know a lot about them, but I'd guess they provide me a visualization of the signal being transmitted? So, using a Logic Analyzer, I would expect to see what info is reaching the leds. Depending on the result, what options would I have?
Yeah they're useful :) It makes such a big difference to be able to see what the signals look like, otherwise you're just guessing.

I suspect you'd probably actually need a scope rather than a logic analyser so that you can check the signal quality (i.e. what the edges look like etc). However ws2812 are very timing sensitive, and just double checking the digital waveform would be useful.

It's fairly unlikely to be a bug in the neopixel driver (but you'd need a logic analyser to verify that). However, I have noticed that ws2812 get a lot more sensitive to timing when the voltages are further off spec. So this could explain differences between boards.

You mentioned 5V earlier. How are you doing the 3.3V to 5V conversion? Can you link to the level shifter you're using?

Post Reply