# Gas station without pumps

## 2013 February 7

### Thirteenth day of circuit class and first op-amp lab

If you’re wondering what happened to the 12th day of circuits class, that was discussed in Quiz too long and too hard. On Wednesday, I did some do-now problems to check on some basics and to provide a hook for the day’s topics.  I asked for the voltage gain (Vout/Vin) for the following circuits:

First question: a voltage divider they are familiar with, and which almost everyone got right.

A different voltage divider circuit, stressing the fact that voltage is between two points. Only about half the class got this, because I had not given enough examples of voltages other than to ground. Students who had the correct answer had two different ways of getting there: starting from Ohm’s Law, or simple proportional reasoning. I pointed out that a third way would be to compute the voltages of the two voltmeter leads using the voltage divider formula.

A reminder of the one op-amp circuit they’d seen (last Friday). Only about half the class remembered this one, so I did another derivation of it using a finite-gain amplifier instead of an ∞-gain op amp, showing what happens as gain goes to infinity. I think that I should do more of that, since many of the students are uncomfortable with infinity.

A hook for the main material of the day: non-inverting amplifiers. Only one student correctly guessed the gain of this circuit (one of the top students in the class—I think he “cheats” by reading the assignments when they are assigned to be read—I wish more students would do that).

After reviewing the unity-gain buffer, but before getting into the non-inverting amplifiers, I made a digression into what would happen if we swapped the two inputs to the unity-gain buffer.  Doing the algebra for the gain computation with a finite-gain amplifier and taking the limit, we again get a solution where the output voltage is equal to the input voltage.  I then stepped them through what would happen if there was a small perturbation in the input, which does not result in the amplifier settling down to the new value, but keeps getting bigger until the output slams into one of the power rails.  I used this to discuss positive feedback and the difference between a stable and an unstable design, but did not give them any tools for analyzing stability other than hand-simulating what happens if you add a small perturbation to the input.

Finally I got to the non-inverting amplifier, and stepped them through the reasoning behind the gain computation.  I think most of them followed it, though some are still disturbed that the voltage divider in the circuit has “Vout” and “Vin” labels reversed from how they are used to thinking of voltage dividers.  I have to wean the students away from the notion that formulas contain sacred variable names, and into thinking about them as having slots that get filled according to context.  That is, I have to have them attach semantics to the formulas, rather than relying on name-based pattern matching.

I was originally going to do inverting amplifiers as well, but I think I’ll leave those until next week.  I also decided not to have the students try to do a single-supply design for their first op-amp lab, but to use a dual-supply design, which is a little simpler conceptually.  I’ll have to rewrite the lab handout for next year, as I had originally planned to do a single-power-supply design.  I realize now that is too ambitious for the first op-amp assignment.  There was a mention in the lab handout of a DC-blocking capacitor on the output, but that is not needed in the dual-supply design, so just confused a couple of the students.

After the non-inverting op amp, I introduced them to the notion of block diagrams, and together we developed the following block diagram:

Block diagram for audio amp

We didn’t do it all at once, of course, and it took some prompting to get the various parts all there. We started easily enough with the microphone and the loudspeaker, then added the amplifier. I had to prompt them a bit to remember that the microphone was best thought of as having a current output, but that the amplifiers we knew how to design were voltage amplifiers. Since their second lab converted the microphone current to a voltage, they got the I-to-V converter pretty quickly. We tried to guesstimate the gain needed by saying we wanted the loudspeaker to swing rail to rail (±3V) on a loud input, and I asked the students what they had measured on lab 2 as the AC voltage swing. A couple of students had something in their lab notebooks. I pointed out (again) the value of keeping good lab notebooks, since you never know what detail you might need later on. We used one of the estimates to pick a gain of about 50 for the amplifier.

I then pointed out a problem: the I-to-V converter they used in Lab 2 had a 1V DC offset, and if they put that into the amplifier, they would pin the output at the upper power rail, since it couldn’t go to 50V. After a bit of reminder that DC was a frequency of 0Hz, they came up with the need for a high-pass filter, and could even remember the voltage divider circuit to get it. But figuring out the corner frequency stumped them, because none of them remembered the frequencies of human hearing. Eventually someone came up with 20Hz to 20kHz, which goes a bit higher than humans hear, but is a typical stereo specification. We only cared about the low-frequency end anyway. I pointed out that knowing what sort of signal one was dealing with was an essential part of the design process, and one of the first questions they should ask when doing a design. They eventually settled on 10Hz as a reasonable corner frequency, though anything between 1Hz and 30Hz would probably do, given that their speakers have very poor bass response anyway (they are very fine 10W speakers for about \$1 each, but they are still small speakers).

