# Gas station without pumps

## 2013 March 6

### Twenty-third day of circuits class

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

[Actually 24th—I forgot to increment my counter for the quiz day.]

I started today’s class by reviewing the block diagram we had developed on Monday, expanding on level converters (high-pass filters) and the voltages for different signals in the preamp and comparator.  I explained the open-collector outputs of the LM2903 comparator chip and discussed how to choose the pull-up resistors. I shared with them the measurements I had made of the LM2903 IOL vs. VOL:

Last weekend, I measured the output current of the LM2903 chip for different output voltages, because I wanted to make sure that the saturation current was below the maximum current specified for the chip. The lower voltages were measured with the Arduino, but I had to use a voltmeter by hand for the voltages above 5v. In retrospect, it probably would have been faster to use high-resistance voltage dividers to scale the voltages down to the Arduino range.
The saturation current (around 18mA) is less than the 20mA limit specified for the comparator.  The saturation current does seem to depend on the power-supply voltages to the LM2903, going up as the power-supply voltage increases, but I did not investigate the dependence closely,

Unfortunately, the gnuplot script and lab handout I had given them made the assumption that the nFET gate would be pulled up to the positive voltage rail (as I had done in the circuit I had tested) rather than to common point in the middle, which would make the nFET turn-on and turn-off much faster. I showed them how to modify the gnuplot script that plotted the time to rise or fall to a given threshold value for this change in design, but I’m not sure anyone got it—a lot of them tune out whenever formulas or things that look like programs appear.  That’s really a pity, since just about all engineers these days need to use computers in more sophisticated ways than just running consumer-level programs.  I’m hoping that the brighter or more diligent students (not necessarily the same in this class) will take the time to read the gnuplot scripts I provided and play with parameters to see the consequences of different choices. I did not prove for them that a current source fighting a pull-up resistor to a voltage source is equivalent to a resistor of the same value to a different voltage, though I had done that proof for myself in preparation for the class.

This plot shows simple approximations to the turn-on and turn-off times of the FETs, assuming that the pFET pull-up resistor is connected to a +6V power rail, the pull-up resistor for the nFET gate is connected to the 0V power rail, and the emitter of NPN transistor in the LM2903 is connected to a -6V power rail. One can make a simple modification to the script to change the power-supply voltage.The script that produced this plot is slightly different from the one I distributed to the class, to make the pull-up resistor for the nFET gate go to Gnd (one power-supply above the source) instead of the top rail (two power supplies above the source).  In the plot from the original script, the color codes for the curves are not so confusing.  The students may need to edit the script to show only  a few of the curves, as 8 curves are too many to interpret at once.

The ideal settings for the resistors should have the turn-on times slightly longer than the corresponding turn-off times for the other FET, but this may not be achievable in practice.  I suggested just matching the rise and fall time for the nFET and the rise and fall time for the pFET.  One should err towards slightly larger resistors for the nFET (making the turn off faster than the turn on) and slightly smaller resistors for the pFET (again, making the turn off faster than the turn on).

Of course, the signal one sees on the gates looks very little like the smooth charging curves that one might expect from the simple RC analysis.  The huge voltage swing on the drains of the FET as they switch from one power rail to the other is capacitively coupled back to the gates, which end up with a flat spot during the charge/discharge curve at the point where the FETs change state.

I also briefly explained LC filters (we had looked at them before briefly and I was short of time, so I did not repeat the detailed algebra of the voltage divider formula: $\frac{\frac{1}{j\omega C}}{j\omega L + \frac{1}{j\omega C}} = \frac{1}{1-\omega^2 LC}$.  Instead I showed them a gnuplot script that computed the power to the loudspeaker at different frequencies for different values of C and the inductor they’ll use in lab: a AIUR-06-221 power inductor with 220µH and 0.252Ω.  The script also includes the loudspeaker model I’d developed for them.

The power delivered to the loudspeaker for a ridiculously low power supply voltage. The students will probably want to use 4 or 5 times this much power, so at least twice this voltage supply. The power computation here uses the loudspeaker model and computes real power.  The inductor used is the one they will have, with 220µH and 0.252Ω.

I’m not expecting anyone to get everything right in tomorrow’s lab on the first try, even with all the scaffolding I’ve given them—the class-D amplifier has more subtleties than I thought when I first decided to assign it.  But I think that it is within their capabilities to get it right with a little debugging help.  I’m keeping my fingers crossed for tomorrow’s lab—this is a way more ambitious lab than anything in EE 101.

In other class news, we discussed making T-shirts (similar to the ones I’ve made for other courses).  It seems like most of the class is interested in buying shirts if we can get the price below \$20.  I’ll have to get quotes, but I think that Sports Design will be able to meet that price if I have at least a dozen shirts made.  I’ll also have to do the design (maybe this Sunday, after science fair judging on Saturday and grading the stack of lab reports).  I’m thinking of the same “slug-dreaming” frame as before, but with an op amp and a couple of negative feedback resistors.