For our ECE 4760 final project, we designed and implemented an ultrasonic range-finding hat that uses haptic feedback to alert its wearer about obstacles in his or her path. The hat is equipped with an ultrasonic transmitter/receiver circuit, which is capable of emitting short pulses of ultrasonic-frequency (approximately 40 kHz) sound, at a level of about 120 dB. These pulses then echo off the closest object in the line of sight of the hat and are picked up by the receiver. The time delay between sending the initial pulse and receiving the echo gives a sense of how far away the obstacle is from the ultrasonic sensor, which can be conveyed to the person by vibrating the hat at a level proportional to that distance. This allows the person to understand what obstacles are in his or her path and to respond accordingly. Specifically, this project is intended as a proof-of-concept/prototype for a product that would ultimately be used by sight-impaired individuals to detect walls or other obstructions, reducing their dependency on canes.
The mathematical foundation for this project is very simple and is primarily based upon acoustic velocity, or the speed of sound, and the time it takes sound to travel a certain distance. At a basic level, this is governed by the following equations:
- Approximate speed of sound in air: v = 331.4 + 0.6T, where T is the temperature in °C
- Round-trip distance = v*t, where t is the time for the pulse to return to the sensor
- Object distance (approximate) = 39*(Round-trip distance)/2 inches
For this project, the speed of sound in dry air at 20 °C and 1 atmosphere pressure was used, which is approximately 343.2 m/s. This value was multiplied by the time difference between when the initial ultrasonic pulse was sent and the echo was received, which gives the round trip distance that the ultrasonic pulse travelled. However, we are interested in the distance to the object off which the pulse echoed, which is half the round trip distance. There are approximately 39 inches per meter, so the object distance in meters is multiplied by 39 to convert the distance to inches. This is the only major calculation done in the main loop of the software.
The Bat Hat system is structured into four main stages: the pulse transmission stage, the echo detection stage, the distance computation stage, and the pulse width modulation (PWM)/haptic feedback stage. The state transition diagram below reflects the flow of these states during normal operation. These states represent events both in hardware and software and, aside from the distance calculation, each state can (and will in the following sections) be broken down further into hardware and software components.
At a high level, the core of the system is based around three software interrupt service routines (ISRs). One ISR, a rising and falling edge triggered external interrupt, is used to receive echoes and record their arrival times and durations. The next ISR is used to drive a consistent echo pulse train to the transmitter and reset system time when appropriate. The third ISR increments system time. The main loop of the program then updates the PWM value used to control the haptic feedback vibration motor.
The hardware is closely associated with the software. The transmitter consists of an oscillator circuit that drives the ultrasonic transmitting speaker at 40 kHz and is controlled by a single TTL pin, which is driven by a microcontroller port. This creates a train of short ultrasonic pulses, which hit the ultrasonic receiver, reflect off the nearest object, and return to the receiver. The receiver circuitry filters and amplifies the signal and drives a trigger that tells the microcontroller when there is a wave present. As was stated previously, the time between the initial pulse and the reflected pulse at the receiver, as well as the duration of the two pulses, is recorded by the microcontroller. Any further echoes are ignored because they are unnecessary for determining the distance of the nearest obstacle.
Scope trace of the initial pulse and echo, as seen at the receiver. The top trace is the received signal after amplification and filtering. The bottom trace is the trigger output, which is fed into the microcontroller.
Hardware and Software Tradeoffs
We chose to implement the most complex parts of our project in hardware. This was done in order to allow for more accurate timing and to eliminate the need for an external ADC (the microcontroller’s internal ADC samples too slowly for an ultrasonic signal). We could also get more power (higher dB) by driving the transmitter with an external source.
In software, we could have made use of a real-time kernel for timing tasks and concurrency management with semaphores, but because an ISR is never interrupted by another ISR, we could simply utilize volatile variables and a well-structured state machine to eliminate the need for the real-time kernel. This gave us more flexibility with timing in that all three timers were available for our use.
There are several international standards associated with sounds and their relationships with human beings. One major standard is ISO 532:1975, “Acoustics — Method for calculating loudness level,” which “Specifies two methods for determining a single numerical value of a given sound, the first method is based on physical measurements, such as spectrum analyses in octave bands, the second method is based on spektrum [sic.] analyses in one-third octave bands.” ISO 28961:2012, “Acoustics — Statistical distribution of hearing thresholds of otologically normal persons in the age range from 18 years to 25 years under free-field listening conditions,” shows that we are operating well outside of the human hearing range, which is related to ISO 266:1997, “Acoustics — Preferred frequencies.” Lastly, because of the haptic component of the project, ISO standard 9241-920:2009, “Ergonomics of human-system interaction — Guidance on tactile and haptic interactions,” “gives recommendations for tactile and haptic hardware and software interactions.”
Relevant Patents and Copyrights
There are two patents we found to be relevant to our project. The first is US20120299643, “Driving circuit for a circuit generating an ultrasonic pulse, in particular an ultra-sonic transducer, and corresponding driving method,” which is related to the subject matter of our project. However, the approach we use in our design is very different from that in the patent. Another applicable patent is WO2012123787, “An echolocation apparatus,” which, according to the Abstract, “comprises an echolocation module configured to determine a distance to the object based on the received sound signal reflected from an object.” This patent is not as relevant to our project, but does contain interesting ideas related to ultrasonic range-finding.
For more detail: Ultrasonic range-finder with haptic feedback