posted on 2020-09-04 by Chris Noxz
During some laboratory work I was given the task to measure distance over time using a tool called PASCO Capstone. Unfortunately this tool is neither free software nor available for Linux. The only logical response to this was to create one such tool.
I didn't think this would be particularly hard to do as I already knew of two measuring devices able to read distance based on sound reflection, the HY-SRF05 and the HC-SR04. These devices use ultra sonic bursts to measure the time it takes to echo against a surface. Using the speed of sound to calculate the distance, based on the time it took to echo, is then an easy task to do.
The tool I wrote is meant to be used on a raspberry pi and is at this time of writing written in python. In the future I might rewrite it using c instead as the performance might be better. It's just a matter of priority as it won't take that long.
The tool is a simple CLI that just prints the time and distance based on a preferred measuring frequency. The data written to STDOUT can then be stored in a CSV-file and later analyzed using other tools.
The source code can be found here.