# Gas station without pumps

## 2013 March 5

### Twenty-second day of circuits class

[Correction: Actually 23rd day—I forgot to increment the counter for the quiz day.]

On Friday, I had suggested that today I’d want to talk about

• how class-D amplifiers work. I’m sure it is very strange for a circuits class to cover class-D amplifiers, without ever having covered classes A, B, AB, and C, but that’s the way it worked out for us.
• LC high-pass filters before the loudspeaker.
• Zobel networks for compensating loudspeakers to get resistive behavior.

By this morning I had decided that I needed to talk change the order of the material and put off the LC filters until Wednesday, and the Zobel networks we may not get to at all, depending how things go.

I started today with a reminder of the square wave noisy toys we made in the tinkering lab, with a pFET in series with the loudspeaker, then I added an nFET down to a negative voltage source, so that we could get pulses of ±V to the loudspeaker.  I introduced the two main characteristics of a rectangular wave: the period and the duty cycle. I then talked about how averaging out the pulse could turn the duty cycle into a value (averaging 50% duty cycle gives 0, averaging 75% duty cycle gives V/2, averaging 25% duty cycle gives –V/2, and so forth).

Once they had the basics of pulse-width modulation, I went over the notion of a block diagram again, as the quiz had made it clear that many students really did not know what block diagrams were for, and had done the sort of random clouds of ideas that elementary school teacher who teach mind-mapping seem fond of.  (I find such random clouds of thoughts with arrows that have no particular meaning one of the most useless and irritating of educational fads.)  So I explained block diagrams as a way to decompose a design into smaller designs, with careful input and output specifications (the signals) between the blocks.

We then proceeded to start designing the block diagram for a class-D amplifier, starting from sound in (to a microphone) and sound out (from a loudspeaker) and working our way in towards the middle of the design.  I showed them how a decision at one point (like the power supply for the amplifier in the pre-amp section) could cause other decisions to ripple through the design: Vref was set in the middle of the power supply range, the output of the preamp became Vref±Vamp, with Vamp

We got as far as interpreting the voltage-to-PWM converter as a comparator taking input from the preamp and from a triangle wave generator, but we still need to look at level shifting for an input of the comparator, to get both to the same DC level.

I did get the students to figure out that the PWM frequency needs to be at least twice the highest frequency they want to amplify (yay! they remembered something from the sampling lab!).  They figured they needed at least 32kHz, and probably more than that. I told them that we were limited by how fast we could drive the FET gates up and down, so that we used the lowest frequency that was enough above 32kHz—typically 60–100kHz.

We’ll probably start on Wednesday reviewing the block diagram and examining the inputs of the comparator, then introduce the open-collector output of the LM2903.  Sadly, the LM2903 does not have an open-emitter option, as some comparators do, so we’ll need to look at sizing pull-up resistors for driving the nFET and the pFET.  I may want to rethink which comparator to use for next year, so that we can have more options, or perhaps add an external bipolar to get more drive capability for the FET gates, or even give up on FETs and use power bipolars instead.  After looking at pull-up sizing we’ll look at the LC filter between the FETs and the loudspeaker.  Only if we have time will we look at Zobel networks.

I thought that today’s class went reasonably well—we covered about as much as I expected to, and we got a better look at the process of breaking a design down into blocks and how precise connections between blocks let us propagate the consequences of design decisions.

After class, I had my usual Monday afternoon office hours in the lab.  There were a few questions about the quiz I had returned today.  You can tell that these are well-trained students, because they didn’t ask me about points, but about how to do some of the problems they missed.  (Incidentally, I had misgraded the group tutor’s quiz—he got a 72 not a 66—I’d stupidly misread which signal was the input and which the reference voltage to his amplifier.)

There were also 3 students finishing up last Thursday’s lab.  One pair had gotten the circuit working on a breadboard last Thursday and just had to lay out and solder the circuit.  They found one error in their design while doing the layout: they had been off by a factor of 10 on one of the capacitors and did not have a capacitor of the size they had designed for.  Rather than changing the resistor, they decided to solder 2 capacitors in parallel—a perfectly reasonable solution.  The other student had been ill on Thursday and had to do the whole pressure sensor lab by himself.  I ended up staying in the lab for 6 hours, so that he could finish and demo the working instrumentation amplifier soldered on the protoboard.  His first attempt at a demo revealed that he had changed a capacitor value between his schematic and his layout (from 4.7nF to 4.7µF) and so has a low pass filter with a corner frequency of 0.5Hz instead of 50Hz.  He learned how to use a solder sucker, replaced the capacitor, and his design worked fine.

While I was in the lab, I ended up helping a number of the EE101 circuits students with their first op amp lab.  Some were struggling with such basics as connecting power to the op amps (there wasn’t any drawn in the schematic they were using).  There were other major gotchas in the lab: like instructions telling them to look at the phase change in the signal at 1Hz for an input of 1V, without warning them that the gain would be so high that they would get clipping of the output.  Some students were also having trouble with weird high-frequency ringing in the output,which went away when I had them add bypass capacitors to their power lines.  It appears that the EE 101 class has gotten to week 9 out of 10 without having talked about bypass capacitors and without the students having learned how to limit the current on the power supplies.  I find it difficult to believe that the professors who wrote the lab assignments actually went to the lab and did the labs, or they might have noticed that the “cookbook” procedures they were having the students follow did not work in the real world.

Creating good lab experiences for a course is a lot of work (I’ve been putting in much more than 40 hours a week on the design of this course, testing and revising the labs), and I don’t think that the EE faculty have put in the time needed to do it.  The labs in EE 101 look boring, with essentially no design component, and apparently untested, even though I think that they have been used for years.

I was worrying about whether students in my class were learning enough for me to argue with the EE department that they should be allowed to take the signals and systems course and the bioelectronics course without taking EE 101 (those are the two required courses for the bioelectronics concentration).  Now I’m wondering whether the students taking EE 101 have learned anything useful, and whether the applied circuits course I’m teaching should be required instead of EE101 for the bioelectronics majors.  I’m not sure I’d trust my students to do well on an EE circuits theory test, but I think that they’d be a lot more useful in the lab than students who’d just had EE 101.

Speaking of tests, I did tell a couple of the students that we’d not have a final exam.  I’d rather get them to do both the class-D power-amp lab and the EKG design than cram for a test which they’ll forget again 2 days later.  The design reports they are writing for the course are probably better preparation for life as engineers (or, in some cases, as grad students) than yet another test.