# Gas station without pumps

## 2017 January 7

### Book draft 2017 Jan 7

Filed under: Circuits course — gasstationwithoutpumps @ 17:03
Tags: , , ,

I’ll be releasing an updated version of the Applied Electronics for Bioengineers text on LeanPub today.  I’ll probably raise the minimum price next week, to reflect the improved quality, but I’ll give people a few days to get the book at the old price.  (Remember that the LeanPub model allows you to get all future editions of the book free, as long as I continue publishing through them, so there is no reason to wait until a new edition comes out.)

I’ll list the changes in two sections: changes that were made since the October 2016 release, then changes that were made in the Oct 2016 release (because I don’t seem to have posted those to the blog).

#### Changes since October 2016

• Fleshed out assignment schedule and moved to Preface.
• Rearranged several of the early chapters (without significant content change) for better ordering of assignments.
• Added mention of Analog Discovery 2 to oscilloscope chapter, replaced some Bitscope traces with Analog Discovery~2 traces.
• Added bonus frequency response activity to pressure sensor lab.
• Added Lego-brick pictures for the optical-pulse-monitor lab.
• Revised all chapters and labs from the microphone chapter to the EKG lab (the second half of the course).  Many of the changes were minor revisions (typo fixes, indexing, changing to numbered exercises, spell check).
• Added exercises to the microphone chapter and moved some exercises from the microphone lab to the microphone chapter.
• Moved some of the oscilloscope introduction from the microphone lab to the sampling lab.
• Rewrote DC analysis of microphone to use function generator, rather than potentiometer, for variable voltage.
• Added R+L figure to loudspeaker chapter, rather than referring to impedance chapter.
• Moved inductor description to new chapter just before loudspeakers.
• Added RMS power exercise and R-L plot exercise to loudspeaker chapter.
• Moved some intro amplifier material from preamplifier lab to pressure-sensor lab, reflecting change in order of labs.
• Moved some instructions about color coding wiring from preamplifier to an earlier lab.
• Added mention of using earbuds instead of loudspeakers for preamplifier lab.
• Redid Miller plateau oscilloscope trace using Analog Discovery 2, using smaller gate resistor to get higher speed.
• Added cross-section of a power nFET (still needs to be redrawn)
• Fixed clipping on several schematics (the Vdd power symbol gets clipped if at the top of the schematic—a known bug in SchemeIt).
• Put inductive load in the single-nFET driver schematic, including flyback diode.
• Added explanation of why the crude model for computing slew rate is so far off.
• Removed most references to obsolete AOI514 nFETs (using NTD4858N nFETs instead).  This required gathering new data to characterize the transistors.
• Redid the section on open-collector outputs for LM2903 comparators.
• Added table of conductivity for NaCl solutions.
• Added section on 4-electrode conductivity measurements.
• Moved information about nulling ohmmeters when measuring resistance from electrode lab to loudspeaker lab.
• Reiterated some of the EKG safety info in the EKG lab.

#### Changes between April 2016 and October 2016

• Added more background to first chapter (logarithms, picture of complex plane) and started chapter numbering at 1 instead of 0.
• Rearranged chapters for new lab order, with all the audio labs after the pressure sensor and optical pulse monitor.
• Updated information on using lead-free solder.
• Added a generic block diagram to lab report guidelines, and added definition of “port” to the block diagram discussion.
• Added subsection on Thévenin equivalent of voltage divider.
• Added section on series and parallel connections to resistance chapter, to reflect lower prerequisite expectations of course.
• Moved some gnuplot exercises into thermistor lab from sampling and aliasing, to reflect new lab order, also moved PteroDAQ installation instructions.
• Added picture of metal thermometer to thermistor lab.
• Added voltmeter connection schematic to DAQ chapter.
• Moved details of PteroDAQ out of DAQ chapter to separate appendix.
• Added potentiometer schematic and photo to resistance chapter.
• Split data acquisition from sampling and aliasing into separate chapters.
• Improved figure showing aliasing and Nyquist frequency.
• Added pictures for wire stripping and flying resistors to sampling lab.
• Added scaffolding for oscilloscope probe exercise.
• Hysteresis measurement changed to use function generator.
• Moved multi-stage amplifier discussion to beginning of amplifier chapter and beefed it up.
• Added introduction to differential amplifiers before instrumentation amps and op amps.
• Added pH meter block diagram to beginning of amplifier chapter.
• Moved discussion of clipping to the end of the instrumentation amplifier section.
• Added active low-pass filters to amplifier chapter.
• Added chapter on transimpedance amplifiers with section on log-transimpedance amplifiers and rewrote pulse-monitor lab to use logarithmic current-to-voltage conversion.
• Added discussion of absorbance of melanin, fat, and water to blood section.
• Moved the instrumentation amplifier internals to new chapter, before the EKG chapter.
• Simplified the sensitivity calculation for LEDs and phototransistors, making the exercise more productive.
• Added text to caption of microphone preamp photo.
• Moved loudness section from the amplifier chapter to the microphone chapter.
• Added notes at end of loudspeaker lab to improve student reporting of models.
• Added more safety information to EKG chapter
• Made all exercises be numbered, and changed most of the prelab questions into numbered exercises.
• Added equipment-needed lists to the beginning of each lab.
• Redrew several block diagrams using draw.io, and added captions to several figures to indicate what drawing tool was used.
• Changed caption formatting to be more distinctly different from body text.
• Cleaned up several schematics.

