I have a WiFi/LAN latency-related question.
I am currently working on a solenoid drummer device that allows you to write sequences in Ableton Live / Max For Live and have them played back on a drum kit using solenoids. I am using a LAN to send UDP messages from Ableton / Max For Live to an ESP8266 WiFi module / ES-12 development board. The ESP8266 receives single bytes from Max For Live that each signal a specific solenoid to turn on. That data is transferred out via SPI to a shift register tied to the ESP8266- the shift register’s outputs are in turn tied to MOSFETS which gate the current to each solenoid. All of this is, thus far, working as intended with one exception.
The main issue I’m having is lag between Ableton Live / Max For Live and the ESP8266. Because it’s a rhythmic device, it needs to have extremely low latency at all times or it can’t really do anything very rhythmically complex before the solenoids start to choke and splutter instead of playing in rhythm. I spent half a day last week testing this exact issue and the severity of lag, and I had only been getting brief moments of lag once every 5-6 minutes. Today it is now almost unusable because of how much it chokes and splutters, and I haven’t changed anything in the code or otherwise. It’s especially confusing because I’m using a router that isn’t connected to the internet and is strictly dedicated to this project as a LAN, so there shouldn’t be any other traffic on the network. This problem is also interspersed with other instances where there is no lag at all and everything works perfectly.
Other things I’ve tried / plan to try to rule out specific factors:
- Tried using a different computer to send sequences to ESP8266, still had lag.
- Tried switching between the breadboarded design and PCB design, still had lag on both.
- My next step would be to try a new ESP8266 but currently only have one.
- My other next step would be to try a nicer router, but currently only have one.
I’m wondering if my router is just cruddy, but I don’t understand why it would be a issue even with a low-quality router since I’m only sending roughly 16 characters over to the network simultaneously. I would assume that generally shouldn’t be an issue over UDP, right...?
If anyone has suggestions on configuring routers, networks and otherwise general best practices for reducing lag when using IoT devices, any input is much appreciated.
Thanks y’all and cheers.