# Gas station without pumps

## 2015 May 5

### First op-amp lab was quick

Filed under: Circuits course — gasstationwithoutpumps @ 21:12
Tags: , , , ,

On Monday I provided a little feedback on the design reports for the electrode lab.  The big issues were

• Students not reporting the models they were fitting to the data.
• Students not reporting the parameters of the fits after doing the fitting.
• Students choosing overly complicated models (like R+(R||C) for data showing constant impedance)
• Students not modeling important phenomena (like the (R||C) input impedance of the voltmeters)

Little issues included

• Using “due to the fact that” rather than “because”

After that brief intro, I worked with the students to develop a block diagram for an audio amplifier using the electret microphone and loudspeaker that they had already characterized.  This had been part of their homework, but I expected them not to have really grasped the point of a block diagram.

Another thing I went over in class, because I’d seen problems with it in previous reports and prelabs ,was reminding students that V=IR is not a ritual magic incantation. Reciting it doesn’t make solutions to problems right, if it is just randomly applied.  I reminded them that the voltage has to be across the resistor that the current is through—picking random voltages or currents in the circuit is meaningless.  I showed them an example taken from the prelab they were turning in at the end of class.

When I did the grading for the prelab homework Monday night, I saw that many of the students managed to copy the block diagram we had done in class, but none had appropriately labeled the signals between the blocks.  I think I need to provide some more and better examples in the book.  (Ah, I see I already have marginal notes to myself to add a couple in Chapter 2.)

The V=IR error was very common, mostly with V was taken to be the power supply voltage, rather than the voltage across the resistor that biases the microphone.

Students also had a lot of trouble with computing the AC voltage of the signal out of the microphone, based on the loudness of the sound input and the sensitivity of the microphone. I knew this was a difficult assignment, but I thought that it would be relatively easy, because they had supposedly already created a worksheet for themselves as part of Lab 4 (the microphone lab).  Either they forgot everything they learned there, or they never really got the idea of the worksheet they created.  One student asked in class on Monday, quite reasonably, for a worked example.  I’m going to have to come up with one that doesn’t just do all the work for them—I know these students can fill out worksheets, but what I need to get them to do is to solve problems when the steps aren’t all set out for them.

The afternoon lab section (many of them working together) did much better on the prelab than the morning section—the difference between the sections has been noticeable from the beginning, but it seems to be getting bigger, not smaller.  For some reason the descaffolding is working better with the smaller section.  Individuals in the morning lab are doing quite well, but there are more floundering students in that section, and I don’t know how to get them back on track.

Even though the morning lab is struggling more than the afternoon lab, I think that both are doing better than previous year’s classes at this point of the quarter.  With only one or two exceptions, everyone in both lab sections got their op amp circuit designed, wired, and demonstrated within the 3-hour class period.  That means that Thursday’s lab can be a tinkering lab for most of the students, where they can try various ways of improving the design:

• Switching from a symmetric dual power supply to a single power supply.
• Paralleling two op-amp chips to get twice the current capability.
• Adding a potentiometer for variable gain.
• Adding a unity-gain buffer to separate the loudspeaker driver from the gain amplifier.
• Adding a tone-control circuit, like the Baxandall tone control on http://www.learnabout-electronics.org/Amplifiers/amplifiers42.  They can’t use exactly that circuit, as they have only 10kΩ potentiometers, not 100kΩ ones.  The idea can be adapted, or the students could do simple treble-cut or bass-cut circuits.
• Using a loudspeaker as a microphone. I think that should work, as I get about a 500µV signal from my loudspeaker when I talk into it.  The don’t need any DC bias for the loudspeaker mic, and they may even be able to eliminate their high-pass filter, as the loudspeaker mic can be set up to have its output already centered at 0V.

I’ll talk about some of these possibilities in class tomorrow (plus stroking the students a bit about getting the lab done quickly). I attribute he good performance on the lab to them having put in more time on the prelabs, even if they didn’t get the answers to the questions exactly right.  Thinking about the design ahead of time (and getting a little feedback) goes a long way toward clearing up confusion they have had.

There are 4 more amplifier labs coming:

