2

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?

Colas
  • 21
  • 3
  • Opinions are not deemed to be adequate answers for this site so try and phrase a question that can be answered. – Andy aka Feb 17 '20 at 19:31
  • Thanks @Andyaka, fixed – Colas Feb 17 '20 at 19:53
  • 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. – David Schwartz Feb 17 '20 at 20:38
  • 1
    @Colas You might find the discussions at https://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.11**n**). Broadcast UDP usually gets very good sync over a flat LAN. – jonathanjo Feb 17 '20 at 23:29
  • Thanks @jonathanjo for the link, Can you point me about the detail i'm skkiping? thanks! – Colas Feb 18 '20 at 09:46
  • 1
    Did you find this thesis: [Time Synchronization in Short Range Wireless Networks](https://www.eit.lth.se/sprapport.php?uid=945), it may help you make your question more specific. It looks like 10ms is possible. – Jeroen3 Feb 18 '20 at 10:18
  • @DavidSchwartz, will that delay be stable? I mean, it's doesn't matter if all nodes are 200ms off from master, I only need too keep sync beteewn nodes – Colas Feb 18 '20 at 10:22
  • @Colas Some detail which affects the solution: How many devices are there? What is the structure of the WLAN? Do you have CPU's timers and interrupts available? What are they doing which needs to be in sync? How long are the systems up for (longer = longer to average over for transmission jitter, for example). "Every minute or so": what controls when the nodes transmit? – jonathanjo Feb 18 '20 at 10:38
  • @Jeroen3 thanks for that link, very interesting. – jonathanjo Feb 18 '20 at 10:40
  • @Colas "Variation" is, by definition, a measure of instability. – David Schwartz Feb 18 '20 at 16:03
  • Very very useful document @Jeroen3, thanks – Colas Feb 18 '20 at 21:12

1 Answers1

0

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.

Caleb
  • 42
  • 3