ultrasonic transmitter implemented on arduino with...

12
Ultrasonic Transmitter Implemented on Arduino with Direct Digital Synthesis Item Type text; Proceedings Authors Owen, Jonathan; Ravenscroft, Brandon; Gustafson, Kai; Hellberg, Amanda Publisher International Foundation for Telemetering Journal International Telemetering Conference Proceedings Rights Copyright © held by the author; distribution rights International Foundation for Telemetering Download date 10/05/2018 09:50:56 Link to Item http://hdl.handle.net/10150/596454

Upload: doantram

Post on 06-Mar-2018

239 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

Ultrasonic Transmitter Implementedon Arduino with Direct Digital Synthesis

Item Type text; Proceedings

Authors Owen, Jonathan; Ravenscroft, Brandon; Gustafson, Kai; Hellberg,Amanda

Publisher International Foundation for Telemetering

Journal International Telemetering Conference Proceedings

Rights Copyright © held by the author; distribution rights InternationalFoundation for Telemetering

Download date 10/05/2018 09:50:56

Link to Item http://hdl.handle.net/10150/596454

Page 2: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

Ultrasonic Transmitter Implemented on Arduino with Direct Digital Synthesis

 3024 Eaton Hall, Lawrence, KS 66045

Team Members

Jonathan Owen, Brandon Ravenscroft,

Kai Gustafson, and Amanda Hellberg,

 Undergraduate  Entry  

                                   Abstract: Ultrasonic frequency signals can be employed in a manner similar to radio frequency signals for target detection and ranging by utilizing concepts from radar systems. This project uses components operating in the ultrasonic frequency spectrum to transmit and receive signals for detection and ranging. The project concept contains a single channel ultrasonic transmitter and a single channel ultrasonic receiver. An Arduino Due microcontroller is used to coordinate the radar system. The radar transmitter is continuously transmitting chirp waveforms in a frequency sweep pattern from 30 kHz to 50 kHz. Chirp echoes are received by the ultrasonic microphone. The echoes are mixed with the originally transmitted chirp, which creates a beat frequency response. The beat frequency is used to calculate the range of the target.

Page 3: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

Theory of Operation: The process of implementing an ultrasonic radar begins with implementing a linear FM

chirp on an Arduino Due microcontroller using direct digital synthesis (DDS) techniques. An Arduino Due is used as both the controller for the individual system components and the processor for DDS. Software written for the Arduino Due allows for generation of a chirp waveform of varying waveform duration, phase offset, and start/stop frequencies through I/O setup. Programmable bandwidth allows for adjustable range resolution. Programmable phase allows for use of varying signal processing techniques.

After signal generation, the chirp waveform is amplified, buffered, passed through a matching network, and launched into the air through an ultrasonic speaker. An ultrasonic microphone is used to receive target backscatter. Received backscatter is amplified, filtered, and mixed coherently with the transmitted chirp waveform to form a beat signal. After final amplification and filtering, this beat waveform can be shunted to an external location for sampling and processing. Determination of the frequency of the beat signal allows for calculation of target distance. The system diagram is shown in Figure 1. The single element transmitter and receiver system operate monostatically.

 Figure  1:  System  Diagram  of  Ultrasonic  Transmitter  and  Ultrasonic  Receiver  

Page 4: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

The Arduino Due executes software that emulates a DDS to generate a linear FM waveform sweeping from 30 kHz to 50 kHz with programmable start frequencies, chirp rate, and waveform duration. An external digital trigger signal is used to start chirp generation. All 3.3 V inputs of the Arduino Due are protected by voltage limiting circuits to avoid destroying the microcontroller. The chirp waveform is AC coupled and driven through dual programmable op-amp buffers 180º out of phase for amplification, followed by a matching network consisting of a series resistor and inductor. The matching network is needed to extend the bandwidth of the Kobitone transducer sufficiently for an applied chirp waveform of 30 kHz to 50 kHz to be transmitted effectively. The waveform drives a Kobitone transducer, which transmits the signal through air.

