Gas station without pumps

2016 August 20

Using 4¢ diode for log-transimpedance

In Transimpedance pulse monitor does need low-pass, I realized that Schottky diodes were not going to work well for the transimpedance amplifier, and in Using nFET body diode for log-transimpedance, I tested using the body diode of a power nFET, finding that it worked quite well over at least 7.5 decades (from 1nA to 40mA).  But I wanted to see whether students could use a cheap 4¢ general-purpose diode.

I used the same setup as when testing the nFET body diodes.  The results were pretty much the same whether I used a 1N914B or 1N4148 diode (they share a datasheet, but the 1N914B has somewhat better constraints on the forward voltage):

The gain (in mV/dB) is about 85% larger than using an nFET body diode.

The gain (in mV/dB) is about 85% larger than using an nFET body diode.

Note that at currents over about 1mA the diode current starts to saturate, deviating from the exponential pattern.

Note that at currents over about 1mA the diode current starts to saturate, deviating from the exponential pattern.

When I tried using the 1N914B diode in the same log-transimpedance amplifier as I used for the nFET body diode, it didn’t work—I got output that looked nothing like a pulse (nor like 60Hz interference). I could recover proper behavior by putting a large (100nF) capacitor in parallel with the diode, to make a low-pass filter to remove signals above a few Hz, but that wasn’t necessary for the nFET body diode (perhaps it had enough internal capacitance to do the filtering). I could reduce the capacitor to 100pF, with 60Hz interference coming in, though not being too bad, but reducing to 10pF gave me noise again rather than the pulse signal.

I was hoping not to need that extra capacitor, because the design is already more complicated than I would like for this stage of the course, and figuring out what capacitor to use is difficult—trial and error is easier than rational design here!

I tried tracking down the big, short (less than 250µs) spikes that were corrupting the signal. The first thing I tried cleaned up the problem entirely: disconnecting the power supply from the laptop so that the USB power was coming from the laptop battery rather than the power supply . That this worked actually surprised me, since the 3.3V supply and the 1.65V Vref both had beefy bypass capacitors.

I don’t know whether the noise problems are in the microcontroller (which is providing the regulated 3.3V from the noisy USB 5V) or are coupled into the analog circuit some other way. Putting a 10µF capacitor from the USB5V to GND did not help when the power supply was connected, so perhaps the problem is radiated from the power-supply cable rather than conducted through the USB cable.

I’ve noticed problems before with noise from the laptop power supply causing problems in my analog circuits (the 90kHz interference in my ultrasound experiments), and I’ve see much bigger problems with some of the cheap Windows laptops students use. The bottom line, I guess, is that  I have to tell students to run PteroDAQ from battery power, not switching-supply power, even if the power supply seems more than adequately bypassed.

2016 August 19

Redoing impedance test for tiny loudspeaker

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

In Ultrasonic rangefinder tests with tiny loudspeaker, I tested the 10mm CDM-10008 loudspeaker and found it ringing around 9.4kHz, but I reported

I don’t see any resonance around 9.4kHz in the impedance plot, though I admit not looking for narrow resonance peaks in that range.

Today I redid the impedance tests using a 10Ω sense resistor, so that I could use the same range for all voltage measurements, resulting in more correct impedance measurements.  I could definitely hear a resonance around 9.5kHz (and given my deafness at high frequencies, it must have been very loud indeed for me to hear it so clearly), so I looked for another peak in that neighborhood.  It is there and measurable, but not very prominent in the plot:

Because the second peak is on the sloping part of the plot and quite small, I had to model the loudspeaker with a j ω^α L semi-inductor to get a good fit.

Because the second peak is on the sloping part of the plot and quite small, I had to model the loudspeaker with a j ωα L semi-inductor to get a good fit.

I have not attempted to fit the data points past 200kHz, because I don’t believe that the multimeter I was using is really good at those frequencies.  The “corner frequency” I’m reporting around 100kHz is where the DC resistance is equal in magnitude to the impedance of the semi-inductor.

Given how small the peak is on the |Z| graph, but how loud the sound is around 9.5kHz, I probably need a different way of looking for resonances beyond the main one. I can’t rely on my ears for loudness at high frequencies, but perhaps I could use a microphone and record the amplitude it sees as a function of frequency.

2016 August 18

Ultrasonic rangefinder tests with tiny loudspeaker