I think that I’ll continue to have the development of the block diagram as an in-class discussion (not try to put it into the lab handouts), so that the students can develop it themselves with guidance from me, rather than being handed it.  This decomposition of a design problem into smaller easily solved problems is one of the essential parts of engineering, and most of the bioengineering students have not had much experience with it.

I ordered them to pair up right away and come to lab with designs already done and ready to implement and debug. I think that too many of them have been under-prepared for labs, having just looked over the lab handouts the night before. From now on, I’m going to make sure they do some serious work on each lab before they touch wire to breadboard on it. (This will be particularly important on the last two labs, where they’ll be soldering the instrumentation amplifiers—unsoldering components is no fun at all.)

Today’s lab went great! Everyone got a working audio amplifier (generally with a gain of 40× or 50×), and could see the gain on a dual-trace oscilloscope (superimposing the signals at the mic and the output with different volts/division setting, which was particularly satisfying for showing the gain of 50).  They also observed clipping of the output with loud input signals, and the inability of the op amp to drive the 8Ω load of the loudspeaker all the way (it has only a ±23mA output capability).  I reassured them that we would design an amplifier later in the quarter capable of delivering loud sounds.

A few students came in with non-functional designs, but they were all quite close, and a few minutes of discussion at the whiteboard about how the resistors for the non-inverting amplifiers needed to be designed got them back on the right track when the circuits they built failed. I refused to look at designs until they had wired them up—I’m making “Try it and see!” the mantra for the class.  Perhaps we should put it on the t-shirts.

Some students also had a little trouble converting their schematics to wires on the board, but a little debugging and tracing wires was enough for me to point out discrepancies between what they showed me in the schematic and what I saw on the breadboard.  This was enough to get them back on track without my having to touch their boards.

I thought that this lab would be one of the toughest ones so far, but it turned out be the smoothest sailing.  Everyone finished on time with working circuits demoed!  Perhaps the op amps are not as hard as I expected for them, perhaps the design assignment the day before left them more prepared, perhaps they’re beginning to get the hang of things now after a somewhat rocky start.  Whatever the reason, I was really proud of what they managed to do today.  This is only lab 5 for them, and they are already doing more in the lab than the EE 101 students achieve by the end of the quarter!

Next week they’ll do a “tinkering” lab without a clearly specified objective, but with some strong constraints. In the course of the lab, they’ll learn about phototransistors (though not all the characteristics of them) and FETs as switches.  The lab is very thrifty, making use of the hysteresis oscillator board that they soldered up for the capacitance-touch sensor as a component without modifying what is on the board. They’ll also learn about a different style of engineering: tinkering, where one plays around with stuff to see what can be done.  I don’t think that most of them have had much opportunity to tinker in the past, and it is an excellent way to develop the mental models that allow one to reason about circuits without tedious calculations.  (Some calculations may still be needed, of course.)  Some of them may get frustrated with the  somewhat undirected nature of the play, I’ll undoubtedly get a headache from loud squealing of loudspeakers at high frequencies, and someone may burn a finger on an overheating FET, but I think that next week’s lab may be the most fun one of the quarter, and it should prepare them well for the class-D power amplifier later in the quarter.

Tomorrow I’ll start on group-work quiz corrections (the last student is taking the quiz in the morning), and have them try to finish the quiz corrections over the weekend. If the quiz corrections are problematic still, we’ll use Monday for more group work on them and possibly some Socratic lectures (they’ve had all the material they need—they just need some guidance on how to apply it).

More likely, on Monday we’ll do some work on gnuplot, so that students who need to redo one of the labs that involve model fitting will have a better handle on what they are doing.  If we do that, I’ll ask students to bring in their laptops, so that they can do some interactive work on gnuplot scripting.  I thought that the first script I gave them would be sufficient example, but I didn’t realize at the time the difficulty they would have in generalizing the example, so I’ll step them through a worked example, with them gradually building a script that does what they need. I hope to be able to address the scope-of-variables problem that I think is tripping some of them up, as well as detecting other conceptual stumbling blocks.

