Gas station without pumps

2012 December 22

Disappointing power-amp lab

Today was a rather disappointing day for me.  I spent most of the day working on developing a decent power-amp lab, and I’m not happy with what I’ve got so far.  You may remember from my earlier post (Op-amp lab), that I was planning to have the students start with an AC-coupled op amp using an electret mic.  Something like this:

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.

Today I wanted to try two things: getting rid of the extra op amp that creates the Vbias supply, and adding two FETs to make a higher-power output stage .  My attempts to do the design in Circuit Lab were stymied by the  CircuitLab simulator’s inability to solve for the DC values, insisting on producing gigavolt and teravolt solutions (when it didn’t just fail with nonfinite solutions).

So I built a circuit and tested it.  I did the debugging using my BitScope Pocket Analyzer (which I blogged about already).  My initial design did not seem to be turning on the pFETs strongly enough, so I adjusted one of the bias resistors to lower the voltage needed.  That didn’t really help.  The problem seems to be that the power supplies I was using (I tried a battery pack and the USB 5v supply through the BitScope) are not beefy enough, and the voltage dropped from 5v to 3.5V whenever there was a large output, like when a loud feedback squeal was produced.  I switched to using a wall wart that claims to be able to produce 5V and 2.5A, and got the amplifier working, though the wall wart provides an annoying hum (it is not a regulated supply).

I then tried a 6.6v switching supply that I had, and it was beefy enough—beefy enough to start releasing smoke from the FETs, as I had not resized the bias resistors for the 6.6v supply.  I cut the power and let things cool down, and tested again with the 5v supply.  I had not killed the FETs (so my decision to get fairly heavy duty power transistors was probably a good one).  Here is the design I was playing with:

Design for a power amp that sort of works—as long as you don't increase the power supply voltage!

Design for a power amp that sort of works—as long as you don’t increase the power supply voltage!

I’m also seeing a lot of coupling through the power supply lines, with the switching transients from the output FETs turning on and off visible at the microphone, though the output voltages show no glitches there.

Changing one resistor in the final bias network (to keep the pFET and nFET from both turning on strongly at the same time) lets the amplifier work fine with the 6.6v regulated supply.  That supply also keeps the coupling of the FET switching noise out of the power lines: the power lines only show 1–2mV of ripple even when I have a feedback squeal that is 6v peak to peak.  The FETs don’t even get perceptibly warm.

I’m still not sure that the amplifier is working correctly, though, as the spectrum analysis of the input and output of the amplifier (one of BitScope’s features) indicates a much purer signal on output than on input.  I’m worried that my frequency response is nowhere near flat, so I’m going to have to put in a signal other than the microphone input, look at the output, and see if it is reasonable.

I hooked up my function generator with a big divide-down voltage divider in place of the mic and resistors (before the DC-blocking capacitor).  It took me some playing around with the central resistor value of the FET bias network to both eliminate crossover distortion and keep the FETs from getting hot.  The values I had calculated based on the FET thresholds resulted in crossover distortion—I had not allowed enough of an overlap with both FETs slightly on.  I fixed the problem by adjusting the central resistor—I think that this lab may be a good one for using a trimpot, as swapping out resistors on the breadboard was a pain.  Students will have to be warned to start with the central resistor too big (to ensure that both transistors are off in the middle of the voltage range) and gradually decrease the resistance until the crossover distortion goes away (but not so much that the transistors start getting hot).  They’ll want to size the other resistors so that a 10kΩ trim pot has a reasonable range.

I also tried using the Bitscope to generate signals, rather than my separate function generator.  It produces somewhat cleaner signals than the Elenco FG-500, but there is a nasty click between frames, when the BitScope is dumping data to the host computer and not sending out the waveform.

Although I have a working circuit for the power amp, it took me longer to get there than I’d like, which means that the full design project is probably too much for a 3-hour lab.  If the lab is just the output stage design, added to a working op amp design from the previous lab, it may just be doable.  We may have to do the computation of the resistors for the bias network a little more carefully than I did, which would mean carefully characterizing the I-vs-V curves for the FETs.  Perhaps there needs to be a design worksheet for the students to work through all the ramifications of class AB output stages.

The other depressing thing today (other than the rainy weather), was that I dropped one of the electrode holders off my desk.  As Gabriel Elkaim had predicted, it snapped at the neck:

What happens when you drop one of the electrode holders from a height of 3 feet.

What happens when you drop one of the electrode holders from a height of 3 feet.

I still have enough for the course, but I suspect we’ll lose a couple more during the labs this year. I’ll have to redesign to round the corners wherever I currently have a sharp corner (to eliminate stress raisers), and make the neck a bit wider as well.

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.

%d bloggers like this: