Gas station without pumps

2019 August 21

Gain-bandwidth product

Filed under: Circuits course — gasstationwithoutpumps @ 17:15
Tags: , ,

I spent yesterday afternoon collecting data for two figures for my book illustrating the limitation on gain caused by the gain-bandwidth product:

This graph shows the measured gain of non-inverting amplifiers built using the MCP6004 op amp.
It also includes a line for f_{GB}/f fit to the data for the highest-gain amplifier.

This graph compares the measured data (thin lines) to the model used in the book for amplifiers with gain-bandwidth limitations (thick yellow lines) for three of the amplifier configurations.

I did all the data collection with my Analog Discovery 2, using the network analyzer.

The data looks easy to collect, and I expected it to take me just an hour to gather all the data, but it was a bit trickier than I thought. I used a symmetric ±2.5V power supply from the Analog Discovery 2, so all the signals could be centered at 0V.

One problem was that I initially had not set the offset and gain of the oscilloscope channels to “auto”, and the output was not centered precisely at 0V. The network analyzer does not do as good a job of compensating for DC offsets as I think it should. I set the channels to automatic gain and offset and I tweaked the offset of the waveform generator by 1mV to make the output be centered correctly. I think that the 1mV offset is compensating for the offset of the op-amp chip, but it may be correcting an offset in the waveform generator.

For the high-gain amplifiers, I needed to reduce the signal from waveform generator, because the smallest signal the network analyzer allows is ±10mV, and with a gain of 393, that would cause clipping. My first voltage divider reduced the signal sufficiently, but I got very noisy results. It took me quite a while to realize that the problem was not just loose wires (though those were also a problem), but that I had used resistors that were too large, so that the input of the amplifier was amplifying capacitively coupled 60Hz noise. Reducing the input voltage divider to 1kΩ resistors solved that problem.

I was having another problem in which the shape of the curve for the low-gain amplifiers changed at the high-frequency end as I changed the amplitude of the signal. It took me an embarrassingly long time to realize that the problem was that I was hitting slew-rate limits before hitting the gain-bandwidth product limits. The high-gain amplifiers all had much lower gain at 1MHz than at low frequencies, so an input signal small enough to avoid clipping at low frequencies produced such a small output at high frequencies that slew rate was not limiting. But for low-gain amplifiers, I had been increasing the amplitude for better measurements, and the gain at 1MHz was only a little less than the gain in the passband, so I was asking for over 8V/µs, and the amplifier’s slew rate is only 0.6V/µs. I realized the problem when I used the oscilloscope to look at what the amplifier was producing, and saw that it was not a sine wave, but a small weirdly distorted signal.

After I finally got everything set up and working with small enough inputs to avoid clipping in high-gain amplifiers and slew-rate limitations in low-gain amplifiers, I finally was able to collect a consistent set of data.

The model for the op amp is that the open gain is A =  \frac{1}{1/A_0+ jf/f_{GB}} \approx  -j f_{GB}/f, and the gain of the non-inverting amplifier is \frac{A}{1+AB} \approx  \frac{1}{B}\; \frac{1}{1+jf/(B f_{GB})}, where B is just the gain of the voltage divider used as a feedback network. The model breaks down at high frequencies, because the op amp has further filtering above 1MHz, and for very high gain, where the DC amplification limit A_0 matters. We don’t design op-amp circuits to use such a high gain that the DC open-loop gain matters, but pushing the frequency limit is common.

But the simple gain-bandwidth model does a very good job of fitting the data, as long as you avoid signal levels that cause clipping or slew-rate limitations.

2019 May 22

Interaction between bias resistor and active high-pass filter

Filed under: Circuits course — gasstationwithoutpumps @ 00:02
Tags: , , , ,

In grading the preamplifier lab, I made a mistake when correcting a number of student papers.  Students who had used a bias resistor rather than a transimpedance amplifier to convert the microphone’s current output to voltage had not taken into consideration the interaction between the bias resistor and the input impedance of the next stage, which was usually an active high-pass filter.  In grading, I overcorrected the student work, changing both the i-to-v gain and the first-stage gain, when the correct action would have been to change either one, leaving the other alone.

