# Gas station without pumps

## 2016 December 19

### Impedance of inductors and parasitic impedance of oscilloscope

Filed under: Data acquisition — gasstationwithoutpumps @ 01:04
Tags: , , , ,

Because the Analog Discovery 2 makes doing impedance spectroscopy so easy, I decided to do a quick check of my inductors to plot their impedance, checking the series resistance in the process.  This was just going to be a short interruption to my day of working on my book, but it ended up taking up most of the day, because I got interested in seeing whether I could determine the characteristics of the scope inputs that were limiting the performance at higher frequencies.

Here was the data I started with, after converting the dB scale to |Z|. I used a 20Ω resistor in order to get reasonably large voltages at both ends of the frequency sweep. With a larger resistor, the low-frequency measurement across the inductor was too noisy, because the voltages were so small.

The data looks fine up to 1MHz, but above that is a resonant peak, probably from the capacitance of the oscilloscope and the wiring to it.

I tried modeling the oscilloscope inputs as capacitors, but that resulted in way too sharp a spike at the resonance to match the data, so I tried a resistor in series with a capacitor. Initially, I tried modeling both channels identically, but I got better fits when I used a different model for each channel:

The resistor in series with the capacitance of the scope limits the sharpness of the resonance peak. Channel 1 was measuring the voltage across the 20Ω resistor, and Channel 2 was measuring the voltage across the inductor, so the setup is more sensitive to the Channel 2 parameters than to the Channel 1 parameters. I don’t really believe that the Channel 1 parameters fit here are correct.

It might be interesting to swap which channel is connected to which device, and see whether the R+C models still fit well, but I’ve not got the time for that tonight.   I did have some earlier data (from playing with resistor sizes) and I fit the oscilloscope models to it:

The fits here suggest some difference between the channels, but not as radical a difference as the previous plot. The 62kΩ sense resistor, though not good for determining the DC resistance of the inductor, does give a good handle on the parasitic impedance of the oscilloscope channels.

## 2015 May 3

### Ag/AgCl electrode lab went ok

Filed under: Circuits course — gasstationwithoutpumps @ 23:15
Tags: , , , , ,

Like on Tuesday, on Thursday I spent a long time in the lab, from about 9 a.m. to after 6 p.m., because it takes a fair amount of time to set up and clean up when we are dealing with liquids (in this case, salt water) in the electronics lab.  The lab itself went fairly smoothly and the students all seemed to be collecting good data.

As I feared, we ran out of one of the 4 stock solutions: 3l per concentration for 28 students was not enough, unless students shared by transferring solutions from one group to another.  Next year I’ll have to get 200ml/student made up, or change the way the lab is run so that students have 6 sets of cups already pre-poured, and just grab a cup that they haven’t already used.  I worry a bit about careless students not cleaning and drying their electrodes between uses, though and contaminating a low-salt solution with salty electrodes.

I had one surprise this year.  We changed which brand of EKG electrodes we ordered (from Vermed to some foam-backed electrode with no brand name—not a substitution I remember approving, but I probably would have if asked).  It turns out that the new electrodes do not seem to be silver/silver-chloride.  Instead of resistance around 10Ω as the Vermed electrodes have, the new ones are in the 10MΩ range.  They must be using some polarizable electrodes instead of non-polarizable Ag/AgCl.  I hope that they work ok for the EKG lab at the end of the quarter (10MΩ should be ok, as the instrumentation amps and op amps have input impedances of 1GΩ and 10TΩ respectively, so a mere 10MΩ resistance should be negligible).

I am going to have to rework a big chunk of the book this summer, though, as the measurements ran into trouble with the input impedance of the voltmeters not being too large to matter, as we usually assume.  The AC voltmeters claim to have 1MΩ  || 100pF, which is great at low frequency but at 1MHz, that’s only 1.6kΩ.  The 1MΩ is tightly specified, but I believe that the 100pF is only an upper bound: there may be considerable variation in the capacitance from meter to meter.

The students who were attempting to measure the impedance of the new foam-backed EKG electrodes were probably actually measuring the impedance of the voltmeter.  Several of the measurements of the stainless-steel electrodes were also marred by the input impedance of the voltmeters.  On Tuesday afternoon, if I have any spare time in the lab, I’ll try measuring the input impedance of the voltmeters myself, to see what it looks like.  The test setup will be a simple one: two voltmeters in series, driven by a function generator.  I’ll shunt one of the voltmeters with a smallish resistor (say around 500Ω) and plot the ratio of the two voltages as a function of frequency (I’ll need a moderately high voltage from the function generator to make sure that the voltmeter on the shunt has enough voltage).  The voltage ratio should follow a simple pattern: $\frac{V_{meter1}}{V_{shunt}}=\left| \frac{Z_{meter1}}{R_{shunt} || Z_{meter2}} \right|$.  I can model the meters as a 1MΩ resistor in parallel with an unknown capacitor and fit the parameters (trying both meters having the same capacitance, and having different capacitances).  I can even do another set of measurements swapping which meter I shunt.

