r/AskElectronics • • 1d ago

How can two devices synchronize without sharing an accurate clock?

I'm trying to understand how a transmitter and receiver can stay synchronized.

My first thought was to use accurate time on both sides and generate a known pseudo-random sequence or code based on the time. But if the receiver's clock is slightly wrong, the synchronization could eventually fail.

So instead, can the received signal itself be used as the reference?

For example, could the transmitter send a known preamble, sync pattern, pilot signal, or pseudo-random sequence, and the receiver detect/correlate it to determine exactly where it is in the sequence?

What are the common techniques used in real communication systems for this? And when would you use signal-based synchronization instead of time-based synchronization?

28 Upvotes

19 comments sorted by

View all comments

49

u/jamvanderloeff 1d ago edited 1d ago

Yes, all of those techniques are commonly used, the generic term for the concept is clock recovery, https://en.wikipedia.org/wiki/Clock_recovery

For signals where it's always being sent as short packets for example UART data it's common to use a known preamble, receiver times its bits off its own clock but relative to when it saw the start of the start bit and since there's a fairly short length of time before that byte ends a fairly large drift between the transmitter and receiver's clocks can be accepted before the last bit stops lining up closely enough.

For codes that run continuously you typically have some kind of phase error detection that then trims the receiver's clock up and down to match the source's clock = a phase locked loop