by Sam Hammamy
Last Updated June 30, 2020 04:25 AM

I read a research paper which proposes an algorithm to synchronize sensors in a way that is independent of the sensors.

Beginning with the simplified version which assumes no drift between the sensor `p`

and the host `q`

clocks and assumes `p`

does not send a time with its messages but consistently sends measurements at a rate of `75 Hz`

for example.

**How do I obtain multiple measurements of p's and q's clock based on some starting event?**

More specifically, let's say that `p`

is an Ultrasonic Range Sensor, and `q`

is a Raspberry-Pi running Linux.

Assuming `p`

is a higher-end sensor with an ADC and can provide the distance values over SPI but without a timestamp; I realize that's not how these common sensors are but let's simplify things.

I also realize the SPI frequency of the Rpi is approx 3.5 kHz to 125 MHz, but let's again say we set the SPI clock such that we know `p`

is generating measurements at `75 Hz`

.

Having these equations

where `A`

is the **constant** offset between clocks, `t`

is the time on the Rpi at which the sensor observed the data, and `e`

is the latency by which the Rpi processes the message.

We cannot observe `A`

or `e`

directly but we know `p`

and `q`

.

If I say that `q1`

is the epoch time on the Rpi when I start the SPI communication to read one measurement, **is the value of p1 simply**

```
q1 + (1/75)
```

The author says this method is not useful and is illustrative of the basic idea of the approach, and having written it out like this does make that clear. But I want to verify I've understood it before moving on to the real algorithm.

Let's finally say I am using a common sensor that I have connected to an STM32 blue pill which the Rpi uses SPI to read the measurement, **how does that change p1?**

- ServerfaultXchanger
- SuperuserXchanger
- UbuntuXchanger
- WebappsXchanger
- WebmastersXchanger
- ProgrammersXchanger
- DbaXchanger
- DrupalXchanger
- WordpressXchanger
- MagentoXchanger
- JoomlaXchanger
- AndroidXchanger
- AppleXchanger
- GameXchanger
- GamingXchanger
- BlenderXchanger
- UxXchanger
- CookingXchanger
- PhotoXchanger
- StatsXchanger
- MathXchanger
- DiyXchanger
- GisXchanger
- TexXchanger
- MetaXchanger
- ElectronicsXchanger
- StackoverflowXchanger
- BitcoinXchanger
- EthereumXcanger