Schematic of bias resistor and active high-pass filter. The input is the current I_in.

The passband gain for the circuit is R_b\frac{R_f}{R_b + R_i} = (R_b || R_i) \frac{R_f}{R_i}. The first version corrects the gain of the filter, while the second version corrects the gain of the current-to-voltage conversion. In my grading, I mistakenly applied the correction twice getting (R_b || R_i) \frac{R_f}{R_b + R_i}.

There are two ways to get to the correct answer: using Thévenin equivalence and from first principles.

If we replace the current input and R_b with a Thévenin equivalent, whose AC voltage is the AC component of I R_b and whose resistance is R_b, then we get a simple active high-pass filter with passband gain \frac{R_f}{R_i + R_b} for a total passband gain of R_b\frac{R_f}{R_b + R_i} and a corner frequency of \frac{1}{2 \pi (R_i+R_b) C_1}.

For those who don’t quite trust themselves to do Thévenin equivalence, we can use first principles to reason about the various currents in the schematic. The negative-feedback loop holds the op amp’s negative input to V_{ref}, and the input node has a voltage, so we get
V_{input} = V_{dd} - I_b R_b = V_{ref}-I_f \frac{j\omega R_i C_1 + 1}{j \omega C_1}
which we can rearrange to get
I_b = \frac{V_{dd} - V_{ref}}{R_b} + I_f \frac{j \omega R_i C_1 + 1}{j\omega R_b C_1}.
Because I = I_b + I_f, we get
I= \frac{V_{dd} - V_{ref}}{R_b} + I_f \frac{j \omega R_i C_1 + 1}{j\omega R_b C_1} + I_f
and can solve for I_f to get
I_f = (I- \frac{V_{dd} - V_{ref}}{R_b}) \frac{j\omega R_b C_1}{1+j\omega(R_b+R_i)C_1}.

Finally, because V_{out}-V_{ref} = I_f R_f, we get
V_{out}-V_{ref} = R_f (I- \frac{V_{dd} - V_{ref}}{R_b}) \frac{j\omega R_b C_1}{1+j\omega(R_b+R_i)C_1}.

Our transimpedance gain (including the DC offsets for input current and output voltage) is
\frac{V_{out}-V_{ref}}{I- \frac{V_{dd} - V_{ref}}{R_b}} = R_f \frac{j\omega R_b C_1}{1+j\omega(R_b+R_i)C_1}.
At DC, this has the appropriate gain of 0, and for high frequencies (in the passband), the gain is approximately \frac{R_f R_b}{R_b + R_i}, as claimed earlier. The corner frequency, where the real and imaginary parts of the denominator match is at \omega = \frac{1}{(R_b+R_i)C_1}.

2019 May 10

Inductive spikes

Filed under: Circuits course — gasstationwithoutpumps @ 22:04
Tags: , , , ,

One of the labs in my textbook Applied Analog Electronics asks students to look at the inductive spikes created by switching a nFET on and off with a loudspeaker as a load:

A 5V pulse signal to Gn will turn the nFET on.

My students were very confused when they tried the experiment, because they got a different result:

What the students got at the nFET drain went a little above 5V, but did not have the enormous inductive spike they expected.

Of course, I lied to you a little about what their circuit was—they were working with half-H-bridge boards that they had soldered:

The half H-bridge boards have a pFET and capacitor on them, as well as an nFET.

The pFET was left unconnected, so the circuit was really the following:

The gate and pFET source were left floating in the student setups.

So what difference does the pFET make? Well, with the gate floating and staying near 0V, the pFET turns on when the pFET source voltage gets high enough, allowing the capacitor to charge.

The pFET source gets up to about 7.2–7.3V, and the time constants for the capacitor and loudspeaker are long enough that the capacitor looks like a power supply (not changing voltage much on this time scale), so that the body diode of the pFET snubs the inductive spike at about a diode drop above the pFET source voltage.