The project concept includes an on-board receiver that interfaces with a Knowles ultrasonic microphone. Chirp echoes received through the microphone are AC coupled and then amplified using a programmable amplifier. The received signal is then mixed with the transmitted chirp directly, allowing for detection of a beat frequency for range calculations. The relationship between the beat frequency and range is described below. Alternatively, the amplified signal travels into an RF mixer and is mixed with a local oscillator (LO) signal generated by a LTC6903 programmable oscillator. The LO signal is separately buffered and available externally to the board. The LTC6903 can be disabled when not in use. After mixing, the beat signal is conditioned with a low pass filter and shunted externally for processing. The primary equation relating chirp rate, beat frequency, and round trip travel time is shown in Equation 1, where ‘𝑓!’ is the beat frequency in [Hz], ‘𝑘’ is the chirp rate in [Hz/s], and ‘𝑇!"’ is the round trip travel time in [s]. The chirp rate is calculated using Equation 2, where ‘∆𝑓’ is the chirp bandwidth in [Hz] and ‘𝜏’ is the chirp duration in [s]. The round trip travel time ‘T!"’ is calculated using Equation 3, where ‘𝑅’ is the total distance the signal has traveled (approximately the same as the range to the target for long distances)* in [m] and ‘𝑣’ is the propagation velocity of the signal, which is 330 [m/s] for ultrasonic waves (speed of sound). The term ‘2R’ in Equation 3 is the total distance traveled by the signal for a monostatic configuration. A monostatic configuration is one in which the radar transmitter and receiver are collocated. Using these three equations and a known chirp rate, the range to a target can be calculated from the received beat frequency waveform. The beat waveform is generated by mixing the received backscatter chirp signal with the transmitted chirp signal. The transmitted and received waveforms should be nearly identical, aside from variations in amplitude and relative time. The time offset creates a beat waveform when the two signals are mixed, from which the beat frequency is extracted using signal processing.

𝑓! = 𝑘 ∗  𝑇!"                                                                                                                                                [𝐸𝑞. 1]    

𝑘 =  ∆𝑓𝜏                                                                                                                                                            [𝐸𝑞. 2]  

 

𝑇!" =  2𝑅𝑣                                                                                                                                  [𝐸𝑞. 3]  

 

Page 5: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

DDS Implementation of Linear FM Waveform: A linear FM waveform with spanning from 30 kHz to 50 kHz is implemented on an Arduino Due using direct digital synthesis (DDS) concepts. To implement a DDS system, an array of sinusoid amplitude data is created. Each sample of the array will be referred to as a phase index. The phase index can be incremented at various clock rates to create different sinusoidal frequencies. The amplitude of the sampled phase index is output to the digital-to-analog converter (DAC) to create a quantized sinusoid waveform over time. To understand linear FM waveform generation, it is important to know the relationship between frequency, phase, and chirp rate. Equation 4 relates frequency and chirp rate with respect to time. Equation 5 relates phase and frequency with respect to time.

𝑓 𝑡 =   𝑘  𝑑𝑡                                                                                                                                        [𝐸𝑞. 4]

𝜙 𝑡 =   𝑓 𝑡 𝑑𝑡  = 𝑓 𝑡 | !!! +𝑘2 𝑡

!                                                                                            [𝐸𝑞. 5]

In a digital system, integration can be represented as a discrete series accumulation. Equation 6 relates frequency and chirp rate for a DDS system. To achieve a linear frequency response, the chirp rate must be a constant value. Equation 7 relates phase and frequency in a DDS system, where the variable ‘𝑓!"#$"’ is the starting frequency of the frequency accumulator, and the variable ‘𝑓(𝑘)’ is the frequency accumulator output dependent on the chirp rate ‘k’.

𝑓 =   𝑘                                                                                                                                                    [𝐸𝑞  6]

𝜙   = 𝑓!"#$" + 𝑓 𝑘                                                                                                                  [𝐸𝑞. 7]

Combining Equations 6 and 7, the phase ‘𝜙’ required to approximate a linear chirp waveform can be written in terms of the chirp rate as shown in Equation 8.

