Gas station without pumps

2014 May 10

Second op amp lecture

Today’s lecture was the second one on op amps, after their audio amp lab.  I had 3 topics I wanted to cover: virtual grounds, transimpedance amplifiers, and gain-bandwidth product.  The gain-bandwidth product doesn’t really fit with the others, but they had just learned about voltage and current limitations in the audio-amp lab, and the only signals they use all quarter of high enough frequency for the gain-bandwidth product to matter are the audio signals—the heartbeat and breath pressure signals are very low frequency (DC to 20Hz bandwidth).

Before getting to the electronics part of the content, I did talk a little about the reasons I gave them such a long multi-step computation for the prelab last week, where they had to work through 8 or 9 steps to come up with the desired gain.  I explained that I knew they could do single-step problems, but that the quiz showed that they were having trouble putting their knowledge together to do two-step problems, so by giving them practice with long multistep problems, I was hoping to make two-step and three-step problems seem simple. Next week’s optical pulse monitor lab will again require a lot of steps, mostly in figuring out how much light gets through a finger.  This sort of computation (how big a physical signal is, how sensitive a sensor is, and how much gain is needed to observe and record the signal) is fundamental to the sensor interfacing that is the heart of the course, so I’m not apologizing to the students for the complexity of the task.

I started with virtual grounds, pointing out that next week’s lab would be powered off the KL25Z processor boards, which provide only 2 voltages: 3.3v and ground, so that they don’t have a symmetric power supply.  I drew a schematic for a non-inverting amplifier (gain 11, though that was irrelevant), with a 1.65v “virtual ground”, then we talked about how to get a 1.65v source.  I took the time to tell them about the existence of low-dropout voltage regulators, (LDOs)  and that those chips were how the KL25Z board produced 3.3v from the 5v power that came over the USB line.  I also told them that the LDO chips were capable of sourcing current, but not really capable of sinking current.  (I’m actually not sure whether they are incapable of sinking current—it would be possible to design a chip capable of both, with a small voltage change between the two directions of current flow to avoid excessive flow-through current.  I don’t think that chips normally have that capability, though.) I also told them that they did not have an LDO ship in their parts kits,  and challenged them to come up with another way to generate 1.65v from 3.3v.

Deer-in-the-headlights look.

After a fairly long wait, I asked them if they could produce 1.65v if they did not need to draw any current from it.

Deer-in-the-headlights look.

After a lot of random guessing, someone finally guessed “voltage divider”.  (I’ve told them almost every week that we have three concepts in the class: voltage dividers, complex impedance, and negative-feedback op amps, and they’ve been guessing voltage divider for almost every circuit question for 6 weeks, so I was surprised at how hard it was for them to see when a voltage divider would actually be appropriate.)  Once that guess was made, they quickly came up with two equal resistances.  I then showed them why sourcing or sinking current would cause the voltage to vary (by showing mismatched currents through the two resistors—I don’t know whether any of them got it though, as they seem to still be almost incapable of mapping any sort of math to the phenomena the math models).  I challenged them then to come up with a way to provide the same voltage but allow current to be drawn.  This took less time than before, with a student deciding that an amplifier was needed and remembering the unity-gain buffer from last week.

I was expecting students to have more trouble with the unity-gain buffer than with the voltage divider, because they’ve been using voltage dividers for 6 weeks, and this is the first time they’ve needed a unity-gain buffer. But it seems that recency trumps repetition in student thought—they are so inured to cram-and-forget learning strategies fostered by “unit-based” course organization that each new idea displaces all previous ones.

Almost all the useful ideas came from one student, though most of the class was participating. I’m worried that only that student is learning the material, and that I’m not reaching the rest.  (His group is usually the first to finish in lab also, no matter whom he is partnered with.)

After we had a virtual ground circuit consisting of a voltage divider and unity-gain buffer (and I reminded them of how the unity gain buffer worked), I pointed out that this virtual ground circuit was limited in the amount of current it could source or sink by the current capabilities of the op amp, which they had already encountered in seeing the difference in their audio amplifier outputs between having the 8Ω loudspeaker and not having it as a load.  For the MCP6004 chips they are using, with a 3.3v power supply, the current limit is about 15mA.

I also introduced them to another sort of voltage reference, using a Zener diode in place of the lower resistor in the voltage divider.  I think that this was a mistake though, as I may have confused them by giving them too much information.

After the virtual ground, I switched to talking about gain-bandwidth product.  I pointed out that the gain they had been getting was limited by the voltage rails and current limitations of the op amp, but that there was another limitation that affected the audio amplifier: a built-in low-pass filter that limited the open-loop gain.  I explained that the filter was there to prevent high-frequency oscillation due to stray parasitic feedback, but I did not even attempt to explain phase changes and oscillation—we’re sticking with amplitude for almost all analysis in this course, as their understanding of complex numbers is shaky enough that even that is stressing their skills.  I plotted the gain vs frequency on a log-log scale, which looks exactly like the low-pass RC filters they have seen already (at least in the range of frequencies they’ll use—there is usually a second-order effect with a steeper rolloff at frequencies above where the gain is less than 1).  I pointed out that the sloping line was proportional to 1/f, so that the gain times the frequency was constant (the gain-bandwidth product). For the MCP6004 chips, the gain-bandwidth product is 1MHz.

