I have one arduino acting as master and 3 arduinos acting as slaves. When the master sends a WIFI signal to the slaves, the slaves have to start to do the same thing. My question is, if it is possible to do that with a time difference of 10 microseconds between the slaves? I need that the communication is wireless.
I don't think it would be possible with any available mainstream radio modules (NRF24, RFM69 etc.). Wireless technologies are not that reliable to ensure that the packet reaches and gets digested by all the nodes with 10-microsecond difference. 10 milliseconds are achievable though, but even that is not guaranteed to work 100%. I have NRF24, and at 1Mbps setting it can achieve sub-1ms latency, but occasionally it "hiccups" to more than 5ms latency or even more than 200ms in a noisy environment.
I have turned the built-in ACK completely off and using my own send-waitAck logic, and in 99% it does not exceed 3ms (most often it's under 1ms). Maybe 1 packet out of 500 suddenly does not receive an ACK in time, so after waiting for 200ms I give up and resend the packet again. But then the receiver sometimes reports a duplicate packet (I have a sequence number in every message to detect duplicates). So, it actually received the message the first time but the ACK was delayed or lost. And after that, it works completely normally for many minutes until the next "hiccup".
I suspect it might be caused by some 2.4GHz noise from my (and neighbors') wifi equipment. As latency & reliability are important also for my project I'm considering RFM69 instead of NRF24. I've heard RFM69 are less sensitive to noise, and they operate in a less noisy frequency band in general.
Is the requirement that all the slaves start doing something within 10us of the signal from the master, or that the "skew" between the slaves should be less than 10us? If the latter then having the slaves synchronise to a common clock might allow this. What that clock might come from I'm not sure! It could for example be an NRF type device just sending out regular pulses that each slave receives and syncs to. Then the master effectively says "do in N ticks time".
Yep, it works fine for the receiver end. It's just that the sender has been waiting for an ACK and then the next message might get delayed, breaking the idea of "real-time" communication because in my project a delayed reaction time to a keypress is not desired.
I have accounted for this - I do abs() difference between both numbers, and it works because the problem does not occur periodically with wrapping.
Returning to the original topic,
I'm wondering if it's possible for a wireless clock pulse packet to reach and be digested (through SPI) by all the slave devices with simultaneity within 10us? Because it would not matter what the master says later if the clock is wrong on a slave because it received the pulse a bit later than the others.
Of course, it also would be mega important to ensure that the slaves sync only to the pulses that were delivered at the first attempt and ignore any retried messages because the retry process might take much longer than 10us.
I think the slave nodes need to be considered carefully. They cannot have any interrupt driven processes at work, if they are to reliably act upon any form of synchronization*, so the whole design needs to be thought through.
'* - because interrupts are blocking, so even if the sync signal is used as an interrupt, serial or timer processes can delay a second interrupt event.
In post #21 of the thread linked below, I showed some code for synchronization using cheap 433 MHz radios that could be used with multiple slave nodes. Per comments in that post I observed a synchronization offset of 55 microseconds across platforms without any optimization, so I expect something on the order of 10 microseconds might well be possible.