ESP32-Digital-RGB-LED-Drivers icon indicating copy to clipboard operation
ESP32-Digital-RGB-LED-Drivers copied to clipboard

decoding ws281x

Open ririfonfon opened this issue 6 years ago • 10 comments

ririfonfon avatar May 31 '18 13:05 ririfonfon

bonjour, je cherche a decoder le protocole ws281x avec un esp32

je m'explique: j'ai pour projet de piloter beaucoup de ws l'animation est simple une diode par diode en blanc sur 1 km . pour des raison de frame rate et d'alimentation il y aura un esp32 tous les 200 pixels . l'idee est de generée 201 pixels et d'entrée le data out dans le prochain esp32 et donc de déclancher les pixels suivant etc..

google traduction Hello, I am looking to decode the protocol ws281x with esp32

Let me explain: I plan to drive a lot of ws the animation is simple diode diode in white over 1 km. for reasons of frame rate and power there will be a esp32 every 200 pixels. the idea is to generate 201 pixels and input the data out in the next esp32 and thus trigger the next pixels etc.

ririfonfon avatar May 31 '18 13:05 ririfonfon

If you're going to simply chain them all together, there should be no need for any intermediate devices to keep the signal going - as long as the strings are adequately powered at regular intervals the data signal will get regenerated at each LED, so it should go indefinitely. However, this design (which you describe) will suffer from lower frame as the number of pixels increases (which you seem to want to avoid).

One way to avoid that is to have all the ESP32s talking to each other and starting each refresh of their respective segments simultaneously. A mesh network would be ideal, but I haven't tried it and I'm not sure how far along Espressif is with it:

http://esp-idf.readthedocs.io/en/latest/api-guides/mesh.html

I hope that gives you some direction!

MartyMacGyver avatar Jun 01 '18 06:06 MartyMacGyver

indeed a mesh network, will not work:

  • carry wifi
  • random sync
  • the installation will be in the city center.2.4 ghz disrupt
  • etc. for me the ideal would really be to have a lib of ws281x in input

ririfonfon avatar Jun 01 '18 08:06 ririfonfon

I have a relatively clever idea how this could work at scale and at high speed IF the full set of sequences is known in advance (or is programmatically generated in a repeatable way). Can you tell me more about what the sequence you're displaying is like?

Driving a given strand isn't difficult, decoding that kind of data as an input might be more challenging, but there are some short-cuts one can take if the input is known or fully generable at each ESP32 that maintain sync without sacrificing the frame rate.

MartyMacGyver avatar Jun 02 '18 02:06 MartyMacGyver

I count on one esp every 20 m. this sp will control around 200 ws 2812 and 3 pwm (rvb). the first sp will be the master. the animation is simple we send white led by led. (ws 1 white then ws 1 black with ws 2 white then ws 1 black ws 2 black ws 3 white ...) when we arrive at ws 201 l esp next pwm rvb full and ws 1 white ...

so the decoding of the ws in will only be on id 201.

ririfonfon avatar Jun 02 '18 09:06 ririfonfon

Is the complete pattern known in advance? And what is the expected refresh rate for the whole system?

I feel a drawing might help make more sense of this.

If the data is only coming from the first ESP32 (and periodically decoded by subsequent ESP32s along the way) the refresh rate will be terrible. If the pattern is known then one can have each ESP32 doing its part, using the output of the previous strand ONLY for clock sync (there could be a way to use this to also initialize the pattern, but after that the pattern is remembered by each device, greatly increasing the refresh rate).

MartyMacGyver avatar Jun 02 '18 15:06 MartyMacGyver

yes output is used ws only to synchronize the following esp. each species plays are senario.

ririfonfon avatar Jun 02 '18 16:06 ririfonfon

i buy this https://www.aliexpress.com/item/10pcs-Luminosity-Sensor-GY-2561-TSL2561-Light-Module/32365876484.html?spm=a2g0s.9042311.0.0.3d054c4dOKifAW. and put one more ws at the end. detect it with this sensor.

ririfonfon avatar Jun 02 '18 17:06 ririfonfon

Then why use a sensor? Just use the output of the last LED in a strand as a trigger (NOT as a data input, just a trigger to maintain timing of the pre-defined sequence loaded into each ESP32).

MartyMacGyver avatar Jun 02 '18 17:06 MartyMacGyver

I try. But it does not work. with a circular test ws of 12 pixels. I generate my frame of 13 pixels and the trig triggers at 3 pixels.

ririfonfon avatar Jun 02 '18 17:06 ririfonfon