𝜙 = 𝑓!"#$" + 𝑘                                                                                                                    [𝐸𝑞. 8] Note that the phase is represented as a double accumulation of the constant chirp rate 'k'. The phase accumulator output increases quadratically upon each clock increment. The output frequency of the waveform increases linearly from the beginning frequency ‘𝑓!"#$"’ to the end frequency ‘𝑓!"#’. The DDS system block diagram to create a chirp waveform is shown in Figure 2. The chirp signal is implemented in software using two index accumulators in series (analogous to the double integration of the chirp rate). The initial accumulator represents instantaneous frequency and the following accumulator represents instantaneous phase. The sample rate ‘𝑓!’ is the rate at which the accumulators are incremented and the DAC output is updated. Each accumulator increment will be referred to as a clock interrupt. The amplitude resolution of the Arduino Due DAC is limited to 12 bits.

Page 6: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

Figure 2: Chirp Waveform DDS Block Diagram

For a DDS system, the output sinusoidal frequency is dependent upon the DAC sample rate ‘𝑓!’ and the n-bit resolution of the phase indices. The output frequency can be calculated according to Equation 9  [!]. The tuning variable ‘M’ represents the number of phase indices that will be incremented upon each clock interrupt. In other words, ‘M’ is the rate at which the sample clock increments through one cycle of an n-bit LUT.

𝑓!"# =𝑀 ∗ 𝑓!2!                                                                                                    [𝐸𝑞. 9  (𝐹𝑟𝑜𝑚  [1])]

For example, consider the system shown in Figure 3 with sample rate 𝑓! = 1 Hz and sinusoid phase resolution of 4 bits, indicating that there are 16 possible phase indices. If the phase indices are incremented by M=1 at each clock interrupt, then the output frequency is calculated to be:

𝑓!"# =1 ∗ 1 𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑒𝑐𝑜𝑛𝑑

16 𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑐𝑦𝑐𝑙𝑒

   =116  

𝑐𝑦𝑐𝑙𝑒𝑠𝑠𝑒𝑐𝑜𝑛𝑑

If the phase indices are incremented by M=2, then the output frequency is calculated to be:

𝑓!"# =2 ∗ 1 𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑒𝑐𝑜𝑛𝑑

16 𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑐𝑦𝑐𝑙𝑒

   =216  

𝑐𝑦𝑐𝑙𝑒𝑠𝑠𝑒𝑐𝑜𝑛𝑑

Page 7: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

Figure 3: 4-bit Sinusoid Resolution, 𝑓! = 1, Varying Rates of M

If the phase accumulator index exceeds the index array length, then the phase accumulator is reset and any remainder increment will be added to the phase accumulator. The tradeoff of doubling the value of ‘M’ is that there will be half as many sample points per cycle of the output waveform, thus introducing more quantization error. Now consider a system with sample rate 𝑓! = 500 kHz and a sinusoid resolution of 32 bits. If the desired output frequency from the DAC is 30 kHz, then the tuning variable ‘M’ can be calculated as:

𝑀 =30000 𝑐𝑦𝑐𝑙𝑒𝑠𝑠𝑒𝑐𝑜𝑛𝑑 ∗ 2!" 𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑐𝑦𝑐𝑙𝑒

500000 𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑠𝑒𝑐𝑜𝑛𝑑

   =  257698037.76

There are two issues with the previous example. The first problem is that 4 billion data samples of resolution would require large amounts of flash memory to store. The second problem is that an ‘M’ value containing a decimal value will not always increment to an integer number, meaning the phase index after the ‘M’ increment may be rounded. Both issues are addressed using a process called bit truncation. If the flash memory of the Arduino Due cannot hold 2!" (4 billion) samples of data, then it is more reasonable to only define a sinusoid for 2!" (32768) samples of data. The phase accumulator, however, will still have 32 bits of precision. The phase accumulator is truncated to the 15 most significant bits before being sent to the DAC. By truncating the 32 bit result to 15 bits, any decimal value of ‘M’ that is added to the phase index will also be truncated. An integer value will be sent to the 12-bit DAC.

M  =  1  M  =  2  

Page 8: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