## 2017 January 2

### LM2903 open-collector comparator characterization

Filed under: Circuits course — gasstationwithoutpumps @ 18:02
Tags: , , , ,

In Last power-amp lecture, I posted an I-vs-V plot for the LM2903 comparator’s open-collector output, which I had made sometime in 2013, I think:

There are two regions of operation for the open-collector output of the LM2903. In the saturation region, the current goes up slowly with voltage (as about V^0.15, while in the “linear” region, it goes up as about V^1.5). The transition occurs when VOL is about 0.25 V, so we are almost always in the saturation region.

I decided to redo the plot using the Analog Discovery~2, as I now include the open-collector curve in the textbook (in an optional section, since we no longer use open-collector comparators). I used a 12V wall-wart and both the function generator and oscilloscope functions. I used the “custom channel” and XY plot features to get the I-vs-V plot on the screen (though I saved the data and replotted with gnuplot, to superimpose different runs). I also averaged 10 sweeps to reduce noise.

R1 was 56Ω for testing high voltages and currents, and R1 was 2.2kΩ for testing low voltages and low currents.

The triangle-wave generator and the nFET makes a variable load for the comparator, from slightly more than R1 up to about 1MΩ.

Even up to 11V, the LM2903 collector stays below the 20mA maximum current, but I’d want to make sure that there was some current-limiting resistor for any power-supply voltage above 12V.

The results with the Analog Discovery 2 are much cleaner than my old results, which were most likely done with an Arduino, which has a very low resolution ADC.

## 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.

## 2016 December 27

### FET I-vs-V with Analog Discovery 2 again

In FET I-vs-V with Analog Discovery 2, I plotted Id vs. Vgs curves for an nFET:

The Ids-vs-Vgs curves do not superimpose as nicely as curves I’ve measured with PteroDAQ. I don’t yet understand why not.

Yesterday, I played with sweeping the power supply (Power waveform generator).  In this post, I used that capability to plot Id vs Vds curves for different gate voltages (Vgs) of a different nFET (since the AOI518 is an obsolete part).  The setup is the same as for the previous test—the function generator is connected to the gate, the power supply to the drain load resistor in series with the nFET whose source is connected to ground, and the two oscilloscope channels monitor the voltage across the load resistor and across the nFET.  The difference is that I use the power-waveform option to put a 1Hz triangle wave on the power supply, but put just a DC offset (AC amplitude 0V) on the function generator output, so that the gate voltage is constant as the drain voltage is adjusted.

The saturation regions are well plotted up to Vgs=2.7V. I averaged 10 or 20 scans for each of these curves, to reduce quantization noise for small voltages or small currents.

I got quite different results when I removed and replaced the nFET from the breadboard—the breadboard contacts seem to have a variation of about ±0.05Ω in resistance, which is much larger than the on-resistance of the nFET when fully on. I took measurements with a wire between the source and drain to estimate the wiring resistance, but wiggling the wire produced very different results.

In the next graph, I tried subtracting off the wiring resistance to get the on-resistance, but I’m really quite dubious about the measurements smaller than 0.5Ω, because of the unrepeatability of the bread board contact resistance.