So how did I miss this problem when I did my testing before including the lab in the book? One possibility is that I left out the bypass capacitor—without it you get the expected spike. But I know I had included the capacitor on my half-H-bridge boards—I had to solder up a board without the bypass capacitor specially last night, in order to get the “expected” plot in the first plot of this post.  I think what happened is that when I had done my tests, I had always connected the pFET gate to the pFET source, to ensure that the pFET stayed off, but when I wrote the book, I forgot that in the instructions. Here are the plots of the board with the pFET gate and source tied together (both floating), both floating separately, and with the them both tied to 5V:

With the pFET gate and source tied together, the circuit behaves as expected, with large inductive spikes if the pFET source is floating, but snubbed to a diode drop above 5V if the source is tied to 5V.

The pFET source voltage gets quite high when the pFET gate and source are tied together to keep the FET off, but they are not tied to the power rail:

Because the pFET never turns on, the body diode and capacitor acts as a peak detector, and the capacitor charges until the leakage compensates for the charge deposited on each cycle, around 33.7V, snubbing the inductive spike at about 37V (more than a diode drop above, but the duration is short).

This summer and fall, when I’ll be working on the next edition of the book, I’ll be sure to improve the instructions for the FET lab!

2019 February 15

Why do I write?

Filed under: Circuits course — gasstationwithoutpumps @ 19:56
Tags: ,

O Why Do You Write? Charles French asks

I have a question for all you out  there who write, and that includes writers of books, poetry, plays, nonfiction, and blogs. If I left out any kind of writing, you are included also.

Why do you write?

I wrote my textbook Applied Analog Electronics because I was creating a course for which I could find no suitable textbook. I wanted a college-level introduction to electronics that was focused on designing things, not on applied math. I don’t have an objection to math (there is plenty in my textbook), but I wanted it to be there to solve a particular design problem, not just with sterile exercises. The central theme of the book had to be iterative engineering with design, construction, and debugging of interesting circuits, with almost everything else as support for that activity.

All I could find on the market either delayed design until the third or fourth course (which seems to be the standard approach in EE departments) or was very hand-holding—telling students exactly what to wire and leaving no electronics design to the students.

When I started the book writing, I already had a fairly thorough set of lab handouts and felt that the book would be a simple rewrite with a bit of additional material. Boy, was I wrong!

The book has taken over much of my life (when I’m not teaching the course from it or grading student work) for the past few years. I had a “finished” draft at the beginning of January, but students in my class have pointed out about 170 problems with it, and they are only halfway through the book. A lot of the problems were tiny copy-editing things (commas, spaces, spelling errors), but some were substantive. I have about 50 to-do notes accumulated for me to work on this summer.

I think that this year’s students have been motivated to find errors by the token amount I pay for each error found (25¢) and by the “leaderboard” on Piazza, where I keep track of what I owe each student. To encourage more feedback, I try to be generous in allocating the quarters—something doesn’t have to be a real mistake, if I agree that the wording can be improved or something needs to be rewritten for clarity or completeness.  Students can ask questions about something they don’t understand, and if that triggers a specific idea for a change to the book, I give credit for that also.  (Having question-triggered corrections means that even students at the bottom of the class can get credit for book corrections.)

The question of why I write on this blog is a harder one.  Sometimes I am trying to share something I learned, sometimes I’m asking for help finding a solution to a problem, sometimes I’m motivating myself by making something public (like my weight and exercise records), sometimes I’m just thinking out loud (like many of my posts about the design of my course).  I’d like to say that I blog for the social connections, but so few people respond to my posts that I can’t really pretend even to myself that I am having a conversation.

I think that a few of my posts have been valued (at least Google thinks enough of them for people to come to them with searches), so I have some incentive to keep on writing.

2019 January 21

More typos than expected

Filed under: Circuits course — gasstationwithoutpumps @ 16:53
Tags: , ,

When I released my textbook in December, I offered 25¢ for each typo or other mistake found in the book.  I expected, based on how much material was new, to have about 50 typos in the book.

My students have already found 42 errors, and they are only up to about page 200, so I’m having to revise my error estimate upward to about 100 errors.

This year’s class seems to be pretty sharp—they have done much better on the first two quizzes than last year’s class did, and in two weeks they have already found about as many typos as last year’s class did over two quarters.

Next Page »

%d bloggers like this: