Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By giovi61
#77842 Hello to all,
I would like to implement a project that resembles the device that is used in fencing contests, ie a device that signals who between 2 contenders who touched first or determine if the touch was contemporary, all with WiFi communication.
I state that it is only recently that I am experimenting with ESP8266, which still has many aspects obscure than my knowledge.
The approach I thought of is to use 2 esp-01 which will work as clients and a NodeMcu as a server configured as an AP. The clients should be connected to the contact sensors and transmit to the server when the signal is present.
The server should compare the signals from the clients and determine which was first generated.
Regarding the code that must deal with the comparison between the signals is not a problem, while the real problem for which I ask your help is to understand what kind of connection is more suitable to minimize latencies because as you have certainly understood the time is the determining factor.
Believe me, I would have wanted to solve the problem by myself, but after many failed attempts I have to ask for your help.

It would be nice if someone had some really working tested code that puts 2 esp8266 in communication at the highest possible speed.
User avatar
By QuickFix
#77863 Just my two cents, so I may be way off here.

You can use UDP, but whilst it's very fast it's also (very) unreliable, since there's no control mechanism.
In a sport like fencing (or actually any sport for that matter), reliability of who's winning is very important, so I would take a different route by using a standard-time based approach.
Connect a stable and (if anyway possible) very accurate clock module to both "Fencer"-modules and when a hit is detected, this time is sent to the Director; the person with the earliest time wins.

After that: rinse and repeat.
User avatar
By rudy
#77865 I think UDP would be adequate and probably the best choice. Any unreliability can be handles by multiple sends. Send three times. If it doesn't get there then there then a TCP link would also have problems and the information would be out of date when it finally gets there. ... time-games
User avatar
By giovi61
#77881 Hi Rudy and quickfix, thanks for intervening.
I also thought that maybe the UDP approach is the way to go.
I tried to perform tests on the transmission / reception of packages, but I could not make anything work. In particular I followed this tutorial:
I used a NodeMcu configured as AP and I connected my laptop to the network created by the ESP. I then used a second ESP (ESP-01) on which I loaded the sketch. I used the program to perform the transmission test, but I tried several attempts to send packages but nothing happens
Do you have any suggestion in this regard or the definitely working code to be tested?
Thanks in advance