Filed under: Data acquisition,freshman design seminar — gasstationwithoutpumps @ 23:31
Tags: , ,

I’m still working on doing the ultrasonic rangefinder project  (In More testing for ultrasonic rangefinder, I gave a digital filter and showed it working 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 and amplifier. In Ultrasonic rangefinder without amplifier, I tried seeing if we could use the transducers without an amplifier. In Ultrasonic rangefinder with loudspeaker, I tried using a midrange loudspeaker to generate the pings (but was limited to about 20kHz.)

For the past couple of days I’ve been working with a tiny (10mm) loudspeaker, to see if I could get to higher frequencies without a resonant transducer, so that I could play with doing spread-spectrum pings that can be deconvolved to get more precise and more accurate measurements of echoes. I expected the 8Ω loudspeaker to be much less efficient than a resonant transmitter, but beyond that I had few preconceived notions of how well it would work.

Here is the front of the CDM-10008 10mm loudspeaker.

Here is the front of the CDM-10008 10mm loudspeaker.

Here is the back of the loudspeaker, with the two solder points visible on the bottom.

Here is the back of the loudspeaker, with the two solder points visible on the bottom.

Soldering the leads on was more difficult than I expected. I started out putting the loudspeaker face down on the bench and approaching it with the wire and soldering iron, but the loudspeaker jumped off the bench and stuck to the iron—I’d forgotten that the soldering iron tip really does contain iron, and that the magnet for the tiny loudspeaker is unshielded. After sticking the loudspeaker into a Panavise board holder, I had no trouble soldering on the leads.

Here is the loudspeaker with wires soldered on, and a female header with some double-ended male header pins to make it easier to attach to a breadboard.

Here is the loudspeaker with wires soldered on, and a female header with some double-ended male header pins to make it easier to attach to a breadboard.

The first thing to do (after checking that the leads weren’t shorted) was to measure the impedance as a function of frequency, using a voltmeter, a 100Ω series resistor, and a function generator. I was working at home, so I used a Fluke 8060A multimeter that I bought used on e-bay (which replaced my old 8060A that had failed). Unfortunately, the “new” meter is not much better, as the different voltage ranges seem to have radically different calibration. I used one range consistently for the loudspeaker voltage, and another consistently for the resistor voltage, so the shape of the curve should be ok (up to 300kHz), but |Z| may need to be shifted up or down by as much as 20%.

The resonant peak at 1340Hz is consistent with the datasheet, which specifies 1200Hz with a range from 960Hz to 1440Hz. They specify the power output for the speaker in the range around the resonant peak, which gives an exaggerated view of the response elsewhere.

The resonant peak at 1340Hz is consistent with the datasheet, which specifies 1200Hz with a range from 960Hz to 1440Hz. They specify the power output for the speaker in the range around the resonant peak, which gives an exaggerated view of the response elsewhere.

I tried driving the loudspeaker directly from pins 16 and 17 of the Teensy LC, which I had configured for high drive, with the setup() routine containing

    CORE_PIN16_CONFIG |= PORT_PCR_DSE;
    CORE_PIN17_CONFIG |= PORT_PCR_DSE;

I also put a 10Ω resistor in series with the 8Ω loudspeaker, to limit the current demanded of the I/O pins (though still far more than they are supposed to deliver). With this setup I got about ±1.6V between the pins, ±860mV across the resistor (so ±86mA), and ±670mV across the loudspeaker. The loudspeaker voltages showed spikes, but the resistor voltages were fairly clean square waves, even with 100kHz square waves.

I then made an amplifier for the electret microphone, keeping the gain per stage low to avoid the 1MHz gain-bandwidth limit of the MCP6004 op amps. With a gain of only 10 per stage, I should have a bandwidth close to 100kHz.

Here is the schematic for my test fixture. I looked at the microphone and speaker signals with both my Bitscope oscilloscope and at the microphone signals with the Teensy ADC.

Here is the schematic for my test fixture. I looked at the microphone and speaker signals with both my Bitscope oscilloscope and at the microphone signals with the Teensy ADC.

I started out looking a some complicated pulse patterns that I had designed to have high energy in the 20kHz–50kHz range, but a low autocorrelation other than at 0s. These pulse patterns should be good for the spread-spectrum tests I wanted to make. I was disappointed, however, in not being able to see the patterns in the recordings from the microphone, so I switched to a simpler stimulus—a single short pulse.

Short pulses seemed to trigger a resonance in the loudspeaker at about 9.4kHz, though short pulses resulted in an initial higher frequency mode being excited.

Short pulses seemed to trigger a resonance in the loudspeaker at about 9.4kHz, though short pulses resulted in an initial higher frequency mode being excited.

Each of the plots were made by averaging about 3 dozen traces recorded by the Teensy, to reduce noise. I found that I had to unplug the power supply from the laptop that was providing the USB power, as I otherwise got a lot of 90kHz noise.

I don’t see any resonance around 9.4kHz in the impedance plot, though I admit not looking for narrow resonance peaks in that range. I was a little worried that it might be related to the high-pass filters in the amplifiers which had a corner frequency near there, so I redid the tests with different filters, changing the 330pF to 680pF, so lowering the corner frequency to 4590Hz. The impulse response is much the same:

The signal is a little stronger with the high-pass having a lower corner frequency, but otherwise not changed much.

The signal is a little stronger with the high-pass having a lower corner frequency, but otherwise not changed much.

Note: the signal visible before the sound arrives is probably due to electrical noise from the loudspeaker coupled through the power supply,as it appears as the pulse is shut off.

Unfortunately, this little loudspeaker does not seem to be usable for the spread-spectrum sound production that I had hoped for, as the 9.4kHz ringing is definitely going to corrupt any high-frequency waveform I try to impose.

The ringing the loudspeaker is larger than for the ultrasonic transducer, so we’re actually getting more sound, but the transducer takes much less current, and I’ve not attempted to compare efficiencies.  Both ring for 1–1.5ms, which is too long for what I wanted to do.

2016 August 15

Using nFET body diode for log-transimpedance

Filed under: Data acquisition — gasstationwithoutpumps @ 21:20
Tags: , , ,

In Transimpedance pulse monitor does need low-pass, I realized that Schottky diodes were not going to work for the transimpedance amplifier, but I didn’t have any ordinary silicon signal diodes to test with.  I’ve previously used the base-emitter junction of bipolar transistors for log amplifiers, but I decided this time to test the body diode of an nFET.

I spent a fair amount of time trying to measure the V-vs-I characteristic over a fairly wide range (though only with low currents).  I ended up using several tricks:

  • using several different sense resistors to measure the current
  • censoring the data so that very low differential voltages across the sense resistor are not plotted
  • using unity-gain buffers to provide sufficient drive for the analog-to-digital converter (essential when using large sense resistors)
  • using low-pass filters after the unity-gain buffers to try to reduce 60Hz interference (not entirely successful for the largest sense resistor)
  • doing fitting to estimate the effective input offset of the differential analog-to-digital input for the voltage across the sense resistor (mainly from the unity-gain buffers)
Here is the test fixture I used. (I reduced the noise a bit more on the 5.6MΩ run by increasing the low-pass filter resistors to 2.2kΩ, but that made things worse for the 120kΩ sense resistor.)

Here is the test fixture I used. (I reduced the noise a bit more on the 5.6MΩ run by increasing the low-pass filter resistors to 2.2kΩ, but that made things worse for the 120kΩ sense resistor.)

The result of all this care was one of the cleanest logarithmic response plots I’ve collected:

I have over 7 decades of data here, and the log fit is excellent over the whole range.

I have over 7 decades of data here, and the log fit is excellent over the whole range.

Measuring down to 1nA on a breadboard is not easy, as the 60Hz interference is a big problem.

I fitted the slope of the log curve by alternating between fitting the offset using the 4.7Ω data and the slope using the 120kΩ data (the 5.6MΩ data seemed a bit too noisy to me). I collected several other sets of data but the plot was too cluttered when I tried to include them, so I kept just enough to get good overlap between the ranges. I’ve got a good logarithmic fit here for about 150dB, and it looks like I could go another 20dB higher (though thermal effects might start mattering above 0.1A).

The equivalent resistance at the bottom of the current range is about 150MΩ and about 14Ω at the highest current I measured with (47mA). Because the equivalent resistance varies so much, the corner frequency of the low-pass filter made by putting a 680nF capacitor in parallel to the diode also varies a lot (17kHz@14Ω, 1.6mHz@150MΩ).

I tried using the body diode in the same minimally filtered circuit as I used for testing the Schottky diode, and got usable results in even in moderately low light:

The 60Hz noise is huge, but can be filtered out digitally.

The 60Hz noise is huge, but can be filtered out digitally.

Brighter light makes the 60Hz noise be smaller (probably because the capacitive coupling introduces a current which is a smaller fraction of the total current), but does not change the strength of the filtered signal. When I switch to very bright light (a 650 lumen bike headlamp right against the finger), then the signal gets stronger, but I had to shift the bias voltage down to 1.65V, as the DC bias on the diode got to 0.55V or more.

So the question still plaguing me: can I use a log-impedance amplifier as the second amplifier lab, given that low-pass filtering is essential?

Putting the filtering in the second and third stage is simpler than putting it in the transimpedance stage, as the corner frequency is independent of the light level then.  It is sufficient to put the RC filter in just the second stage, as long as the attenuation at 60Hz is sufficient—I found that about 48dB attenuation was enough, though with just one RC element that distorts the pulse signal also, since the corner frequency has to be very low (0.24 Hz), below the 1–2Hz of the pulse.  If I do low-pass filtering in both stages, I could use 3Hz cutoffs, which preserves the interesting part of the signal.

Doing two stages of low-pass filtering with 1.06Hz and 1.17Hz cutoffs provides enough suppression of the 60Hz interference that I did not need digital filtering. In medium light, I got a signal large enough to saturate the third stage (so I’d need to redesign with lower gain).  With 1.6Hz and 2.6Hz cutoffs, the signal is still much larger than the 60Hz noise, and less distorted by the filters.  The pulse shape is still more dependent on the filters than on the actual signal from the transimpedance amplifier, which is almost a sawtooth (hence having high-frequency components that are removed by the filter).

If the 60Hz interference is small enough that the amplifiers don’t saturate, I can eliminate it by aliasing (sampling at 60Hz, so I’m at the same place in the interference waveform on each sample). But if the 60Hz interference is too large, then the signal is clipped and aliasing can’t recover the pulse signal.  So digital filtering is definitely optional here—students can get good results with just analog  filters and aliasing.

Alternatively, we could look at just the transimpedance amplifier output, and use digital filtering to clean up the baseline shifts and 60Hz interference.  The biggest problem is that the PteroDAQ sparkline looks like a constant—the fluctuation of a few mV is only visible once the data has been plotted on a larger scale.

 

2016 August 13

Transimpedance pulse monitor does need low-pass

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 18:16
Tags: , , ,

In More thoughts on log-transimpedance for pulse monitor lab, I wondered

I’m wondering now whether I can have students do a log-pulse monitor without bandpass filtering—just high-pass to get rid of the DC signal from overall illumination.  Given the new position of the lab in the course, as the second amplifier lab, I don’t really want to get too tricky with RC filtering.  The “gotcha” that was a problem before is that I had to remove short glitches in the very first stage, to avoid the bandpass filter lengthening them into things that looked like pulses—I don’t want students to have to do that sort of debugging on their second amplifier lab. If I can eliminate the hardware bandpass filters, and just have them use software ones, then the lab becomes more feasible.

I was also concerned that the Schottky 1N5817 diode I had tested did not have provide gain at low currents—the low threshold voltage for Schottky diodes is a disadvantage in this application. So this morning I wired up a log-transimpedance amplifier followed by a couple of op amps as inverting amplifiers.  I first tried a combined gain of 408 (which I had used before with an IR emitter as the transimpedance diode), then upped the gain to 4453. I used high-pass filters to block DC, but no low-pass filters.

The circuit was not functional without adding at least one low-pass filter (a 680nF capacitor in parallel with the diode), because the 60Hz interference saturated the amplifiers, and the smaller pulse signal was completely buried.

With the capacitor, the circuit worked fine in moderately high light, but the signal got weak in low light (due to the transimpedance amplifier having a max gain of about 35kΩ—the asymptotic equivalent resistance of the diode as current goes to 0).  With just the single capacitor for filtering, the 60Hz noise was larger than the pulse signal, but a digital filter could still recover the signal:

Notch filtering does a great job of removing the 60Hz noise from this signal sampled at 360Hz.

Notch filtering does a great job of removing the 60Hz noise from this signal sampled at 360Hz.

So it looks like I do have to have students do low-pass filtering for the pulse monitor. Can I fit that into the second amplifier lab, along with the log transimpedance, or will it all get too complicated?

Next Page »

Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 351 other followers

%d bloggers like this: