Gas station without pumps

2016 February 7

Ultrasonic rangefinders arrived

Filed under: Data acquisition,freshman design seminar — gasstationwithoutpumps @ 21:41
Tags: ,

On 2016 Jan 27, I ordered 40kHz transmit/receive transducers from two companies, both through eBay:

Both companies shipped via ePacket with estimated delivery dates of Feb 5–Feb 27, and both packages arrived early on 2016 Feb 4.  On Friday I let students in the class have transmitter/receiver pairs for $1 a pair (7¢ cheaper than my average cost, but 4¢ more than if I had ordered only from the cheaper supplier).

I changed the test setup that I had in More testing for ultrasonic rangefinder to drive the transmitter directly from the Teensy board (using two output pins, so that I could drive ±3.3V), then immediately switch to recording from the microphone.  All the coding was done using the Arduino routines, not faster code that directly manipulated the registers, with one exception.  I did not use delayMicroseconds(), but wrote my own finer-grained delay routine, so that I could tune the 40kHz pulse (12.5µs half period) more precisely:

// delay for amount of time specified by loops (no-op loop)
void fine_time(long loops)
{
    for (int32_t fine_loops=loops; fine_loops>0; fine_loops--)
    {   asm("nop");
    }
}

I compiled for the Teensy 3.1 with “48MHz optimized”, as that gave me the best recording sampling rate. I tuned the number of loops for the delay by timing (with the micros() timer) 400 half-cycles of driving the output with the same code that would be used for the actual ping output. I adjusted the number of loops until I was as close as I could get (12.48µs using fine_time(135)).

I mounted the transmitter on one tripod and the microphone on another, so that I could record the direct sound from the transmitter without having to worry about getting multiple acoustic paths muddying the signal. I then recorded the bursts for a number of different excitation patterns.

Even with just a single 12.5µs pulse, the transmitter rings for a long time.

Even with just a single 12.5µs pulse, the transmitter rings for a long time.

Adding more half cycles, the transmitter output amplitude grows substantially:

As the number of half-cycles of excitation increases, the amplitude of the ping increases almost linearly, but the ringing does not last much longer.

As the number of half-cycles of excitation increases, the amplitude of the ping increases almost linearly, but the ringing does not last much longer.

I tried actively squelching the ringing, by driving the transmitter out of phase with the initial drive pulses:

After driving transmitter for 10 half-cycles, I waited 12.5µs with 0v across the transmitter, then drove it for another 6 half cycles. Because of the delay, the drive was now 180° out of phase with the original signal, and cancelled most of the ringing.

Unfortunately, there seems to be another mode of vibration excited, which is not cancelled by the out-of-phase driving.  This extra vibrational mode is coupled to the main mode, transferring the energy stored in it back to the main oscillation.  So even though the main mode is squelched, the ringing comes back, and the total length of the ringing is about the same, though the energy after the 10 half cycles that were driven is much less.

I also tried adjusting the squelch to 5 or 7 half cycles, instead of 6:

After driving transmitter for 10 half-cycles, I waited 12.5µs with 0v across the transmitter, then drove it for another 6 half cycles. Because of the delay, the drive was now 180° out of phase with the original signal, and cancelled most of the ringing.

After driving transmitter for 10 half-cycles, I waited 12.5µs with 0v across the transmitter, then drove it for another 6 half cycles. Because of the delay, the drive was now 180° out of phase with the original signal, and cancelled most of the ringing.

Using only 5 half cycles of squelching does not fully cancel the initial oscillation. Using 7 half cycles prolongs the secondary ringing.

Using only 5 half cycles of squelching does not fully cancel the initial oscillation. Using 7 half cycles prolongs the secondary ringing.

Although I played around with trying to squelch the secondary ringing with another delay and more out-of-phase pulses, I did not have much success. I could flatten it out a little, but only by prolonging the ringing. I might be able to do better if I adjusted the pulse widths as well as the delay between the driving ping and the squelch pulses, but I think I’m reaching the point of diminishing returns—especially since the details of ringing is likely to be unique to the specific part, not shared by different transmitters even from the same batch.

Next steps will involve amplifying the tuned receiver module, rather than using an untuned microphone.  I expect that I’ll get cleaner signals (perhaps not needing digital filtering), but that ringing will be an even bigger problem, since both the transmitter and the receiver will ring.

4 Comments »

  1. […] with a non-resonant electret microphone and amplifier and pings from a Maxbotix rangefinder.  In Ultrasonic rangefinders arrived, I looked at generating good 40kHz pings while listening to the direct sound with a microphone […]

    Pingback by Ultrasonic rangefinder without amplifier | Gas station without pumps — 2016 February 12 @ 21:23 | Reply

  2. […] the series Ultrasonic rangefinder project , More testing for ultrasonic rangefinder, Ultrasonic rangefinders arrived, and Ultrasonic rangefinder without amplifier, I tried today to look at creating pings with a […]

    Pingback by Ultrasonic rangefinder with loudspeaker | Gas station without pumps — 2016 February 17 @ 23:30 | Reply

  3. […] the series  Ultrasonic rangefinder project , More testing for ultrasonic rangefinder, Ultrasonic rangefinders arrived, Ultrasonic rangefinder without amplifier, and Ultrasonic rangefinder with loudspeaker I tried […]

    Pingback by Ultrasonic transmitter impedance | Gas station without pumps — 2016 March 13 @ 13:00 | Reply

  4. […] with a non-resonant electret microphone and amplifier and pings from a Maxbotix rangefinder.  In Ultrasonic rangefinders arrived, I looked at generating good 40kHz pings while listening to the direct sound with a microphone […]

    Pingback by Ultrasonic rangefinder tests with tiny loudspeaker | Gas station without pumps — 2016 August 18 @ 23:31 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: