Gas station without pumps

2016 May 22

Disappointing class-D amplifier reports

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

I have a huge stack of grading to do this weekend (about 20 new design reports and about 30 redone reports from earlier labs). I was rather disappointed with the reports for the class-D amplifiers, not because the amplifiers didn’t work (they mostly did), but because about 80% of the class is getting a REDO for errors in their schematics, which means I’ll be having to grade the reports again.  I consider 20% REDO an acceptable level, but not 80%.

The most common error in the schematics was one that I had seen a fair amount in previous years: getting the source and drain of the pFETs swapped.  It is a fairly serious error, as putting the transistors in backwards would cause a lot of shoot-through current from the body diode conducting.  Students were wiring their transistors correctly (after some false starts), but documenting their designs wrong.  A number of students also used the depletion-mode instead of enhancement-mode FET symbol, but I consider this a much less serious error (as long as they included the right part number), and would not have triggered an automatic redo for that mistake.

I warned the students about the source and drain orientation repeatedly, both as a class and (in many cases) individually.  I was very careful to point out the convention for the source and drain notation in class and in the book, and they had it on their data sheets as well.  I don’t know what else I can do, other than instituting in-class quizzes, which I may have to do next year.

There were a number of other documentation problems in the reports this week:

  • Using their loudspeaker models, but not including the model in the report.  In many cases, it was clear from their plots that they had screwed up the model somehow, but without any formulas or parameter values, it was impossible to figure out what they had screwed up.
  • Oscilloscope pictures that did not say what the probes were connected to, or had incorrect labeling of the probes. This was mainly really bad lab technique, where they failed to write down what they were doing, and couldn’t reconstruct it from their memories.  That is one aspect of the labs that I’ve not put much emphasis on this year—writing down what they are doing as they do it.  I may have to emphasize that more next year, especially since the labs will be broken up into 4 95-minute sections instead of 2 3-hour sections, which will make memory even more unreliable.
  • Not reporting the PWM frequency.
  • Not remembering to include their bypass capacitors in their schematics. Some students may not have had bypass capacitors, though it was very difficult to get the amplifiers to work without them, as the H-bridge dumps a lot of high-frequency energy into the power lines, which gets coupled back to the comparator and the preamp.
  • Generally bad copy editing.  The spelling and grammar problems in some reports are just common non-native problems with articles, plurals, and verb tense, but a lot of the reports had huge numbers of spelling errors, duplicate words, missing words, comma problems, and incomplete sentences.  I’ll be addressing this problem next year by giving students a bit more time to complete the reports (though that didn’t seem to help on the one report that students had more time on this year).

2013 July 4

Blinky EKG hard to debug

Filed under: Circuits course — gasstationwithoutpumps @ 11:46
Tags: , , , , , , , ,

I’ve been having a frustrating couple of days trying to debug the Blinky EKG.  It worked when I first built it, but every time I’ve tried to demo it, the demo has failed, and I couldn’t get it working even at home on Tuesday.  I have another, very similar EKG circuit that I built on my instrumentation amp protoboard, which has worked fine every time I’ve tried to use it.

There are a few differences between the circuits (the blinky EKG is battery powered, for example, has an LED load on the final output, and has a trimpot for adjusting the gain of the second stage), but none that explain to me the difference in performance.

On Tuesday my experiments were limited to hooking up one or the other of the EKG boards and using an oscilloscope or Arduino data logger to observe the outputs or various internal signals.  Using the EKG board that worked convinced me that the EKG electrodes were providing a good 1mV signal (that had been a problem in the circuits course, as many students got EKG circuits that worked with electrodes on me, but no electrodes on themselves—we never figured out exactly why).  But I could not get anything from the blinky EKG—even the output of the instrumentation amp seemed to be constant.  I suspected that I had fried the amplifier chip, and was considering unsoldering it and putting in a new one.

Yesterday, I tried a different test, making an artificial input source, using resistors and my Elenco FG-500 function generator.

Test fixture for the EKG blinky board.  Note that with a 10V peak-to-peak oscillator input, the output would be a differential signal of about 1.8mV peak-to-peak.  The diagram was drawn with Digikey's SchemeIt.

Test fixture for the EKG blinky board. Note that with a 10V peak-to-peak oscillator input, the output would be a differential signal of about 1.8mV peak-to-peak. The diagram was drawn with Digikey’s SchemeIt.

With this test fixture, I convinced myself that the Blinky EKG board was amplifying the differential input signal correctly, over a range of about 1Hz to 40Hz, as long as the resistor for setting the DC bias was under about 300kΩ. Even with a 3.3MΩ resistor, I could see the output signal, but there was a fair amount of 60Hz noise added to it.  The gain was adjustable with the trimpot, but was high enough at all settings that I should be able to see EKG signals at the output clearly with the Arduino data logger—the gain control is mainly to get the LED to blink appropriately.

One effect I should have anticipated, but did not, was that the bias voltage showed a large change every time the LED turned on. If I redo the EKG Blinky design, I’ll probably use a voltage reference (like the TL431ILP) rather than just a voltage divider for the input to the Vbias op amp, and the LED will not be powered from the Vbias line.

In any case, the Blinky EKG board seems to be working as intended as an amplifier, and I’m still a bit mystified why it is not working when connected to the EKG electrodes.  About the only thing I can think of is that there is too large a DC offset between the EKG electrodes, as the Blinky EKG uses a large gain on the first stage and a relatively small gain on the second stage.  The DC-blocking high-pass filter is after the first stage. The EKG built on the protoboard used a smaller first-stage gain and larger second stage gain, so wouldn’t saturate the first stage as easily.  (I’d learned more about EKG electrodes by the time I’d designed that circuit.) I could fix the gains by changing a few resistors on the EKG blinky board, which may be worth the pain of unsoldering and resoldering resistors.  That may be worth trying today.

Note: I’m starting to use DigiKey’s SchemeIt for schematic capture, rather than Circuit Lab. There are a lot more symbols available in SchemeIt, and the user interface is fairly similar.  SchemeIt does not have simulation capabilities, but CircuitLab’s never worked for me anyway. SchemeIt’s  drawing is a bit cruder—they’ve not taken care to make sure that wires and components line up perfectly in the PNG output, but is better than Eagle‘s.  Best of all, I know how DigiKey monetizes their schematic capture system: you can turn the Bill of Materials (BOM) into a DigiKey order with a couple of clicks, so I have no expectation that they will start charging for SchemeIt.  I may even use the ordering capability in the way they intend, since I order from DigiKey fairly frequently already.

2013 March 21

Student writing

Filed under: Circuits course — gasstationwithoutpumps @ 08:59
Tags: , , , , , , ,

In How does blogging about science benefit students?, Sandra Porter recommends that students (specifically biotech students at Portland COmmunity College) keep a blog :

My hypothesis is that a science blog for a science student can serve the same purpose that a portfolio serves for an artist or a set of articles serves for a writer.  Your blog can be your record of accomplishments.

Not only can your blog document your work, your blog can show that you can write, that you can spell (not a skill to take for granted), and can give you a chance to describe what you’ve done.

She describes her first job interview and what she is doing to avoid similar embarrassment for her students.  She has students in one class keep a professional lab notebook and bring it to interviews—showing that they can keep a proper lab notebook and providing documentation to support their assertion of knowing various protocols.

Student blogging is another approach she is experimenting with.  She encourages the students to use blogs as an on-line notebook (much like I’ve been doing on this blog for the circuits course), and to include the URL for the blog in resumes and cover letters for jobs.  If interviewers are interested, they can check out a few posts on the blog to see if the student can write coherently (a very important skill that can not be automatically assumed of college graduates) and, if there are search boxes and appropriate tags on the posts, whether the students know the protocols and equipment that the job requires.

In a subsequent post, The ten commandments of student science blogging, she talks about the guidelines she gives students for their blogs, to keep them from accidentally doing unprofessional things that would hurt, rather than, help their chances of getting a job.

The biggest problem I see with her recommendations is that the only audience she has identified for the student is a mysterious “job interviewer” whom the students have never met.  Writing for an unknown, difficult-to-imagine audience is hard. Writing for an imagined expert (an interviewer or professor) almost always brings out the worst writing, with inflated diction, misused jargon, and awkward ungrammatical sentences.  When writing to show that they know something to someone who knows it better, students stumble over nearly every sentence—leaving out important concepts and tossing in irrelevant minor points in a vain attempt to impress.

I think it might benefit the students to be given a more specific audience—one that they can picture writing to directly and actually informing of something new.  For an online lab notebook, it could be students at other schools (“look at the cool stuff we get to do here!”) or future students in the same lab (“never use the pink labels in the freezer—the glue on them cracks in the cold and the labels fall off”), both of whom are imaginable audiences.

The advice I gave in my circuits course is the standard advice I give to students: Write to students taking the course next year.  Assume they know what you knew coming into the course, but explain to them anything that you didn’t already know.  Make the report detailed enough that a student reading it could duplicate your work without having access to the original assignment—though they might have to looks a few things up on the web or in text books. (Provide pointers to appropriate readings, when possible.)  Explain not just what you did, but why, and provide warnings to help your reader avoid mistakes that you made.

Most of the students in the circuits course got this idea, and the reports were mostly coherent and directed at the right audience, though they were a little light on pointers to appropriate reading.

One thing that Sandra Porter doesn’t mention in her “ten commandments”, but which I had to really rant about in my course: “Get the details right!”  Sandra mentions spelling and punctuation, which are markers for attention to details, but the accuracy of the content is far more important. I can forgive an occasional typo (though failure to run text through a spell checker indicates a level of sloppiness that would disturb me as a job interviewer), but the main engineering content needs to be checked and double-checked, both for consistency with the lab notebook notes and for general sanity (recompute the corner frequency from the RC values in the schematic—is that what was intended?).

If you are giving a circuit schematic, every wire must be correctly connected, every component must have the correct value, and pin numbers should be correct.  The students  in the circuits course had incredible difficulty with checking their own and each other’s work for accuracy, and obvious errors (like power-ground shorts) occurred on most of the assignment first drafts.  For a biotech student, the equivalent would be getting the wrong reagent in a protocol, putting ice in autoclave, or replacing µg with mg.

The rate of errors in schematics did not drop much over the quarter, though I felt it should have.  Other writing problems (like poor audience assessment, overuse of passive, or misuse of “would”) were generally fixed after being pointed out, but the sloppiness in the circuit diagrams continued to be a problem all quarter.  By “sloppiness” I don’t mean poor drawing skills, as most of the students used CircuitLab to draw neat schematics, but semantic errors that changed the meaning of the circuits.

If anyone has ideas for improving student attention to details in schematics, I’d appreciate hearing them.

2013 February 25

Twentieth day of circuits class

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

We started today with a do-now problem, asking what the following circuit does:

current-to-voltage-converter

After 5 minutes, no one had any idea, so I asked questions until we got that In had a voltage of 0V, that the interesting property of In was its current, and that the same current flowed through R1. Then I gave them another 5 minutes. At that point, one or two students had an inkling that the circuit was a current-to-voltage converter, and one student even suggested that V_{out} = I_{in} R_{1}, which was almost right. I had draw the current into the circuit from In, so the output voltage was the negative of that. I walked them through the analysis that leads to that conclusion.

Then one student asked the obvious question—the one I was hoping a student would ask—how this differed from just using a pullup resistor as we had done for the electret mic.  So I tried to get them to compute the input impedance V_{in}/I_{in}.  After a great deal of difficulty, they came up with 0Ω.  We then compared V_{in} for the op-amp current-to-voltage converter and a pull-down or pull-up resistor.  I think that they see the difference between the op-amp circuit and the single resistor, but I’m not sure they understand when to use one and when to use the other.

I’ll probably see some op-amp current-to-voltage converters in next week’s audio amp lab, though they really aren’t needed with an electret mic (and they’ll probably get the bias voltage wrong, since the FET in the mic has to be kept in saturation, so needs to be at 1v or more). Hmm, with the proper biasing, the op-amp current-to-voltage converter could be used to get a fairly good gain from the mic without needing a DC-blocking capacitor to do level shifting, so maybe it isn’t such a bad idea to try use it.  I’ll try that out in the preamp for the class-D amplifier and see how well it works.

I then returned the lab reports and ranted about how important it was to get schematics exactly right, and how they’d keep redoing the lab reports until they got them right. I also lectured them about using “would” incorrectly (though only a couple of students are still doing that), about doing factoid dumps without connecting the information to the design problem they are addressing (again, just a few students still doing that), and about citations not being sufficient for copied figures or text—there must be explicit “Figure copied from … ” figure credits and explicit quotation marks or block quotes.  Lots of students are still omitting the figure credits.

I also talked about the value of having chunks of the schematic match the blocks of a block diagram, not mixing different blocks randomly, using the tinkering lab schematics (where the hysteresis oscillator board was a block of the block diagram) as an example.

Finally, I talked about the importance of thinking of voltages as being between two points: an FET does not know where “GND” is, and is controlled by VGS, not Vgate. I showed how putting a pFET between a loudspeaker and ground rather than between the positive power rail and the loudspeaker would result in the source voltage being just about the negative of the threshold voltage (so around 2V with our pFETs), and the pFET dissipating a lot of power.

I then took questions about this week’s lab. The first question to come up was about how to choose the Rgain resistor, which I used both as a chance to talk about the instrumentation amp and about gain in general.  I introduced them to gain-bandwidth product, and explained why one might want to use a multi-stage amplifier to get high gain with high bandwidth.  The amplifiers we use are about 1MHz gain-bandwidth product, so we could go up to 100kHz with a gain of 10, but only 1kHz with a gain of 1000.  Of course, for the pressure-sensor lab, we don’t need high frequencies so the gain-bandwidth product is not a limit in this lab.

The students then talked me through a block diagram for the lab, and we discussed (without coming to any conclusion) whether a low-pass filter was needed/useful and whether a second stage amplifier was needed/useful.  I did point out that they had two free screw terminals on the board for talking to the Arduino, so if they wanted to have two different gains or filtered and unfiltered outputs, they could.  There was a little discussion of what corner frequency was appropriate for a low-pass filter, and with a little nudging, I got them to remember last week’s sampling and aliasing lab.

We ran out of time before getting to material I had queued up in case things went faster than I expected:

  • common-mode rejection ratio
  • looking at the predictions for the tinkering lab as a group
  • AC power computation
  • microphone current-to-voltage conversion (choosing bias voltage)
  • more complicated loudspeaker model
  • Zobel networks for compensating loudspeakers

It’s actually a good thing that we didn’t get to the more complicated loudspeaker model, because I was playing around with a non-linear model (the main inductance varying as a power of frequency) and it looks like a better fit with fewer parameters than the linear model I had been using.  I’m considering rewriting the class-D amplifier handout to use that model instead.  Unfortunately, the LC filter design looks like we’ll have more pass-band ripple than I had previously thought, though still not too bad.

%d bloggers like this: