# Gas station without pumps

## 2017 September 7

### Ultrasonic transmitter and receiver impedance measurement

Filed under: Data acquisition — gasstationwithoutpumps @ 18:53
Tags: , , ,

In Ultrasonic rangefinder with Analog Discovery 2, I looked at the impedance of  an ultrasonic transmitter with the Analog Discovery 2, but I only modeled the transmitter as a capacitor, not modeling the resonances.

So today I collected new data, both for a transmitter and a receiver, using a 1nF C0G (1%) capacitor as the reference impedance, so that I could have clean data from a known pair.  I also looked at the transmitter+receiver as a network, and located the peaks of the signal transmission.  I was curious whether they corresponded more to transmitter or receiver resonances.

I could model the transmitter quite effectively as a capacitor with 4 LCR resonators in parallel.

I could model the receiver quite effectively as a capacitor with three LCR resonators in parallel.

The fitting was done with gnuplot, fitting one resonance at a time starting with the lowest frequency one, then refitting the previously fit parameters to tweak the fit. The radius of convergence for the fitting is pretty small—I needed to get the LC resonant frequency pretty close to correct before the fitting would converge. Increasing L makes the down-spike and up-spike closer together, and R controls how low the minimum gets, so I could get reasonable initial values (good enough to get convergence) without too much guessing, by plotting using the initial values, adjusting L to get the spacing between the spikes about right, adjusting C to get the resonant frequency right, and doing a rough guess that R is about the minimum value.

The peaks of the transmitter+receiver characteristic seem to correspond most closely to the minimum impedance points of the transmitter, which is reasonable when you consider that I’m driving the transmitter from a fixed voltage—the power is going to be V2/R, so power out is maximized when the impedance is lowest.  The one exception is the 331kHz peak, which seems to fall on the higher frequency of the two closely spaced transmitter resonances, and near the peak of receiver impedance. (Of course, only the 40kHz resonance of the transmitter or receiver actually gets used—the other resonances don’t provide nearly as much response in the transmitter+receiver pairing.)

Zooming in on the transmitter impedance for the high-frequency resonances, we can see that there are minor resonances that have not been modeled, but that the model does a good job of capturing the shape of the peaks. The peak of the transmitter+receiver response here falls on the higher-frequency resonance.

I did all my modeling with just the magnitudes of the signals, so it is interesting to see how well the model fits the phase response.

I got excellent matches to the phase response (even when I zoomed in on each peak), except for the low-frequency region, where the impedance seems to have a negative real part (phase < -90°).

I do have models for no resonance, single resonance, two resonances, and three resonances for the transmitter, as well as the four-resonance model. If a simplified model is needed, then it is better to take one of those fits, rather than omitting parts of the more complicated model, as each resonance affects the other parameters somewhat.
As a simple example, the receiver can be modeled as just a 739pF capacitor, but the LCR circuits contribute some of the capacitance, so 708pF gets used for the base capacitor of the model with the 3 resonances.

## 2017 July 13

### Analog Discovery 2 oscilloscope input impedance fixed

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 23:25
Tags: , ,

This morning in Analog Discovery 2 oscilloscope input impedance, I wrote

I cannot fit a model based on the input divider circuit to the data—I keep getting a negative capacitance for C9 or C8, so that they can cancel each other.  These models also make C1 around 50pF.

So I can reconcile the DC behavior (1.044MΩ is well within the ±2% measurement error of the nominal 1.04MΩ), but not the AC behavior of the scope inputs.

I must be missing something, but what?  Any useful suggestions (which don’t involve modifying the Analog Discovery 2) are welcome.

This evening I figured out what I was missing. The model I was trying to fit was the following one for the oscilloscope, with a 2MΩ resistor in series as the reference impedance:

There is a natural, internal split into an 820kΩ and 220kΩ resistance in the input voltage divider (component numbers here are for channel 1, but channel 2 is identically designed).

What I was missing was parasitic capacitance from the breadboard and scope wiring. If I model a capacitor (Cref) in parallel with the 2MΩ resistor and another capacitor (Cextra) in parallel with the scope, I can get a good fit.  I can leave all the internal resistors and capacitors at their nominal values, and fit for several different values for the trim capacitor C8:

I can get an excellent fit with Rref being only a little over 1% off and reasonable parasitic capacitance values.

