# Gas station without pumps

## 2012 June 25

### Op-amp lab

Since the thermistor lab seems to have worked fairly well (see More musings on circuits course: temperature lab, Buying parts for circuits course, Temperature lab, part2, and Temperature lab, part 3: voltage divider), I decided to try doing some op amp circuits today, to see how things worked.  I want to get to the point where I can build a simple EKG, to see if that is feasible for a first circuits course.

My playing with the op amps today reminded me why I always hated breadboards: the components are always coming loose, and I spent a lot of the time trying to figure out why things weren’t working as I expected—most of the time it was a resistor or wire not making good contact, though occasionally I had an off-by-one error in inserting a wire.

Building a op amp circuit with MCP6002 chips was a little harder than I expected—the single power supply means that you need to bias the inputs to be in the middle of the range, to avoid clipping.  My attempts to use the op amp to read EKG signals were a complete bust, so I went back to a simpler, stronger signal source: the electret microphone from the Oscilloscope practice lab.

I got amplification easily enough, but I had trouble with clipping.  After a while, I realized that the electret mic was not acting like it was a 2.2kΩ resistor, like I thought it ought to from the 2.2kΩ output impedance spec. I did a series of measurements putting a potentiometer in series with the electret mic and measuring the resistance of the potentiometer and the voltage across it (being careful to remove power before switching to resistance measurement). I then fit both a constant-resistance model and a constant current model to the data. I think that modeling the electret mic as a constant current source is a much better model than treating it as a resistor, for DC analysis.  This might be a useful exercise to have students do along with the oscilloscope practice lab, as multimeter practice.

The voltage across a resistor in series with the electret mic is much better modeled by treating the mic as a constant current source, rather than as a constant resistance.

Since the electret microphone behaves mostly like a current source, I wonder what the 2.2kΩ output impedance on the spec means. Are there any real electrical engineers reading this blog who can explain the output impedance of an electret microphone with an FET output stage?

If I want to have the output of the electret mic be in the middle of a 5.121v range (that is with a DC bias of 2.56v), I’d want a 13.8kΩ series resistor.  I tried using a 12kΩ pullup resistor, and it put the voltage a little above the mid-point, as expected.

My initial efforts to use this signal as the input to an op-amp amplifier worked fine with a unity-gain amplifier (output directly fed back to the negative input), but whenever I tried to set a reasonable gain with a voltage divider, I got serious clipping.  I finally realized that the voltage divider used for clipping had to have its bottom end tied to the center voltage, not ground (all the book examples use symmetric power supplies, so that ground is the center voltage).  I made a bias voltage supply by using a voltage divider and a unity-gain amplifier, and hooked up the feedback voltage divider to the bias supply, rather than to ground. That worked fine, and I could even use AC coupling on the amplifier input with a blocking capacitor, if I added a large resistor to the bias supply for the positive input pin.

Working amplifier circuit with bias supply and AC coupling for the input.
The circuit also works with DC coupling (removing R5 and replacing C1 with a wire).
Circuit drawn and simulated with Circuit Lab.

Once I got all the biasing issues straightened out, the op amp worked as expected (except when I jostled a wire or component loose). I did not measure the gain carefully, but it does appear to be about 6.7, as expected from the design.