Although I started this week very depressed about the quiz results and having sleepless nights worrying about how to modify my teaching to get the concepts across, I’m now feeling very positive about the class.  The op amp lab went great, and I see ways that I think have a very good chance of getting the students comfortable with the material.  In about two weeks, I’ll give them another quiz (similar to the one that was so painful for everyone on Monday, with perhaps a couple of op amp questions), with the reasonable expectation that they’ll be able to nail it.

## 2012 October 23

### Rethinking the pressure sensor lab

I’ve had several posts now relating to building a shaker table and putting together a pressure sensor lab project for the circuits course:

I’m beginning to think that this lab, as I originally envisioned it, is both too much work to set up and too much work for the students. It was also beginning to look like a major spill hazard (much more so than the thermistor lab or the electrode characterization lab).

I want to back off now and see whether there is a lab that fits better into the course and is less trouble both for me and for the students.  Let’s look at the different parts of the lab, and see which are the most important—discarding the parts that are more trouble than they are worth.

• Building an audio amplifier (op amp plus one discrete transistor) to drive shaker table.
• Building an instrumentation amplifier with gain in the range 500–2000 to read strain-gauge bridge pressure sensor.
• Calibrating pressure sensor with a water column.
• Inducing pressure waves in water with shaker table, and measuring with pressure sensor.
• Making measurements at two ends of a flexible hose to try to characterize water in hose using the hydraulic analogy.

I like the idea of having students build an audio amplifier.  In fact, we were planning a simple amplifier in an earlier lab, so extending it to drive more current than the op amp chip can source is a good one.  But we don’t need to build a shaker table for that—we can buy cheap 4Ω or 8Ω speakers and have them build amplifiers for the speakers.

I definitely like the idea of having the students learn about strain gauges and build an instrumentation amplifier for them.  The \$5 MPX2300DT1 pressure sensor is a good example of a strain-gauge bridge (with temperature compensation).  We could go with the uncompensated MPX53DP for \$7.80, the \$8 MPXV53GC7U or the \$11 temperature compensated MPX2053DP.  I rather like the sturdier “unibody” packaging for the differential pressure sensors (the DP suffix), and we could attach a hose to them directly, since they have barbed ports (which look like they are designed for 3/16″ ID tubing).  I’d still want a breakout board with screw terminals for the sensor, but assembling it would be easier, since the sensor can be soldered as a through-hole component and  screwed to the PC board, eliminating the gluing I needed for the MPX2300DT1.

I’m currently leaning towards a simpler (and cheaper) setup—eliminating the shaker table, the ¾” PVC plug, and the PVC water reservoir, and just having an MPX2053DP (or even MPX53DP) pressure sensor on a breakout board.  This would discard the hydraulic analogy part of the lab, but students would still build an instrumentation amplifier, characterize the pressure with a water column (easily measured as the height of water in clear tubing), and use the pressure sensor to measure breath pressure (inhalation and exhalation).

The maximum pressure of human breath is about 25kPa or 100″ H2O, so the ±50kPa range of the differential sensor should be plenty. The MPX2053 sensor is spec’ed at 800µV/kPa with a 10V power supply, so with a 5V supply it would provide 400µV/kPa.  We probably want a 0–5V output for a -25kPa to +25kPa input, so an amplifier gain of 250 is called for.  That’s a bit less touchy than the gain of 1000 I  used with the MPX2300DT1, but will still be good warmup for the EKG amplifier (which needs higher gain and has to use two stages to avoid saturating from small DC offsets in the first stage).

The uncompensated MPX53DP is spec’ed at 1.2mV/kPa at 3v (2mV/kPa at 5V), so less gain would be needed for the uncompensated part.  If you don’t need temperature correction, then the cheaper part gives you greater sensitivity. I’ll have to think about which would be pedagogically more useful—currently I lean towards the temperature-compensated part, as a concept that they should learn and because it forces them to make a higher gain amplifier.

Building the instrumentation amp and making breath pressure measurements should only take one 3-hour lab period, rather than two, so if I go with this design, I’ll need to come up with another lab.  Perhaps a second audio amplifier lab, with an output transistor and some filtering would be a good lab to insert I have to decide whether that should be a soldering lab or a breadboard lab.  I think that the two instrumentation labs (pressure sensor and EKG) should be done by soldering on a PC board, but I’m not sure the instrumentation amps should be their first soldering projects.

« Previous Page