I'm working on a project where a main Raspberry Pi server sends out data packets over a wifi network which tells different ESP8266s with neopixel strips what to do (turn on, turn off, play a specific animation, etc.)
The Pi contains a file with an animation script, so by changing that one file I can change what all of the lights do. The network data transfer is time-sensitive, as I want each ESP to work in sync at the same time.
Right now, to transfer the data, the Pi sends out UDP broadcast packets which contain all of the data for each ESP, and the ESPs parse the data to know what each individual one should do.
This works pretty well, and the effect of having all of the lights sync up is really cool, but there are some issues with reliability and timing. Sometimes, a light will miss a packet and not be in time, causing it to not do anything until the next packet arrives. Also, sometimes a single light will start to lag behind on the animation, which I think I can fix by programming the ESPs to run the new command right as it arrives and not wait to finish the one it is currently running.,
I was curious if anyone had any insight on possible conceptual networking fixes. I know TCP packets would be more reliable, but I know it is also slower. Could TCP packets be implemented for something so time-sensitive? Are there other options with the UDP packets that could increase the reliability?