Measuring distances between objects is a type of data commonly obtained in a variety of industries and endeavours. The most recent examples are autonomous vehicles (how far an object in our way is), automatic ship berthing, or industrial object positioning.
One of the most common ways to do it is by using ultrasonic sensors. The grounds for it are simple – the majority of objects and substances reflect sound waves. Thus, today, we’d like to tell you more about one of our smaller projects in the field of sound measurement developed within our research and development division which aimed to solve one specific problem found in the field of geriatrics.
The story
A while ago, a Germany-based company reached us with a thorny problem. They were conducting a study in retirement homes on preventing cognitive impairment (dementia, Alzheimer’s, etc.) with a combination of physical and brain exercises.
To do so, pensioners had to remember the order of stations they had to visit displayed on a tablet. Then, holding a special object (similar to a baton in relay races) they moved from station to station. Apart from working memory, what was measured was seniors’ physical activity, as they had to move between the stands.
So far, the researchers measured the distances between multiple stations with a tape measure which wasn’t effective and caused a sense of frustration as well. Thus, our task was to come up with a method that would not only automate the measurement process but also grant the precision required.
How to measure the distance
The use of sound wasn’t an obvious choice at first. We’ve been considering – and testing – different methods before reaching a verdict, such as:
- laser distance metre (didn’t pass our verification – no automation)
- beacons (passed the initial verification but measurements lacked accuracy)
- sound waves (passed the initial verification)
- computer vision (we assumed that it might work but the users would have to mark each stand and attach a camera to it – no automation again).
As you can see, only sound waves passed the initial verification and seemed promising. However, as with any method, it wasn’t perfect, but we’ll delve into it in the next sections.
The measuring method
To measure distance with sound we have to use a transmitter that sends a short sound and a receiver that catches it on its return. The sound travels from the transmitter, bounces from an obstacle on its way, and returns to the receiver. Knowing the speed of sound, in this case travelling in the air, we can easily calculate the distance it covers. The devices available in the market oftentimes have both transmitter and receiver built-in.
However, using one device only affects accuracy and the range we can measure. Thus, we’ve decided to use two separate devices. They were transmitting the signal one by one and recording the entire process.
Signal design
The emitted signal had to be easy to be both produced and detected. Since we used mobile devices that are designed to work best at human voice frequencies, it determined the bandwidth to comply with. Our signal had also to be easily distinguishable from ambient noise. To do so, the system calculated the correlation with the pattern signal. The higher the correlation, the bigger chance the sound received is what we’re looking for.
Signal parameters:
- type: linear chirp (increases in frequency linearly with time)
- bandwidth: 2-4 kHz
- duration: 100 ms
Measurement errors and their sources
No method is flawless though. The sources of error in this approach included:
- unsynchronized clocks
- signal sending delay (caused by the operating system)
- signal receiving delay (caused by the operating system)
- multipath effect (reflected signals).
Just a word of clarification regarding errors caused by the operating system. The delays mentioned above are a result of the lapse of time between the moment we issue a command that triggers the sound and the actual sound produced by the speakers. This time depends, among other things, on how heavily loaded the device is.
BeepBeep ranging
In this project, we’ve utilised an acoustic-based ranging system called BeepBeep. It has been developed with commercial off-the-shelf (COTS) devices, such as mobile phones, in mind. What was particularly important in our case, the solution is purely software-based and operates device-to-device with no extra infrastructure needed, which translates to lower costs.
The high accuracy is achieved through two-way sensing, self-recording, and calculating the distance measured by devices A and B, and B and A. BeepBeep helped us to eliminate three out of four sources of error described in the previous section, such as clock synchronisation and operating system delays. Although it didn’t resolve the problems connected with the multipath effect, BeepBeep allowed for its mitigation up to a certain distance, namely around 6 metres. Read more on the BeepBeep system.
Communication interface
When it comes to the communication interface, we’ve decided to make use of Google’s Nearby Connections. This peer-to-peer networking API allows applications to exchange data between nearby devices even when no internet connection is available. The transfer is fully encrypted and thus secure.
We used it to send two types of messages, namely:
- start
- elapsed time between the two times-of-arrival
The results
We have to admit, the results were fairly surprising, especially after the fiasco with beacon testing. Up to the distance of 6 metres (20 feet) the system achieved precise calculations, where the margin of error was less than 5 centimetres (2 inches). The systematic error results from the wrong values set for the distances between the device microphones and the speakers. In the table, you can see the exact results of our measurements. The major errors occurred only when we placed obstacles between devices.
The main advantage of measuring distance with sound is that the method is pretty accurate and at the same time cost-effective – there are plenty of device choices in the market. What is more, our measurement accuracy is not affected by the lighting conditions or the object features, such as colour or transparency. On the other hand, the distance covered accurately, up to 6 metres in our case, might not be enough in every project.