Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By warwickw
#72615 Hi, I'm considering developing a wifi sports timer for swimming competitions, where a touchpad and/or a human operated pushbutton will trigger a simple wifi transmission (on a dedicated SSID) from an esp8266 to a dedicated local server as the competitor finishes.

My open ended questions are: 1) What latency would you expect to see from a button push to a wifi transmission (the esp8266 does not need to be asleep/ low power) 2) how much variability would there be in this and 3) what happens if two units try to transmit at the same time.

Would I be correct in thinking that with a dedicated wifi network, transmission ranges of 10 metres max, and possibly just simple UDP connections, we are in the single millisecond range, or is that too optimistic. Results are typical expected to be accurate to 0.01 seconds (ignoring the human element of the button push!!)

Thanks in advance for any info, or indeed any alternative approaches. Similar products exist commercially, but I'm not sure if they take this approach or time 'locally' to each stopwatch and then transmit the results. I know that the 'start' signal is synced across all watches, so its effectively the same problem but in reverse?
User avatar
By rudy
#72655 TCP will be reliable but at a cost, time. If for some reason the initial packet doesn't get there it will try again after a timeout. For this reason I would use UDP, but send three times. On the receive end be ready to accept more than one packet. Make the code so that it only acts on the first received packet.

It might be worthwhile to look into websockets. A connection could be kept open, so you don't need to establish a connection when using TCP. But I am not familiar what it does about missed packets.

I'm not sure if this will help you. https://gafferongames.com/post/udp_vs_tcp/
User avatar
By dragondaud
#72659 According to https://sarwiki.informatik.hu-berlin.de/Packet_transmission_time_in_802.11 the time to send 1500 bytes at 54Mbps with 802.11g is only 326μs (millionth), so shorter packets would go even quicker. But, I would suggest you simply synchronize everybody with NTP, and send TCP packets with timestamps, and collate the results, without worrying about resending or collisions and such.