The numbers here look good (close to the spec sheet), but repeating the measurements could result in ±0.1Ω, which makes the Ron measurements for fully on transistors rather useless.

By using a smaller power resistor, I could probably get saturation currents for slightly higher gate voltages, up to the current limit of the power supplies in the Analog Discovery 2, but better on-resistance measurements would require a better jig for making low-resistance contacts to the FET.

By using a much larger resistor, I could measure low currents more accurately, which would give me a better idea of the leakage currents—I don’t really believe the measurements for Vgs=2.1V, because the current appears to decrease with increasing Vds, which is probably an artifact of measuring a small difference in voltage with a large common-mode signal.

I tried using larger resistors to measure the saturation currents, but the results varied a lot depending on what size load resistor is used. I believe that the difference is due to temperature changes from self-heating. If I sweep out to larger Vds voltages (using a smaller load resistor, hence smaller IR drop across it), but about the same saturation current, I’m dissipating more power in the transistor, so making it warmer. This appears to increase the saturation current. Reducing the range of the voltage with the same load resistor drops the curve down, just as increasing the load resistor does. I suspect that proper measurement requires a jig that holds the transistor at a nearly constant temperature, as well has having very low contact resistance.

The saturation current seems to vary by about ±10% as I change load resistors. The effect is most likely thermal—note that using a smaller voltage sweep for Vgs=2.3V and Rload=51Ω resulted in almost the same curve as Rload=270Ω, because the power dissipated was about the same.

Note that the thermal explanation also works for explaining why the superposition does not work well for the Id vs Vgs plots—at lower load resistances, more power is dissipated in the transistor, and it gets warmer, shifting the current curve upward.

## 2016 December 16

### Two-electrode vs. four-electrode impedance spectroscopy

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

Four electrodes with 1cm spacing.

Today I decided to revisit the water-conductivity experiments for the course, now that I have an easy way to do proper impedance spectroscopy (including phase information as well as magnitude), using the network analyzer function of the Analog Discovery 2 USB oscilloscope. I wanted to look at 4-electrode measurements, as well as the 2-electrode measurements we’ve done in the past.

First, I made myself a 4-electrode device, by cutting some ⅛” stainless-steel welding rod (316L rod for TIG welding) into 15cm pieces, drilling 4 ⅛” holes in a scrap of cutting-board plastic, and driving the rods through the holes with a hammer.

I then immersed the short end in tap water (using a mason jar, so that the long end stuck out the top) and used alligator clips to attach wires from the electrodes to a breadboard.

I connected the function generator through a series 1kΩ resistor to one of the end electrodes and ground to the other end electrode.  Channel one of the oscilloscope measured the voltage across the 1kΩ resistor (hence the current in milliamps).

Channel two of the oscilloscope was connected to either the two end electrodes (making a 2-electrode measurement similar to what we’ve done for years in the class), or to the two middle electrodes, for a 4-electrode measurement.  The idea of a 4-electrode measurement is that there is an electric field established in the bulk material by the outer electrodes, and the middle electrodes can measure that field without interference from surface effects that occur on the electrodes that are providing the current.

I used the network analyzer function to sweep from 2Hz to 10MHz.  I exported the data so that I could plot it as impedance (rather than as just the dB ratio of the two measured voltages).  For the 2-electrode measurement, we are measuring the impedance of the water and electrodes (voltage across the electrodes divided by the current through them), but for the middle electrodes, we’re looking at the voltage across the middle electrodes, divided by the current through the end electrodes.

The voltage across the middle electrodes is nearly a constant, up to about 1MHz, where wiring inductance starts to matter. The surface chemistry interferes with measurement of bulk properties at low frequencies for the 2-electrode measurement.

The plot of the phase shows even better why 4-electrode measurement is useful:

The capacitive nature of the two-electrode system is seen at low frequencies, but the 4-electrode system has a resistive, nearly 0° phase shift (up to the point where the inductance of the wiring to the reference impedance starts to matter).

I don’t think I’ll switch to 4-electrode measurements this year (if for no other reason than that I’d have to make a dozen new electrode sets), but I’ll keep it in mind for next year.

Next Page »

Blog at WordPress.com.