This issue didn’t surface until the system was fully integrated. But by that point, several sources of audio delay had become apparent.
Initially, the speaker was controlled directly by the Arduino Mega via a serial MP3 player module. These modules require MP3 files to be preloaded onto a microSD card and accept traditional commands like Play, Next, and Back. However, the onboard processor introduces noticeable latency when handling these commands, resulting in a delay between when a step is triggered and when the corresponding tone is played.
Further delay came from the software-implemented SPI communication with the RFID readers, as described in the previous section. While this bit-banged SPI allowed for reliable long-distance communication, scanning all readers could take up to 4 seconds. Because the Arduino Mega is single-threaded, this would sometimes delay tone playback by several seconds.
To reduce these delays, I implemented three key solutions: