Gas station without pumps

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 20

Why charitable giving

Filed under: Uncategorized — gasstationwithoutpumps @ 11:32
Tags:
In my post Thinking about charity, I provided a number of links to articles my son had sent me for thinking about charity and philanthropy.  I promised my readers that I would “write future blog posts as I work my way through the list.”  Because of my heavy grading load this quarter (and more fatigue than usual, for unknown reasons), I have not had much time to read or think about those posts.  I’ll probably get to them mid-June or in early July, once the grading is done for the quarter and I have a 6-month break from grading.

I have done some thinking about charitable giving (mainly during my morning bike commute, which is long enough for random musings on all sorts of things) without the benefit of reading the articles.

My first conclusion is that before I decide how much to give to charity and who to give it to, I need to get clear in my own head why I’m giving, so that the action will further the goals.  I tried to list mentally various reasons that people might have for charitable giving, to see which ones resonated with me.  Here are a few reasons I came up with:
  • feeling good about oneself.  Giving altruistically with no return makes one feel noble and virtuous.
  • giving back or paying forward. Acknowledging that one has been given much by others and reciprocating makes for a fair balance.
  • virtue signaling. Letting others know that one is a good person (or faking it, to hide being not such a good person) seems to be a bit too manipulative, but serving as a good example to others is not a bad thing.
  • making the world a better place. Fixing everything wrong in the world is impossible, but progress can be made in small steps.
  • participating in a community. Joining a group dedicated to making some improvements can provide a circle of similarly minded people who are good to have as friends and associates.
  • reducing the money given to the government or to heirs.  Giving money away to charity can reduce the amount paid in taxes while living or the amount left to others when one dies.
  • religious or social obligation.  Require charitable giving as a tenet of a religion is common, though this requirement has often been corrupted into con games to enrich the leaders of the religion at the expense of the followers.

There are undoubtedly many other possible reasons for charitable giving.

I was brought up to believe that good people are charitable, so feeling good about myself requires charitable giving.  I do not feel further obligation to those organizations that supported me when I was younger—most of them have already received more from me than they provided—but I do feel an obligation to provide for others some of what was provided for me.  That is, “paying forward” makes more sense to me than “giving back”.

Virtue signaling is not a big deal for me—I don’t feel any need to trumpet my contributions.  But I do believe in setting an example, so I don’t feel obliged to keep my donations secret either.  If my modest contributions can encourage those wealthier than me to give more, then I don’t mind my name appearing on donor lists.  Being an example does not require boasting—I’ve been quietly advocating for bicycle transportation for decades by relying on my bicycle for transportation, rather than getting a driver’s license.  Some people have been inspired by this example to try the car-free life themselves, or at least to try bike commuting occasionally.

Making the world a better place seems to me to be the main point of philanthropy—but this broad goal is so vague that it does not provide a lot of guidance on where to give.  The tiny amounts of money I have to give cannot make much difference to the world as a whole—so should I concentrate on improving a small part of the world (like the local community), look for giving that may have a large effect in future (giving to research, for example), or having maximal effect right now.  Are political changes more or less important than direct services to those in current need?

I’m not much motivated by tax consequences, nor by religious or social obligations.

The two reasons for giving that resonate with me right now are feeling myself to be a good person and making the world a better place.  The main thing I feel I need to think about is in what ways I can effectively make the world (or some small part of it) better.

Readers, what reasons for charitable giving have I missed? What motivates you to give?

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 May 8

UCSC principles of community

This year UCSC has had banners up on the main roads of campus touting the campuses “priniciples of community”:

We strive to be:

  • Diverse: We embrace diversity in all its forms and we strive for an inclusive community that fosters an open, enlightened and productive environment.
  • Open: We believe free exchange of ideas requires mutual respect and consideration for our differences.
  • Purposeful: We are a participatory community united by shared commitments to: service to society; preservation and advancement of knowledge; and innovative teaching and learning. 
  • Caring: We promote mutual respect, trust and support to foster bonds that strengthen the community.
  • Just: We are committed to due process, respect for individual dignity and equitable access to resources, recognition and rewards.
  • Disciplined: We seek to advance common goals through reasonable and realistic practices, procedures and expectations.
  • Celebrative: We celebrate the heritage, achievements and diversity of the community and the uniqueness and contributions of our members.

[https://www.ucsc.edu/about/principles-community.html]

These principles are nice, if rather vague, principles for the community to support, and the banners are nicely designed graphically:

 

(Sorry about “be caring” being backwards—I didn’t hang the banners, but just photographed them on my way to work today.)

I have one major objection to the banners:  they are all paired with “because actions speak louder than words”, but none of them demand specific actions!  They are asking for states of being, rather than calling for action.  The only exception is “embrace diversity”, probably because “be diverse” is something that the community aspires to, not something an individual can do much about.  But even “embrace diversity” is not a very clear action.

About the only one of the slogans that can be easily turned into an action is “be celebrative”, which should be “Celebrate!”

I think that the designers of the banners did not really think through the meanings of the words they were putting on the banners, or they would have chosen a phrase to pair with that did not have this semantic dissonance of exhorting states of being, while claiming that actions are better.

Readers, what common phrase would you have put on the banners, to pair with all the “be” phrases?

2019 May 1

Eighteen months later

Filed under: Uncategorized — gasstationwithoutpumps @ 11:33
Tags: , , ,

Those of you who’ve been following my blog for a while will remember that last year I had my whole head shaved for the St. Baldrick’s cancer-research fund-raiser.  I’ve done a couple of posts since then on the regrowth of the beard and head hair: Regrowth: a return to normal and oneOne year later.

Since the shaving, I’ve let my beard grow back (except for trimming my mustache and shaving my cheeks) but I’ve had one haircut.  This is how long my beard gets in 18 months:

The beard is getting a bit scraggly, so I’ll start trimming the ends.

The big question is whether I should keep the long patriarchal beard (which makes me look a bit like an etching of my great-grandfather), or trim back to a more fashionable young man’s beard, which would be more work to maintain.

Readers, what do you think? Long beard or short?