The gain of a negative-feedback amplifier is limited by the open-loop gain, so at 20kHz, their amplifiers could not produce a gain higher than 50.  I explained then the notion of multistage amplifiers, where each stage provides part of the gain (and possibly other functions, like filtering, level changing, or current-to-voltage conversion) as a way around the gain-bandwidth-product limitation.

We then switched to transimpedance amplifiers.  I first broke down the word into “trans-” and “impedance”, and explained that the “trans-” prefix here meant output/input (so opposite sides of the amplifier).  Since these are bioengineers, they are used to the “trans-” prefix from chemistry.  I asked them for the definition of impedance, and got the voltage/current definition from them after a few false starts.  So a transimpedance amplifier is one that provides a voltage output from a current input, and its gain is expressed in Ω (that is, volts/amps).

I pointed out that the pullup resistor in the microphone circuit that they had been using was a current-to-voltage converter, but that the voltage across the microphone varied with the current.  The microphone needs a nearly constant DC voltage across it, but the current fluctuations (around 1µA) were small compared to the DC current (around 200µA), so the voltage across the mic was nearly constant.  The devices they’ll be using next week (photodiodes and phototransistors) have essentially 0 current in the dark, so the signal is not a small fluctuation on a large DC current.  If we want to keep a nearly constant voltage across a photodiode or phototransistor, we can’t use a simple pullup.

So the transimpedance amplifier is needed not just to convert current to voltage, but to hold the bias voltage constant as the current changes.

I then tried to get the students to develop the transimpedance amplifier design from an op amp using the design goals. I started by asking them about the inputs of the op amp, trying to get them to remember that the negative-feedback circuits tried to bring the negative input to the same voltage as the positive input.  They’ve not had enough practice with op amps yet to have that useful rule of thumb easily recalled, so we ended up deriving it again.I started with asking them about what a bare op amp did.  It took a while before someone could come up with amplification of the difference between the two inputs.  I asked them what the gain was (looking for answers like “a lot” or “the open-loop gain”), but again got deer-in-the-headlight looks.  I ended up feeding them the answer to this one, as I ran out of Socratic questions to lead them to a good answer, and their guessing started getting wild.

I then asked them what keeping the output well within the power rails implied about inputs.  This took a while, but eventually one student realized that the difference has to be the output divided by the open-loop gain. (And yes, it was the same student.) So I was able to point out that a very large open-loop gain meant a very small difference in the input voltages, and that one could use as a rule of thumb that the inputs to an op amp in a negative feedback circuit was at the same voltage.

This got the student to the point where they figured out that the bias voltage could be put on the positive input and the current input whose voltage needed to be controlled on the negative input, but then they stalled again.  I pointed out that op amps were designed to have essentially no current through the input pins (about 1pA for the MCP6004 chips at room temperature), so the current on the input had to come from somewhere.  I don’t remember now whether a student suggested a connection to Vout or whether I gave them a resistor to Vout as a solution.

I then tried to get the students to figure out the behavior of the transimpedance amplifier from the current through the resistor.  They needed to realize two things:

  • That the voltage drop across the resistor was Vout-Vm
  • That the current through the resistor was the same as the current through the input port.

It took them a long time to get each of these—they kept wanting to make the voltage drop be just Vout. Physics classes do not seem to be doing a good job of getting across that notion that voltage is always a difference between two nodes in the circuit and I haven’t been able to make that an automatic response yet after 6 weeks—that must be a harder concept than I would have thought.

Even after they finally got the voltage drop right (yes, it was the same student), no one could come up with the idea that the current had to be the same as the current through the input.  I finally had to give it to them, pointing out the hint on the board—I’d drawn both currents with arrows on the board and had labeled them both “I”.  I reminded them of Kirchhoff’s Current Law, and pointed out that since no current flowed through the op-amp any current through the input port had to also be flowing through the resistor.

We then had the final formula: V_{out} = V_{p} + R I, and I could point out that the gain of the transimpedance amplifier was just the feedback impedance, R.  Since we were out of time at this point, I just mentioned two applications of transimpedance amplifiers they might have heard of—the nanopore lab and the nanopipette lab (where many bioengineers do their senior theses) both use very high gain transimpedance amplifiers (patch-clamp amplifiers) to measure currents in the 1–100pA range.

On Monday I’ll have to go over photodiodes and phototransistors, and probably repeat the transimpedance amplifier with a photodiode or phototransistor as the current source. I did direct them to do the prelab homework over the weekend, since we can’t afford to waste the entire Tuesday lab time doing the prelab as they did this week.  I’ll ask them on Monday about what results they got and where they bogged down in the computation—I expect that most of them will not have completed the prelab assignment, but I’ll be very disappointed if none of them have tried it.



%d bloggers like this: