I'm working on a wireless (2.4Ghz WiFi 11n) project where multiple nodes (ESP32) send very small data to the AP, something like 40 bytes every minute or so. I need to maintain an accurate coordinated clock between them, absolute accuracy doesn't matter, but they must match with each other to at least 1ms (or better).

As GPS signal is not guaranteed at the location, I prefer not to include it in the design and I was thinking using the server (laptop wired to AP) to send a UDP Multicast timestamp every, let say, 2 seconds. The nodes are in constant movement (with vibration) so they may drift faster, anyway, I have doubts if this alternative would be able to work as I expected and I would like to know any other alternative or improvement of this system

At the moment, I have these unknowns that I would like to get an answer to:

  • Expected delay if AP is already busy sending / listening in the very exact moment it must emit the timestamp

  • Is there any physical reason (Multipath, bad signal, whatever) that one or more nodes doesn't receive the UDP at the exact moment? With exact moment I mean between a millisecond

  • Is there any chance of ESP32 slowdown or hang by another task and receiving the UDP packet pretty later?

  • \$\begingroup\$ Opinions are not deemed to be adequate answers for this site so try and phrase a question that can be answered. \$\endgroup\$
    – Andy aka
    Commented Feb 17, 2020 at 19:31
  • \$\begingroup\$ Thanks @Andyaka, fixed \$\endgroup\$
    – Colas
    Commented Feb 17, 2020 at 19:53
  • \$\begingroup\$ I can't imagine that millisecond accuracy is going to be possible with this kind of method. You're probably going to have way more variation than that just in the time between when the transmission is finished and when the data from the transmission gets to running code. \$\endgroup\$ Commented Feb 17, 2020 at 20:38
  • 1
    \$\begingroup\$ @Colas You might find the discussions at electronics.stackexchange.com/q/476561 useful. Contrary to David, I'd expect results around 1ms or better, but there are a lot of details missing from your question (espectially about 802.11n). Broadcast UDP usually gets very good sync over a flat LAN. \$\endgroup\$
    – jonathanjo
    Commented Feb 17, 2020 at 23:29
  • 1
    \$\begingroup\$ Did you find this thesis: Time Synchronization in Short Range Wireless Networks, it may help you make your question more specific. It looks like 10ms is possible. \$\endgroup\$
    – Jeroen3
    Commented Feb 18, 2020 at 10:18

1 Answer 1


I Would try either syncing them together through a mesh network or have the AP sync them all with NTP. That's just a suggestion though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.