@Allison-K Unfortunately Arduino and similar microcontroller approaches really aren't portable to a multitasking platform like the Omega, Pi, C.H.I.P or similar. This is because the task scheduler introduces substantially latency in the running of ordinary programs, often up to 20 ms or so. Sound moves at approximately 344 meters per second, so it covers 344 mm in one millisecond. Given the roundtrip timing, a 1 ms timing error woud be half that: 172 mm or about 6 3/4 inches, and the timing uncertainty may well be more than this. Viable approaches would need to do one of Use a hardware timer Use kernel mode code Use an interrupt (GPIO interrupts to userspace are not currently enabled) Use some continous streaming data interface, for example the I2S audio which can capture at a regular rate and have it capture both the trigger and echo, then measure the elapsed time as the number of samples recorded between these events Use a helper MCU like an ATtiny or a full Arduino to take the measurement and report the result