I think that a lot of the weird data we saw in Tuesday’s lab came from using large shunt resistors, so that the voltmeter impedance became more important (smaller) than the shunt resistor.

I’m considering also putting in the book a derivation of how to compensate for the meter impedance (if it is known).  I think that I’ll move the electrode lab later next year, closer to the EKG lab, so that we can go more directly from the microphone lab and the loudspeaker lab into the audio amplifier lab, and so that the electrode characterization is more immediately motivated.

In Friday’s lecture, I talked briefly about the possibility that the problems we were seeing with model fitting were that we had neglected the voltmeter input impedance, but I did not work out the details, because I had to introduce them to op amps and negative-feedback amplifier configurations.

I like to use a generic negative-feedback configuration, which includes inverting and non-inverting amplifiers as special cases, as well as the single-power-supply variants:

Generic negative-feedback amplifier design using op amps.

On Friday we got through the derivation of the various gain formulas, based on letting the open-loop gain go to infinity, but I’ll have to refresh that on Monday and introduce the unity-gain buffer: especially the unity-gain buffer as a voltage source for a reference voltage between the power supply rails.

## 2015 April 29

### More model fitting in lecture

Filed under: Circuits course — gasstationwithoutpumps @ 22:05
Tags: , , , , ,

Today’s lecture was all about fitting models for the electrode data. I started by showing them how one could hand-sketch Bode plots, at least for RC and RL circuits.  We did a hand plot and a gnuplot plot for the $R_{s} + (R_{p} || Z_{c}(C))$ model with arbitrary values, showing the initial horizontal $R_{s} + R_{p}$, the final horizontal $R_{s}$, and the diagonal at $\frac{1}{2\pi f C}$.

In class I went through trying to do fits to data collected for stainless-steel electrodes, and showing how to debug various problems (it was all live-action plotting—I did not script my actions).  The biggest problems were getting very bad fits (in one case from taking the log of the function but not the log of the data, in another case from having bad initial values) and singular matrices (mainly from having variables in the function that didn’t affect the fit, though in some cases from trying to fit complex models to real data without taking absolute value of the complex model).

It turns out that the standard R+(R||Z_C) model is very hard to fit to the data we collected for the stainless steel electrodes.  The oxide coatings don’t leak much current, so we had no low-frequency plateau for estimating the parallel resistance from.  I suggested making the parallel resistance infinite and using a simple R+Z_C serial connection.  That can model the data well at high frequencies, where the change in |Z| is fairly small, but at low frequencies the model is poor.

I came up with a different model on the spur of the moment (not one I had ever tried before on electrode data): $R + \frac{1}{j \omega^\alpha D}$ with a capacitor-like element having a smaller slope that the normal 1/f slope of a capacitor (about 0.6).  This turned out to fit the data quite well.  I don’t have a convincing physical explanation for the exponent α, but I suspect it has to do with diffusion times for ions near the surface of the electrode and depletion regions in the electrolyte.

In the new model, the R term probably corresponds to the bulk properties of the electrolyte solution and the $\frac{1}{j \omega^\alpha D}$ term to the surface chemistry at the electrode, so 1/R should be proportional to the concentration of the NaCl, I think.  I wonder whether students will get that result in their fits.  I’m thinking that I should rewrite some of the book to incorporate this model.

I ended by trying to model some of the data collected by students that did not work well—they had a huge inductance uptick at high frequency (fitting nicely to something like a 3mH inductance).  I’ve no idea how they got that data, as I saw their setup and they couldn’t have had more than a few µH of stray inductance.  Other students had small upticks at the high frequencies that were almost certainly stray inductance, since moving the voltmeter leads to connect directly to the electrodes eliminated the uptick, which did not happen with the students whose data I tried modeling.  I showed students how to model the uptick with an additional inductor, but I really don’t know what went wrong with the student data—I didn’t see any problems with their setup or recording, so I can only assume we all missed something.

Some of the students at least are getting the idea that modeling is not forcing your data to fit the theory in the book, but looking for regularities in the data.

## 2015 April 28

### First half of electrode lab a bit long

Filed under: Circuits course — gasstationwithoutpumps @ 20:47
Tags: , , , ,

Monday’s lecture went fairly well—I used my post  Comments for class after grading as lecture notes, and pretty much covered everything, though not necessarily in the order presented there.