To create a linear frequency sweep from ‘𝑓!"#$"’ to ‘𝑓!"#’, the value of the phase increment ‘M’ must increase upon each clock interrupt. The value by which ‘M’ must increase after each clock interrupt to create a linear frequency sweep is calculated in Equation 10, where ‘𝜏’ is the chirp waveform duration, and the phase accumulator has an n-bit resolution. ‘𝑀!"#$’ is analogous to the chirp rate of the DDS implementation.

𝑀!"#$  =  𝑓!"# −  𝑓!"#$"

𝜏 ∗2!

𝑓!!                                                                                                            [𝐸𝑞. 10]

Equation 11 represents the value of ‘M’ over time, where ‘𝑖’ is the number of clock interrupts that have occurred since the accumulation was initiated. Equation 12 represents the 32-bit phase accumulator index over time, where ‘𝑖’ is the number of clock interrupts that have occurred since the operation was initiated, the symbol ‘%’ represents the modulus operation, and the phase accumulator is defined over n bits. The series operators of Equation 11 and Equation 12 use the same indices, ‘𝑗’ and ‘𝑖’, to show that they accumulate synchronously. Equations 11 and 12 continue to accumulate until the value of ‘M’ has surpassed the value of ‘M!"#’, at which point the chirp waveform will end transmission or repeat transmission. ‘M!"#’ corresponds to the desired end frequency ‘𝑓!"#’. The number of clock interrupts ‘L’ required to accumulate from ‘M!"#$"’ to ‘M!"#’ is calculated in Equation 13.

𝑀 = 𝑀!"#$" +   𝑀!"#$ ∗ (𝑗 − 1)!

!!!

                                                                                 [𝐸𝑞. 11]

𝜙 =   𝑀!"#$" +   𝑀!"#$ ∗ 𝑗 − 1!

!!!

∗ 𝑙 − 1!

!!!

   %  (2!)                                  [𝐸𝑞. 12]

𝐿 =  𝜏 ∗ 𝑓!                                                                                                                                        [𝐸𝑞. 13]

Software Limitations: For a chirp waveform ranging from 30 kHz to 50 kHz, the minimum waveform duration achievable is approximately 100  𝜇𝑠. The chirp waveform with 100  𝜇s duration has approximately 4 sinusoid cycles to cover the frequency range from 30 kHz – 50 kHz, meaning that quantization noise will have a larger effect on the waveform. The maximum sample rate 𝑓! achieved using the Arduino Due to implement the linear FM system is 500 kHz. The maximum phase resolution achieved is 15 bits or 32768 samples per period due to RAM limitations. The transmitter chirps from 30 kHz to 50 kHz at a sample rate of 500 kHz. The sample rate 𝑓! required to satisfy the Nyquist rate (𝑓! > 2𝑓) is achieved.

Page 9: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

To find the approximate signal-to-quantization-noise (SQNR) range of the chirp waveform output from the Arduino Due, a 50 kHz continuous sinusoid is generated on the Arduino Due and the FFT is displayed on the DSO-X 3024A oscilloscope. The 50 kHz sinusoid is used for testing because it is the maximum desired frequency output, meaning that it will demonstrate the maximum DAC quantization noise of the system. The DDS continuous waveform has the following characteristics: 12-bit DAC amplitude resolution, 15-bit sinusoid phase resolution, and a DAC sample rate of 500 kHz. The SQNR of the 50 kHz sinusoid ranges from approximately 43.75 dB (maximum spurious peak) to 67.5 dB (minimum spurious peak). The minimum SQNR of the 50 kHz sinusoid is shown in Figure 4.

Figure 4: Spectral plot of maximum SQNR 50 kHz waveform

Efficacy of Ultrasonic Noise to Humans: According to the Occupational Safety and Health Administration (OSHA), it has been concluded that ultrasonic noise does not affect the general health of an individual as much as originally believed [2]. Assuming that no direct body contact is made with the transmitter, harm can only occur from ultrasonic sub-harmonics above 88 dBA (A-weighted sound pressure level) lasting for over 8 hours or a peak value of 145 dB SPL (dB relative to a sound pressure level of 20 µPa). The maximum power output of the ultrasonic transmitter is 107 dB SPL, implying that possible sub-harmonics will have even less power. According to the OSHA guidelines, there will not be any harm done to any individuals during project operation in terms of ultrasonic noise. Results: The transmitter system is connected to a single channel receiver to test the functionality of the radar system. The transmitter is driven with the chirp signal produced by the Arduino Due. The received signal is amplified and mixed with the transmitted chirp to produce a beat frequency. Figure 5 shows the transmitted chirp waveform, the received chirp waveform, and the