### Analog Discovery 2 oscilloscope input impedance

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 11:43
Tags: ,

I have been blindly trusting the documentation for the Analog Discovery 2 that claims that the input impedance of the differential oscilloscope channels is 1MΩ || 24pF.  Yesterday, when my son was measuring the input impedance of the reference inputs of a sigma-delta ADC, we had reason for a while to doubt that claim, so I measured the input impedance in a simple way:  I put a 2MΩ 1% resistor in series with one input channel and used the other input channel to measure the voltage across the series pair. I swept the network analyzer from 10Hz to 1MHz, and recorded the voltage gain (and the phase).  The voltage gain is not well-fit by a simple (1MΩ || 24 pF) model, as the impedance does not keep decreasing.  It seems to be well modeled by a model with Rs+(Cp||Rp), though.

The reported voltage gain for Channel 2/Channel 1 is well fit by a voltage divider.

Because the Analog Discovery 2 reports gain for Channel 2/Channel 1, I had to invert the data to get it in the form I wanted for my model (I could, alternatively, have swapped the legs of the voltage divider in the model).

The phases were also well fit by the models, though I did not use the phase information in the fitting. (I tried refitting using just the phase information, but that did not change the parameters by much, nor did it visibly improve the fit of the measured phases, so I left the parameters with just the amplitude fit.)

The DC impedances are both 1.044MΩ, very close to the specified value, but the capacitor is over twice the specified value, and not directly in parallel with the resistance.  The reference resistor I used is supposed to be a 2MΩ±1% resistor, but it was part of a cheap assortment, and we’ve found these cheap assortments to often be slightly out of spec, so I’d not trust it to be better than ±2%.

The 200kΩ/800kΩ split is not very surprising, when we look at the circuit for the input divider of the oscilloscope (from the hardware reference manual):

There is a natural, internal split into an 820kΩ and 220kΩ resistance in the input voltage divider (component numbers here are for channel 1, but channel 2 is identically designed).

The appearance of the 200kΩ/800kΩ split in the model for the input impedance suggests that the trimmer capacitor C8 is not properly adjusted.  If all capacitance and resistance values were nominal, then C8 should be set to 39.59pF, to provide a flat response from the voltage divider (at the high-gain setting), producing an input impedance of (1.04MΩ || 26pF).  But C8 only has a 5–20pF range, so perhaps there are some other, parasitic capacitances that change the desired trimming.

I cannot fit a model based on the input divider circuit to the data—I keep getting a negative capacitance for C9 or C8, so that they can cancel each other.  These models also make C1 around 50pF.

So I can reconcile the DC behavior (1.044MΩ is well within the ±2% measurement error of the nominal 1.04MΩ), but not the AC behavior of the scope inputs.

I must be missing something, but what?  Any useful suggestions (which don’t involve modifying the Analog Discovery 2) are welcome.

## 2016 December 30

### Ultrasonic rangefinder with Analog Discovery 2

In Loudspeaker impedance with Analog Discovery 2, I looked at the impedance of  various loudspeakers including an ultrasonic transducer. Today I looked at shaping pulse bursts for driving an ultrasonic transmitter to get shorter received pulses with an ultrasonic receiver.  I’ve done this before using custom programs on a Teensy 3.1 board (see Ultrasonic rangefinders arrived), but I wanted to see what I could do using just the waveform generator on the Analog Discovery 2.

I measured the magnitude of the impedance of the transmitter (using either a 120kΩ resistor or a 1nF capacitor as a known impedance), then looked at the transmitter+receiver characteristics for frequencies around the resonances.  I’ve marked the peak received resonances on the impedance plot.

The impedance is approx 2.2nF, with 3 apparent resonances.

The primary resonance is around 40kHz, and is the frequency that the transmitter is designed to operate at.

There is a secondary resonance around 54kHz, though it is considerably weaker than the 40kHz resonance.

The third resonance, around 330kHz does not provide a very strong signal for the receiver.

I tried two tests using the 40.445kHz resonance. In one, I used the simple waveform generator to produce a 40445Hz square wave, then used an 8ms wait and a 148.3µs run time, to produce bursts of 6 square waves. I set the idle output to the offset (0v) and used a 5V amplitude.