Today I spent a long time in the lab, from about 9 a.m. to after 6 p.m., because it takes a fair amount of time to set up and clean up when we are dealing with liquids (in this case, salt water) in the electronics lab.  I have to make sure that everything is in secondary containment tubs, so that nothing gets spilled.  (It irks me that the EE faculty don’t bother enforcing the clearly posted “no food or drink” rule on their students, and I’ve had to chide several EE students coming into the lab with cups of coffee and open bowls of food—I often see drink containers in the room trash.  I spend hours making sure that my students don’t spill anything, but the EE students routinely spill their drinks (judging from the mess on the never-cleaned floor.)

I did two demos today: one planned, one unplanned.  The planned demo was of vernier calipers, which the students used to measure their stainless steel electrodes.  The unplanned demo was of what happens if you pass a large current through a salt solution.  I considered that grade-school chemistry (I’m sure I was in grade school when I took two carbon rods from inside batteries and passed a current through them, measuring the amount of H2 and O2 that bubbled off—I even looked at the difference between AC and DC (initially by using Al foil on a turntable to do the switching, but 33rpm (0.55 Hz) was still too high a frequency to get any electrolysis, and I had to switch to a DPDT switch and a watch to manually get something like 0.1Hz to get small amounts of electrolysis. OK, I admit that was a science-fair project (6th grade? 7th?) to measure the amount of electrolysis as a function of frequency, but electrolysis was not a strange subject for middle school students.

No one in the morning class had any idea what would happen if you passed a current through a salt solution, and I couldn’t even get guesses.  In the afternoon class, I badgered the students a bit more and finally got someone to realize that H2 would bubble out, and (after a bit more badgering) got them to predict which electrode this would happen on. With 6V and a 1A limit, I got vigorous bubbling (about 0.6A current drawn), and the other electrode produced a yellowish color in the solution (probably an iron oxide).

Note: all but one or two of these students have taken at least a year of college chemistry that included a full quarter on electrochemistry, but they had never seen a demo of the H2 reaction, despite it’s being the standard reaction of defining half-cell potentials. (Most of them had seen the reaction before, since it happens in gel electrophoresis boxes all the time and nearly all of them have done gel electrophoresis in biochem labs, but not one of them put 2 and 2 together and realized what was going on.)

What prompted the electrolysis demo was students asking why the readings kept changing on their ohmmeters when they tried to measure DC resistance. I tried through socratic questioning to get them to realize that the ohmmeters work by measuring the voltage across the device under test while passing a known current through, and that passing a DC current through an electrode will result in chemistry on the surface of the electrode, changing the electrode properties. I got some groups as far as realizing that there was a current, but no one seemed to realize that having a current meant there must be redox reactions taking place on the surfaces of the electrodes, changing the surface properties.

Did I already mention that almost all of these students have had a quarter of electrochemistry? I wonder what (if anything) is taught in that class! I’ve never taken it, so I’m relying entirely on what I learned in grade school and high-school—I would have thought that a college-level class would have more than what I recall from a high-school sophomore class in the 60s.

The rest of the lab went fairly smoothly, but a number of students saw a change in the behavior of their electrodes at high frequencies. This was unexpected (I’d not see the effect in my versions of the experiments), so I spent some time debugging the problem. I’m pretty sure that the problem was long wires—the students were getting a series inductance added to their electrodes. About 1.5µH would be enough in some cases to cause the observed phenomenon, though in other cases a much larger inductance would seem indicated. For one student, I suggested hooking up a voltmeter right at the electrodes rather than at the other ends of the wires to the electrodes—the saw a 2-fold reduction in voltage at 1MHz, which pretty much cancelled their apparent increase in impedance. We’ll discuss the problem in class tomorrow, and I’ll suggest modeling the electrodes not with just the standard R+(R||C) model but with L+R+(R||C), with the extra L corresponding to the long wires in their test setup.

We used up about half the salt solutions a colleague had made for me, and we’ll use up the other half on Thursday. It seems we need at least 110ml/student, so next year I’ll probably want to get 150ml/student or even 200ml/student, so that we don’t run out. Today we characterized stainless steel electrodes (which are highly polarizable) and on Thursday we’ll characterize Ag/AgCl electrodes (which are non-polarizable). So I’ll have another long day in the lab on Thursday.

## 2013 June 10

### Chapter 23 homework

Although my son has taken both the AP Physics C: E&M exam and the SAT2 Physics exam already, we haven’t finished the Matter and Interactions book yet, so we’ll keep going over the summer to finish off the last 3 chapters (23: Faraday’s Law, 24: Electromagnetic Radiation, 25: Waves and Particles).  He read the chapters before taking the exams but has not done any exercises or labs for them yet.

Chapter 23 includes inductors, so we’ll probably do some inductor labs, looking at current in response to a step change in voltage and perhaps making an LC oscillator.  I have some 220µH inductors, so we should be able to do current changes slow enough to track with the Arduino data logger and make an audio frequency oscillator.  We may try winding our own air-core inductors with different core diameters, and measure the inductance in several ways (say by fitting a time constant to the current change, with a frequency measurement of an LC oscillator, and by nulling a bridge circuit comparing to a known inductance).  We’ll probably also do some sort of eddy current demo (dropping a magnet through a copper tube, for example).

Homework exercises for Chapter 23:  23P29, 23P30, 23P32, 23P34, 23P35, 23P38, 23P40, 23P42, 23P43, 23P45, 23P46, 23P47, 23P51, 23P52.

Next Page »