Synchronizing two arduino boards

Hi everyone,
I’m doing a project in which I need to have two arduino UNO boards start running the same sketch at the same time with very little time delay(in order of 10^-5 second). First thing that came to my mind was wiring up the two to the same battery and putting a switch in the way, but the boards may have variable distance from each other so the syncing needs to be done wirelessly. I used a pair of 433MHz RF receiver and transmitter. Connected each one to serial pin of one of the arduino boards. The biggest problem with this approach was the receiver picking up too much noise or not even receiving the packet transmitted by the transmitter module at all in large distances. So the result was that it sometimes worked and sometimes didn’t. Also the need to add CRC and error checking mechanisms adversely affects time delay between the two boards. I even thought of using RTC (Real Time Clock) modules, but I didn’t find one that was accurate enough for me, since they have power constraints I guess. Can anyone please introduce a method or module or device that can help me do the job? Or refer to a source that might help me find the answer? Even if you have ideas to improve the methods I already used and explained above, it would be appreciated.


This the piece of code I used for RF transmitter(FS1000A):

#define WAKE_SIG_SIZE 2
const byte WAKE_SIG[WAKE_SIG_SIZE] = {0xF0, 0x8F};
Serial.write(WAKE_SIG, WAKE_SIG_SIZE);


This is the piece of code I used for the receiver:

#define WAKE_SIG_SIZE 2
const byte WAKE_SIG[WAKE_SIG_SIZE] = {0xF0, 0x8F};
bool wake_seg_received = false;
while(!wake_seg_received){
while(Serial.available() < WAKE_SIG_SIZE);
byte c1 = Serial.read();
byte c2 = Serial.read();
if ((c1== WAKE_SIG[0] || c1 == WAKE_SIG[1])&& (c2 == WAKE_SIG[0] || c2 == WAKE_SIG[1]))
wake_seg_received = true;
}

This is yet another "XY Problem". :astonished:

While you may be considering various ways to approach your problem, it will be vastly more effective if you explain the underlying requirement. :roll_eyes:


Also, read the instructions to post code so you can actually post meaningful code instead of inappropriate snippets.

Paul__B: This is yet another "XY Problem". :astonished:

While you may be considering various ways to approach your problem, it will be vastly more effective if you explain the underlying requirement. :roll_eyes:


Also, read the instructions to post code so you can actually post meaningful code instead of inappropriate snippets.

Thanks for replying. I need to observe the time delay between arrival of two vibration waves propagating on the surface of an object, at two distinct points on the object, using accelerometers. I need to cross correlate these two time series in order to find the location of the source of the vibration. For that, I need a common time origin between the two series. My idea is making them start at the same time. Then I'll have a common time origin at the start of the two series. So what I'm trying to do with these two arduino boards is making them start sampling at the same time. Any ideas would be appreciated.

If they were both running In idil Unfil a pin ges low or high Then that signal is the sync

... But i don't like the use of two in this application.

Please understand that NO Arduinos or any other computers will all run at the same time.

You need either an external clocking signal or program one Arduino to produce a clocking signal that it uses and also sends to the second Arduino.

Paul

The linked thread addresses a similar problem and post #20 in particular shows code for synchronizing two Arduinos via a 433 MHz radio link: https://forum.arduino.cc/index.php?topic=451490.20

With that scheme I observed 55 microsecond average synchronization offset and that can certainly be improved to something on the order of 40 microseconds. It's been awhile since I did this so I don't know off hand how much of stretch it would be to get to 10 microseconds.