I was planning to determine light speed by myself(which is 3*10^8 m/s). I have kept 2 sensors, and I need to know the time interval as light strikes the sensors. It lies somewhere about 50nanoseconds. Is it possible to measure such a small timeinterval using RPi?

  • try to bounce your light off the moon. there are reflectors left on the moon surface exactly for that purpose. then you don't have to worry about measuring sub-millisecond intervals.
    – lenik
    Aug 3, 2014 at 16:29

2 Answers 2


I can offer a suggestion, not one that I or anyone else has tried to my knowledge.

SPI should operate at 250MHz on the Pi which means each bit is 8 nano seconds long.

If you can feed your two sensors into the SPI MISO line you should be able detect the difference in times by examining the SPI data. Perhaps MISO could be pulled up to 3.3V and your sensors could drive the gpio to ground.


The system itself can work with nanoseconds. For example the C function clock_gettime can return you the time in nanoseconds since epoch.

The GPIO of the Pi on the other hand can read reliably at around 14MHz (source). Meaning you can read a value 14 million times per second. Which is by far not enough to have nanosecond accuracy.

High-speed tasks like these are more suited for a microcontroller or FPGA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.