In the other test, I used the same wait and run times, but used the “custom” waveform to set up a signal that inverted the last 3 of the 6 periods (so that the half periods were `+-+-+--+-+-+`. This was fairly easy to set up by generating the 6 periods, then altering them by multiplying by a single period of a square wave. I could have created much more complicated bursts, but this pattern was enough to see the capabilities of the scope.

By triggering the scope on the signal sent to the transmitter (using channel 1), I could average 1000 sweeps to get a very low-noise view of the signal. (I can trigger on the waveform generator itself, freeing up one of the scope channels, but then I can’t average—I think that the averaging relies on interpolating get precise timing of the trigger.)  For plotting, I subtracted off the DC bias (fitted before time 0), as 60Hz interference caused a moderate offset to the signal even after averaging.

The bursts start out the same, but the simple 6-cycle burst results in the received waveform growing for 14 or 15 cycles, while the 3+,3- burst grows for 6–7 cycles and decays very quickly.

I tried some longer and shorter bursts, with the expected result that longer bursts resulted in stronger signals with a longer received burst width. Doing 8 cycles followed by 8 cancelling cycles seemed to produce a reasonable length burst with a fairly strong signal, but I did not explore variants much.

I still think it might be possible to use the phase information to get higher resolution than the approx 7.9mm wavelength, but identifying which pulse of the return waveform is which remains a problem, particularly if there is a complicated reflecting surface that superimposes several differently delayed pulses.

## 2016 December 28

### Headphone impedance with Analog Discovery 2

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 22:41
Tags: , , ,

In Loudspeaker impedance with Analog Discovery 2, I described measuring the impedance of loudspeakers with the network analyzer function of the Analog Discovery 2. In this post, I looked at some new Panasonic headphones that I got myself for Christmas (Panasonic RP-HJE120-PPK In-Ear Headphone, the best-seller on Amazon and the same model my son has, though in a different color).

I have figured out how to use the Waveforms 2015 software a little better now, so I can compute the magnitude of impedance as an extra column in the output (using the “Custom One” optional calculated channel).  This cuts down slightly on the missing metadata from the data files, though I really wish that they would do a dump of the instrument settings as comments at the beginning of the file.

The headphones had essentially the same curves whether in the ear or not in the ear, so I am just plotting the in-ear electrical characteristics.

The headphones are fairly well fit by a simple model: a resistor in series with an inductor.

Zooming into the audio region shows surprisingly little variation in the impedance over the whole audio range. There is a small resonance peak around 2.6kHz, but it is small and broad, nothing like the resonance peaks of loudspeakers.

I had some problems with repeatability of measurements, with curves jumping 0.5Ω up or down, but preserving their shape. I think that the problem is with poor contacts in the breadboard I was using, as I had the same problems earlier characterizing nFETs. The resonance peak around 2.6kHz corresponds roughly with the peak of information content in speech, so slight enhancement there is probably perceived as improved audio quality over a completely flat spectrum. But the enhancement here is tiny, so it may just be the result of flattening the spectrum as much as feasible.

The noise in the measurements probably reflects the small signal levels—I had an 18Ω resistor in series with the 16Ω headphones, and an amplitude of only 25mV across the pair, which gives me only 8.3mV RMS at the headphones.  That means that only 4.2µW of power is being used to generate the sound.  Panasonic claims a sensitivity of 96dB/mW, so 4.2µW should be about 72dB SPL (remember that dB is $10 \log_{10}$ of a power ratio, and $10 \log_{10}$ of an amplitude ratio). The 72dB seems about right for the loudness.  The headphones can supposedly handle 200mW, which would be 119dB—easily loud enough to cause permanent hearing loss.  Perhaps I should have students test their preamplifiers with earbud headphones instead of loudspeakers—the 24mA limit would give 9mW, which would be quite loud in a headphone.

The R+L model does not fit at high frequencies all that well, and the phase relationships are not what one would expect of a pure R+L model:

The phase only gets to 60°, while a true inductor in series with a resistor would have reached 90° and done so somewhat sooner.

Overall, I’m impressed at how flat the impedance is over the audio range. I don’t know how good the headphones are acoustically (especially as my hearing seems to be really down in the 4kHz–8kHz range—signals seem louder to me at 9kHz than at 5kHz), but I’ve no complaints about them so far.

Next Page »

Create a free website or blog at WordPress.com.