Hands-on pulsed radar: part 1
So, let's explore some options.
We could use a loudspeaker and a microphone. This is, in fact, what Juha used during his lectures at this radar course last year. When we tried to determine the maximum range in a corridor at UNIS, the sound pressure level of the frequency sweeps was almost sufficient to empty the whole building. Those who did not run for the hills because of the volume thought it was some sort of an alarm and used the nearest exit. Well, I may have exaggerated a bit, but we did get some attention and Juha's ears were ringing for a while. In practice, we could also use frequencies outside the human hearing.
There are plenty of commercial and inexpensive ultrasound ranging sensor modules available (such as HC-SR04). All of these have the relevant electronics in place and you simply measure the time-of-flight, which comes out of the box as a convenient digital signal. There are plenty of examples with software and hardwire wiring diagrams for Arduinos and Raspberry PIs in the web. If you simply want to measure the distance, using one of these modules is a very good idea. However, there is the downside that all processing of the received signal is done for you and looking "inside the box" becomes cumbersome. Another option is to come up with a very simple DIY device and record the received signal straight to the computer somehow.
Searching the web results in plenty of circuit descriptions for ultrasonic range measuring devices. Almost all of them are similar to the off-the-shelf ultrasound module and thus not quite what I was looking for. Nevertheless, Texas Instruments (TI) has an application note Ultrasonic Distance Measurement With the MSP430 (SLAA136A), which provides plenty of technical details and a convenient starting point for laboratory experiments. The design uses common 40kHz ultrasonic transducers, which cost a few euros each. For some reason, I just happened to have a few at hand.
Because I didn't have any of the TI microcontrollers in my drawer, I used a Microchip PIC12F675 instead. I also simplified the circuitry by ignoring everything that was not relevant for testing the basic idea in practice. One of the general purpose pins is used to drive the transducer directly, so the output power is not particularly great. For now, the receiving transducer is connected straight to the oscilloscope probe without any kind of amplification. I used the freely available Microchip MPLAB X IDE to write a short and ugly program in C and then the ICD3 programmer to program the "firmware" into the microcontroller. The signals VPP/MCLR, PGD and PGC are from/to the programmer.
|A simple circuit, isn't it?|
Notes from the benchThe cheap transducers are based on piezo elements and have the highest resonant peak frequency at about 40kHz. So, the peak output power is also at that frequency. Similarly, the receiver more or less ignores all other frequencies making the receiver front-end a narrow bandpass filter (with a high Q-value). Frequency modulation and sweeps are thus not really practical. But what about pulsed operation?
Based on the oscilloscope capture, the transmitted pulse was received at about 2×200μs later. Assuming a sound velocity of 340m/s (air at room temperature) this corresponds to about 14cm, which is pretty close to the actual distance between the transducers.
However, exactly like the theory of resonant circuit predicts, sending out one short pulse makes the receiving end "ring" (at 40kHz) for a surprisingly long time. This is actually desirable in many applications, but not in this. The ringing lasts easily for more than 1ms.
|Transmitted impulse (yellow) and received signal (blue)|
Sending a short burst of pulses at 40kHz results in a stronger received signal. The plots below show the results with 4 and 8 pulses. The distance between the transmitter and receiver is roughly 4×200μs or about 27cm. Also, the longer burst of pulses results in an even stronger received signal, thanks to the resonating receiver transducer.
|Four transmitted pulses (yellow) and received signal (blue)|
|Eight transmitted pulses (yellow) and received signal (blue)|
Double ring...If one desires to modulate the transmitted pulse with these piezo-based devices, one can practically only use one fixed frequency. The ringing in the transducer also makes the amplitude modulation mushy and not easily recoverable.
Here are two examples, where two bursts are sent. If the transmitted bursts are too close to each other, the received signal are not properly resolved.
|Two transmitted bursts (yellow) sent too close each other|
|Two bursts (yellow) sent sufficiently far from each other|
Pulse codingI briefly tried binary phase shift keying but the ringing resulted in losing all phase keying at the reception. But there are, of course, other methods in encoding the transmission. For example, something like this:
|A very simple coded transmission|