• Instrumentation amps with a strain-gauge pressure sensor (measuring breath pressure and blood pressure using an arm cuff).  Will need to be 2-stage, since the INA126PA chips we are using aren’t rail-to-rail amplifiers.
• Transimpedance amplifier fora photodiode to measure pulse.  This will also need to be multistage, since the first stage will have to have limited gain to avoid saturation.  After high-pass filtering much more gain will be needed.
• Class-D power amplifier.  This is always the toughest lab of the year.  Even small mistakes can result in shoot-through current that gets the FETs hot enough to melt the breadboards (I have two breadboards that I’ve melted holes in).
• EKG using only op amps (making their own 2-op-amp instrumentation amp, plus high-pass filtering and a second gain stage.  They’ll be using all 4 of the op amps in the quad op amp package for this amplifier.

I’m about a week behind on grading redone assignments—weekends are spent grading design reports, Monday nights grading prelabs, weekends plus Tuesdays adding to the book a chapter ahead of the students, and I squeeze in the redone assignments Wednesday or Thursday night, if I don’t crash too early.

## 2014 May 9

### Low-power audio amp lab completed

Filed under: Circuits course — gasstationwithoutpumps @ 07:54
Tags: , , ,

Everyone finished their audio amps yesterday and got them working, and most finished on time, though one group took a bit longer than the rest, so I was in the lab for 5 hours instead of 3. They did not keep careful notes of how they did the prelab, and could not reconstruct their thoughts, so they were very confused about why the amplifier was clipping with the loudspeaker in place, but not when it wasn’t.  I think that they eventually figured it out, with somewhat heavier hinting than I usually like to use (I was getting tired).

Each group had a different design, as they chose slightly different voltages for the power supply, hooked up the mic with either the full power supply or half the power supply for DC bias, used different pullup resistors for biasing the mic, used different combinations of R and C for their high-pass filter, and had different target gains.  I think I should point out in class how small changes in somewhat arbitrary design choices can result in rather different designs—all of which are correct.

One problem I had not anticipated, but ought to have, is that a lot students initially chose to use small resistors and large capacitors for their high-pass filters, but the filter is in parallel with the bias resistor for the microphone for AC, so if it has a low impedance, the I-to-V conversion results in a small AC signal.  This problem was noticed when one group was confused about why their AC signal was so much lower than they had expected.  It took me a while helping them debug to figure out what was going on (I generally don’t use electrolytic capacitors unless I need to, so I’d never set up a DC-blocking filter with a low impedance).  In next year’s handout, I’ll have to put in a bit more information about the need to have the RC filter be a fairly high impedance compared to the DC bias resistor, perhaps even including it in the sensitivity computation.  After seeing the problem, I did warn each group about the problem, and they all had to redo their RC filters, as they’d all chosen large C and small R.

A number of groups also used very small resistors for their feedback loops, until I suggested that using much of the current capabilities of the op amp to drive the feedback network was not leaving them much to drive the speaker.

I’ll also have to outline the steps of the sensitivity and gain computation more carefully next year, as students were not able to do it on their own without guidance.  Almost everyone ended up with too high a gain empirically, getting clipping at the loudspeaker with fairly modest sound input, but I didn’t see mistakes in their computation, and the op amps were clipping at about the expected current limit. Perhaps the input sounds were louder than we had allowed for—certainly the signal generators driving loudspeakers that we were using as sound sources were much louder than 60dBA at 1kHz, which is what the circuits were designed around.  Students did observe that without the loudspeaker the amplifiers produced nice-looking sine waves, but that adding the loudspeaker produced the clipping—some turned up the input sound to the point where they could observe the voltage clipping without the loudspeaker.  I should add a request for testing the amplifier with and without the loudspeaker next year.

Everyone did get enough gain from their amplifiers to hear sound from their loudspeakers and to get feedback squeal if they put the loudspeaker near the mic.  Not even the quickest group had the time to add a volume control or tone control circuit, so I’ll probably cut that from next year’s lab, though I’ll probably have them do adjustable gain for the class-D amplifier in 3 weeks, if only to save our ears from high-volume feedback squeal.  I’ve been wondering whether I should include a traditional large potentiometer (and not just an 18-turn trimpot) in the kits next year, so that students can have a more easily (if less precisely) adjustable resistor.  They are only about 70¢ for cheap ones, and they would make adding a gain control easier.

Students are getting fairly good at using the Tektronix TDS3054 digital oscilloscopes for making measurements, but everyone once in a while the scopes seem to get wedged in a weird mode where they don’t respond to some of the knobs (like setting the low pass filter) and the only way out we’ve found is to run “autoset”, and then reset a number of the parameters from there.  Although the scopes have some nice features, the user interface is still one of the worst I’ve encountered, with deeply layered menus covering the screen and buttons that cycle through different modes.

Measuring anything about the amplifiers was difficult, because the ambient noise in the room, particularly of other groups talking, made fairly large uncontrolled input signals.

One thing I did not expect, and still don’t have an explanation for, is that for all the groups the output seems to have been centered a little high when the loudspeaker was in the circuit, so that the op amp was at or near saturation at +150mV output even when there was no sound input.  With the gains the students were using, that would have resulted from the input voltage being around 0.1–1mV too high, which seems to be too much for any of the explanations I’ve thought of.  I did not observe this in my testing at home, but I don’t have a ±3v power supply at home, so I did not have exactly the same circuits as the students.

One group had a 50kHz triangle-wave oscillation for a while, but it went away while we were attempting to debug it, so I never found a satisfactory explanation.

## 2014 May 7

### Quiz corrections

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

As I reported last week, students did poorly on the first quiz, which came as no surprise to me.  I had the students redo the quizzes as homework, allowing collaborative work (as long as they acknowledged the collaboration in writing).  They turned in the homework on Monday, a week after the quiz, and I returned them today.  No one aced the redo, with the top score being still only 25/33 (which would have been an A on the first pass, on a redo maybe a B+).

A lot of the students still seem to be having trouble with complex numbers—they got the formulas right when working symbolically, but then the exact same question with numbers instead of letters (which could be done by just plugging into the formulas) came out with real numbers when complex impedances were asked for.  Also, a lot of sanity checked were skipped (several people reported a battery as doubling in voltage when hooked up to a resistor, for example).

These students are not major mathphobes (they’ve all passed a couple of calculus classes and most have done more math past that), but they don’t seem to have any sense for reasoning with or about math—they just want to plug in and grind, even on simple problems like ratios in voltage dividers. This class has almost no memory work (I gave them a one-page handout at the beginning of the year with all the math and physics I was expecting them to memorize), but relies heavily on their being able to recognize how to apply those few facts.  This often requires subdividing a problem, like recognizing that a Wheatstone bridge is the difference between two voltage dividers, or that a 10× oscilloscope probe is a voltage divider with R||C circuits for each of the two impedances.

I spent the entire class today working through each problem in the quiz, to make sure that everyone in the class could understand the solution, and (more importantly) see that they did actually have enough knowledge and math skill to do the questions. Some of the students were feeling overwhelmed on the quiz, because they are not used to doing anything more than 1-step pattern matching for problems, and some of the quiz problems required two steps.  None of the quiz problems were as hard as the prelab they had to do this week, which involved 8 or more steps to get the resistor values to set the gain of the amplifier:

1. Determine the pressure level of 60dB sound in Pa.
2. Determine the sensitivity of the microphone in A/Pa:
1. Convert -44dB from spec sheet to a ratio
2. Get V/Pa sensitivity for microphone for circuit on spec sheet
3. Convert to A/Pa given resistance of I-to-V conversion resistor on spec sheet.
3. Determine voltages needed for op amp power supply.
4. Determine I-to-V resistor needed to bias microphone in saturation region.
5. Convert A/Pa sensitivity, RMS pressure level, and I-to-V resistor to RMS voltage out of microphone.
6. Determine corner frequency and R, C values for DC-blocking filter.
7. Determine maximum output voltage range of the amplifier as the most limiting of
1. Voltage range of op amp outputs
2. Power limits of loudspeaker (10W)
3. Current limit of op amp (which is a function of the power-supply voltage) into 8Ω loudspeaker
8. Determine max gain as ratio of RMS voltage into op amp and RMS voltage out of op amp (I’m allowing them to be a bit sloppy about RMS voltage vs amplitude, since we are not looking just at sine waves—the amplitude of a symmetric square wave is the same as the RMS voltage.)
9. Choose resistor values to give the desired gain.

I’m hoping that pushing them go through these multi-step designs in the lab will give them more practice at decomposing problems into smaller pieces, so that two-step problems on a quiz no longer seem daunting, but routine.

I’m going to be giving them another quiz in about a week, covering op-amp basics and the amplitude response of RC filters.  I’ve got to figure out the best time to do this—possibly a week from Friday, after they’ve done another op-amp lab (using a phototransistor to make a pulse monitor, using this handout).  I think I’ll reorder the labs after that, doing the pressure sensor instrumentation amp lab, then the class D power amp, then the EKG.

## 2014 May 6

### Audio amp lab

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

As I expected, no one came to lab today with their prelab homework done. There was a lot this week, as they needed to figure out the sensitivity of the microphone, decide how to bias it, figure out the AC voltage out of the microphone for 60dB sound input, add a DC-blocking filter (perhaps with a corner frequency above the resonant frequency of the loudspeaker), figure out when the amplifier would start clipping because it couldn’t drive the loudspeaker, determine the maximum gain for the amplifier, and determine the component values needed to implement all that.

Only one group finished  the design, built, and debugged their amplifier within the 3-hour lab time, but the rest are fairly close and will build and test their amplifiers on Thursday.  The group that finished today will probably work on adding either a volume control or a tone control for bonus points.

The MCP6004 op amps don’t really have the oomph to power the loudspeaker—with only about a 25mA output, they can’t do much more than 5mW into an 8Ω load. Even with an optimally matched load (maybe 240Ω?), they probably couldn’t output more than 150mW.

In a couple of weeks, we’ll do a more ambitious lab, in which the students will design and build a class-D power amplifier.  I’m a little worried about whether they’ll have the ability to work through the multiple stages of that design, since they were having a lot of trouble with the much simpler op-amp design. I might move the pressure-sensor instrumentation amp before the power amp, to give them more practice with multi-stage block diagrams before the power amp.

## 2014 May 5

### Block diagrams and audio amps

Filed under: Circuits course — gasstationwithoutpumps @ 21:08
Tags: , , , , ,

In today’s lecture, I introduced the notion of block diagrams as having two types of objects: functional blocks and connections between them. I emphasized that both parts were equally important, though computer programmers tended to focus more on the connections and electrical engineers more on the blocks.  I pointed out that basic action of decomposing an engineering design problem into separable subproblems was common to all forms of engineering, and so block diagrams were a common notation in almost all branches of engineering.

I also pointed out that block diagrams were only useful as a tool if they had a reasonable number of blocks (say 3–10), so that the system was broken into manageable pieces, but could still be viewed as one coherent system, not a rats’-nest of tiny components and wires.

As a class, we then developed a block diagram for and audio amplifier, starting from the overall task (sound in, louder sound out) and working our way inwards.

I spent quite a bit of time at each connection.  For example, for the sound in we talked about dB, dBA, and sound pressure levels.  I did not remember the reference value for 0dB of sound, but I have it in the lab handout (20µPa RMS).

We then talked about the sensitivity of the microphone, which we treated as a sound-to-current converter (with units being A/Pa).  I pointed out that the data sheet for the microphone we used did not give sensitivity in that form, but in dB for a reference of 1v/Pa, even though the microphone is a current output, not a voltage output device!  I explained that the data sheet used a current-to-voltage conversion of 2.2kΩ, though there is no particular reason to choose that value.  We also talked about the DC voltage or current bias needed for the microphone, which is much larger than the small AC signal.

The students realized that they needed a high-pass filter for blocking the DC, and realized (after a moment) that the voltage divider circuit meant that the input and output of the DC blocker meant that the microphone’s current output needed to be converted to a voltage.  Luckily, they’ve already designed a simple pullup resistor for current-to-voltage conversion, as well as a simple RC high-pass filter, so they should have no trouble doing so again.

We then jumped to the other end of the circuit and looked at the model for speaker.  I talked them into using the simplest possible model (just an 8Ω resistor), which is reasonable if we limit the frequency to 200Hz to 10kHz (adequate for speech, but not for music).  If we directly connected the circuit so far to the speaker, the students estimated that the signal would be less than a microwatt, so clearly not of much use for driving a 10w speaker. We also looked at the maximum voltage or current we’d want to apply to the speaker, to keep within the 10W RMS limit.

We then added a gain stage, which the students initially wanted to make a gain of about 4000.  I pointed out that voltage out of the op amp was limited to staying between the power rails, and that the MCP6004 op amps they have don’t have a very wide power supply range. I also pointed out that we did not want to exceed the current limits for the op amp, as that could clip the signals and distort them.  So they will need to choose a gain that will amplify the loudest sounds at the microphone to stay within the current limit of the op amp driving an 8Ω load.

Here is the block diagram they came up with:

Audio amplifier using an electret mic.

One student asked a very good question—what do you do if you want more sound than the maximum current from the op amp? I told him that we would address that question in a later lab: the class-D power amp lab.

I told the students to flesh out their block diagram to a detailed schematic (with component values!) before tomorrow’s lab, so that they could spend the lab time building, testing, and debugging the amplifier. I think that they will try, but they will bog down somewhere in the multi-step process of designing the amplifier. I’m guessing that half of the class will have the structure right, but that no one will get reasonable values for all the components.

I have told them that I expect them to come up with expectations for what they should see at each point of their circuit, so that they can compare what they see on the oscilloscope with what they expect, and use the discrepancies to help them debug.

Next Page »