Page 10: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

beat waveform produced by the mixer. The speaker and microphone were spaced 53 cm apart, the frequency swept from 30 kHz to 50 kHz, and the pulse duration was 1 second.

 Figure 5: Transmitted Chirp (Yellow), Received Chirp (Pink) and Beat Waveform (Blue)

 Figure 6 shows the beat waveform and its FFT produced on the oscilloscope. A beat frequency of 32.5 Hz was measured at a distance of 53 cm. This compares well to the calculated beat frequency of 32.1 Hz expected theoretically. This shows that the fundamental waveform generation, transmitter, and receiver designs perform as expected.

Figure 6: Beat Frequency (Blue) and its Spectrum (Purple)  

Page 11: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

  The single element transmitter and single channel receiver system is tested in a mono-static configuration using a trihedral as a target. Figure 7 shows an oscilloscope screen depicting waveforms for a test performed at a separation of 1.41 m between the target and transmitter. The channel 1 waveform (yellow) is a buffered copy of the chirp produced by the Arduino Due. The chirp duration is 1 second with a frequency range of 30 kHz to 50 kHz. Channel 2 (green) is the chirp signal present at the positive terminal of the transducer, after passing through the matching network. Channel 3 (light blue) is the chirp signal present at the negative terminal of the transducer. Channel 4 (dark pink) shows the beat waveform produced by mixing the received echo waveform with the buffered chirp signal. Lastly, the spectrum (light purple) of the beat frequency is shown. A spike in the spectrum is seen at 172 Hz with a magnitude of -15.02 dBV, as shown by the cursor measurement. A beat frequency of 172 Hz corresponds to a calculated range of 1.42 m, which compares well to the actual range of 1.42 m. The large spike at the low frequency of 21.0 Hz with a magnitude of -22.22 dBV is present due to coupling between the transducer speaker and microphone in the monocratic arrangement of this test. The speaker and microphone are placed next to each other, causing appreciable coupling.  

Figure 7: Oscilloscope Screenshot for Mono-Static Test with Trihedral Target at 1.41 m

separation

Page 12: Ultrasonic Transmitter Implemented on Arduino with …arizona.openrepository.com/arizona/bitstream/10150/596454/1/ITC... · Ultrasonic Transmitter Implemented on Arduino with Direct

The described test is performed again at a distance of 4.20 m. Figure 8 shows oscilloscope waveforms from this test. With the exception of target range, the test configuration is identical. The oscilloscope channels correspond to the same waveforms as the previous test.

A spike in the spectrum is seen at 515 Hz with a magnitude of about -35 dBV. A beat frequency of 515 Hz corresponds to a calculated range of 4.25 m, which compares well to the actual range of 4.20 m. The speaker/microphone coupling is seen once again, this time with more power than beat frequency. This was the furthest testable distance with this configuration.

These two tests show the fundamental operation of the single element transmitter and single channel receiver system and verify the integrity of the design. This also shows the value of using a trihedral target.

 

Figure 8: Oscilloscope Screenshot for Mono-Static Test with Trihedral Target at 4.20 m separation

 References [1]     Analog  Devices.  (2009,  10  08).  Fundamentals  of  Direct  Digital  Synthesis  (DDS),  Rev.0.       Retrieved  from  AnalogDevices:  http://www.analog.com/media/en/training-­‐       seminars/tutorials/MT-­‐085.pdf  [2]                Occupational  Safety  and  Health  Administration.  (2013,  08  15).  Appendix  C-­‐

Ultrasound.  Retrieved  06  20,  2015,  from  OSHA  Technical  Manual:  https://www.osha.gov/dts/osta/otm/new_noise/appendixc.pdf