MartyMacGyver / ESP32-Digital-RGB-LED-Drivers

ESP32 Digital RGB(W) LED Drivers
MIT License
255 stars 51 forks source link

decoding ws281x #25

Open ririfonfon opened 6 years ago

ririfonfon commented 6 years ago

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.

MartyMacGyver commented 6 years ago

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!

ririfonfon commented 6 years ago

indeed a mesh network, will not work:

MartyMacGyver commented 6 years ago

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.

ririfonfon commented 6 years ago

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.

MartyMacGyver commented 6 years ago

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).

ririfonfon commented 6 years ago

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

ririfonfon commented 6 years ago

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.

MartyMacGyver commented 6 years ago

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).

ririfonfon commented 6 years ago

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.