# Gas station without pumps

## 2014 May 7

### Quiz corrections

Filed under: Circuits course — gasstationwithoutpumps @ 20:36
Tags: , , , , , ,

As I reported last week, students did poorly on the first quiz, which came as no surprise to me.  I had the students redo the quizzes as homework, allowing collaborative work (as long as they acknowledged the collaboration in writing).  They turned in the homework on Monday, a week after the quiz, and I returned them today.  No one aced the redo, with the top score being still only 25/33 (which would have been an A on the first pass, on a redo maybe a B+).

A lot of the students still seem to be having trouble with complex numbers—they got the formulas right when working symbolically, but then the exact same question with numbers instead of letters (which could be done by just plugging into the formulas) came out with real numbers when complex impedances were asked for.  Also, a lot of sanity checked were skipped (several people reported a battery as doubling in voltage when hooked up to a resistor, for example).

These students are not major mathphobes (they’ve all passed a couple of calculus classes and most have done more math past that), but they don’t seem to have any sense for reasoning with or about math—they just want to plug in and grind, even on simple problems like ratios in voltage dividers. This class has almost no memory work (I gave them a one-page handout at the beginning of the year with all the math and physics I was expecting them to memorize), but relies heavily on their being able to recognize how to apply those few facts.  This often requires subdividing a problem, like recognizing that a Wheatstone bridge is the difference between two voltage dividers, or that a 10× oscilloscope probe is a voltage divider with R||C circuits for each of the two impedances.

I spent the entire class today working through each problem in the quiz, to make sure that everyone in the class could understand the solution, and (more importantly) see that they did actually have enough knowledge and math skill to do the questions. Some of the students were feeling overwhelmed on the quiz, because they are not used to doing anything more than 1-step pattern matching for problems, and some of the quiz problems required two steps.  None of the quiz problems were as hard as the prelab they had to do this week, which involved 8 or more steps to get the resistor values to set the gain of the amplifier:

1. Determine the pressure level of 60dB sound in Pa.
2. Determine the sensitivity of the microphone in A/Pa:
1. Convert -44dB from spec sheet to a ratio
2. Get V/Pa sensitivity for microphone for circuit on spec sheet
3. Convert to A/Pa given resistance of I-to-V conversion resistor on spec sheet.
3. Determine voltages needed for op amp power supply.
4. Determine I-to-V resistor needed to bias microphone in saturation region.
5. Convert A/Pa sensitivity, RMS pressure level, and I-to-V resistor to RMS voltage out of microphone.
6. Determine corner frequency and R, C values for DC-blocking filter.
7. Determine maximum output voltage range of the amplifier as the most limiting of
1. Voltage range of op amp outputs
2. Power limits of loudspeaker (10W)
3. Current limit of op amp (which is a function of the power-supply voltage) into 8Ω loudspeaker
8. Determine max gain as ratio of RMS voltage into op amp and RMS voltage out of op amp (I’m allowing them to be a bit sloppy about RMS voltage vs amplitude, since we are not looking just at sine waves—the amplitude of a symmetric square wave is the same as the RMS voltage.)
9. Choose resistor values to give the desired gain.

I’m hoping that pushing them go through these multi-step designs in the lab will give them more practice at decomposing problems into smaller pieces, so that two-step problems on a quiz no longer seem daunting, but routine.

I’m going to be giving them another quiz in about a week, covering op-amp basics and the amplitude response of RC filters.  I’ve got to figure out the best time to do this—possibly a week from Friday, after they’ve done another op-amp lab (using a phototransistor to make a pulse monitor, using this handout).  I think I’ll reorder the labs after that, doing the pressure sensor instrumentation amp lab, then the class D power amp, then the EKG.

## 2014 May 5

### Block diagrams and audio amps

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

In today’s lecture, I introduced the notion of block diagrams as having two types of objects: functional blocks and connections between them. I emphasized that both parts were equally important, though computer programmers tended to focus more on the connections and electrical engineers more on the blocks.  I pointed out that basic action of decomposing an engineering design problem into separable subproblems was common to all forms of engineering, and so block diagrams were a common notation in almost all branches of engineering.

I also pointed out that block diagrams were only useful as a tool if they had a reasonable number of blocks (say 3–10), so that the system was broken into manageable pieces, but could still be viewed as one coherent system, not a rats’-nest of tiny components and wires.

As a class, we then developed a block diagram for and audio amplifier, starting from the overall task (sound in, louder sound out) and working our way inwards.

I spent quite a bit of time at each connection.  For example, for the sound in we talked about dB, dBA, and sound pressure levels.  I did not remember the reference value for 0dB of sound, but I have it in the lab handout (20µPa RMS).

We then talked about the sensitivity of the microphone, which we treated as a sound-to-current converter (with units being A/Pa).  I pointed out that the data sheet for the microphone we used did not give sensitivity in that form, but in dB for a reference of 1v/Pa, even though the microphone is a current output, not a voltage output device!  I explained that the data sheet used a current-to-voltage conversion of 2.2kΩ, though there is no particular reason to choose that value.  We also talked about the DC voltage or current bias needed for the microphone, which is much larger than the small AC signal.

The students realized that they needed a high-pass filter for blocking the DC, and realized (after a moment) that the voltage divider circuit meant that the input and output of the DC blocker meant that the microphone’s current output needed to be converted to a voltage.  Luckily, they’ve already designed a simple pullup resistor for current-to-voltage conversion, as well as a simple RC high-pass filter, so they should have no trouble doing so again.

We then jumped to the other end of the circuit and looked at the model for speaker.  I talked them into using the simplest possible model (just an 8Ω resistor), which is reasonable if we limit the frequency to 200Hz to 10kHz (adequate for speech, but not for music).  If we directly connected the circuit so far to the speaker, the students estimated that the signal would be less than a microwatt, so clearly not of much use for driving a 10w speaker. We also looked at the maximum voltage or current we’d want to apply to the speaker, to keep within the 10W RMS limit.

We then added a gain stage, which the students initially wanted to make a gain of about 4000.  I pointed out that voltage out of the op amp was limited to staying between the power rails, and that the MCP6004 op amps they have don’t have a very wide power supply range. I also pointed out that we did not want to exceed the current limits for the op amp, as that could clip the signals and distort them.  So they will need to choose a gain that will amplify the loudest sounds at the microphone to stay within the current limit of the op amp driving an 8Ω load.

Here is the block diagram they came up with:

Audio amplifier using an electret mic.

One student asked a very good question—what do you do if you want more sound than the maximum current from the op amp? I told him that we would address that question in a later lab: the class-D power amp lab.

I told the students to flesh out their block diagram to a detailed schematic (with component values!) before tomorrow’s lab, so that they could spend the lab time building, testing, and debugging the amplifier. I think that they will try, but they will bog down somewhere in the multi-step process of designing the amplifier. I’m guessing that half of the class will have the structure right, but that no one will get reasonable values for all the components.

I have told them that I expect them to come up with expectations for what they should see at each point of their circuit, so that they can compare what they see on the oscilloscope with what they expect, and use the discrepancies to help them debug.

## 2014 April 10

### Second mic lab went well

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

The second half of the mic lab went fairly well, but there were a couple of overly ambitious requests in the handout that I’ll have to trim out for next year.  Because we have not gotten to complex impedance yet (tomorrow, I swear!), the students were unable to choose a reasonable size for the DC-blocking capacitor, and guessing was not good enough.  The 10MΩ input impedance of an oscilloscope with a 10× probe makes for too long a time constant with the 0.1µF capacitor I  initially suggested, at least with the digital scopes—they did not manage to get the DC offset removed even after a minute, which surprised me.  Students got decent results with a 0.022µF capacitor, though.  I even got some of the students to be able to make measurements with the Tektronix digital scopes (always a feat, since they have mind-bogglingly complex menu systems).

I did tell the students not to bother with the last question on the handout and just to write up what they actually did.

It took the students longer than I had expected to come up with a reasonable value for the pullup resistor for the mic. But I was careful not to be too helpful, so that I’m reasonably sure that at least one in each pair of students knew how they got their answer. I did have them add load lines to their i-vs-v plots of the electret microphones, corresponding to rounding their desired pullup up or down to the nearest value they had in their kits.  That probably added a little time over a simple rounding, especially since I suggested to a couple of the students that they think about which resistor would give higher sensitivity.

I did have one student ask what a “pullup” resistor was—I had used that term in the handout without ever explaining it!  I gave a one-minute lecture explaining that a pullup was a resistor to the positive power supply and a pulldown a resistor to ground (we had examples of each already on the whiteboard). Speaking of things on the board, I’ll have to remember to bring markers to the lab on Tuesday, as the ones in there are all dead. A spray bottle of alcohol and some rags for cleaning the year-old buildup off the boards would also be good.

Even the pair of students who had run over on Tuesday finished on time today, despite collecting all the data that the other students collected on Tuesday, so I’m feeling a bit better about the size of the labs.

Next week may get a bit hectic, though, with two unrelated labs: hysteresis and relaxation oscillators on Tuesday and sampling and aliasing on Thursday.  I’ll have to remember on Tuesday to upload the hysteresis oscillator code to all the machines in the lab.

## 2014 April 9

### Protein essentials and second gnuplot demo

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

I gave two lectures back-to-back today, which I found a little stressful.

The first lecture was a guest lecture in “Molecular biomechanics” on the basic of protein structure.  I spent some time earlier this week picking out protein structure to show the students; digging out my old Darling models protein chain, which I last used for assigning homework in Spring 2011( see also my instructions for building protein chains with the Darling models); and trying to boil down the basics of protein structures to one 70-minute talk. I was up at 3 in the morning setting up the proteins I wanted to show on my laptop, even though I planned to rely mainly on the chalkboard and the Darling model kit.

The protein talk went ok. I covered such basics as primary=covalent, secondary=H-bond, tertiary≈packing, quaternary=multiple chains; hydrogen bonding patterns for helices, antiparallel sheets, and parallel sheets; supersecondary structure; domains; CO-R-N mnemonic for chirality; s-twisted and z-twisted helices (left- and right-handed in the confusing nomenclature used by biochemists); SCOP and PFAM; and maybe a handful of other topics.  I only showed two structures on the screen: a TIM-barrel and alpha-hemolysin, and I pointed them to the PDB education pages, which are actually quite good.

The most exciting thing during the lecture was that we had the fire alarm go off, and had to vacate the room for 10–15 minutes.  I might have covered a little more if there had been more time, but I did not have a set topic list I had to cover, so it didn’t really matter—I was just giving an extemporaneous dump of protein structure information. I certainly told them all the stuff I had decided ahead of time was essential—I’ve no idea what else would have come out if I’d had 10–15 more minutes.  I also managed to get in a plug for the library—they have Darling model kits that the students can check out—and for the information sessions that I arranged for the library to run for bioengineering majors next week.

Right after that talk, I went to the classroom for my applied circuits class and set up for another gnuplot demo. I had about 10 minutes to get some candy from the vending machine also.

In the applied circuits class, I started out by showing them the result of fitting models to (some of) the data I had collected:

The linear-scaling version of the graph the students should produce (they should also plot it on a log-log scale, for a better view of the resistive region).

I had to lend my data to a couple of the students who had not managed to finish the lab yesterday—I assured them that they could continue the lab tomorrow, and that I would stay until everyone had completed both parts of the lab. They will have to use their own data in the design report. While they were copying the data, I took some time to talk about the “zone of proximal development”, imposter syndrome, and how my goal in the class was not to “weed them out”, but to help them achieve difficult success. My goal is to maximize their learning, which means that they will often be struggling with concepts or skills that seem just a bit too difficult. I’ll help them, but it might be such “unhelpful” help as telling them “your breadboard doesn’t match your schematic” and leaving them to find where the mismatch is, rather than debugging for them.  Sometimes I’ll have to do more, when the problems are beyond reasonable expectations (like finding the blown fuses in the multimeter and the broken clipleads yesterday). I promised to stay in the lab until everyone finished, even if it took them a long time.

Sometimes I’ll goof on the difficulty of a homework or lab, and they’ll be pushed into frustration rather than just being challenged, but my goal is to get them to persevere and to achieve that very rewarding feeling of finally accomplishing something that seemed too difficult when they started.  This course is only 3% of their college education, but I’m going to try to make it accomplish a lot more than that share.

Fortuitously, in my email today I got a story about someone (a marketing manager for an electronics parts company) learning to solder for the first time. I shared that story with my class by e-mail, as I thought that they could sympathize with him (having just learned to solder themselves last week), but also recognize the symptoms of imposter syndrome.

Getting back to the main material for the day, I started the guts of the gnuplot lesson. Building up the plot a little at a time, we first plotted the raw data from one PteroDAQ, then scaled the y values first to amps, then to microamps.  Because each group used a different resistor in their test setup, they couldn’t blindly copy what I was doing, but understand at least enough to put in the correct resistance value.  I showed them how to switch between linear and log scales on each axis with the plot-window keyboard shortcuts (“L” toggles the scaling on the nearer axis) and we noticed that the data from the first data set (the red one above) was rather sparse at the low end.

I then showed them how to get two plots on the same set of axes, and I managed to get them to tell me what the plot would look like if we had been testing a resistor instead of the electret mic.  We then fit a simple resistor model to the low end (the resistive region) of the curve.

I then took a break from gnuplot to explain how an electret mic works.  They were a little astonished at how many transformations of the information occurred in a simple device like a microphone: pressure to force to displacement  to capacitance to gate-source voltage to drain-source current (and I promised that we would convert back to voltage in tomorrow’s lab). We managed to follow the transformations and see that they were all linear (well, displacement to capacitance to gate-source voltage was a pair of inversions, and I had to wave my hands at $\frac{d I_{DS(sat)}}{d V_{GS}} \propto I_{DS(sat)}$, since we don’t have a model of FETs yet, and may not get to one complicated enough to derive that this quarter.

I then went back to gnuplot and showed them how to fit the Isat model to the data, first deliberately trying to fit the whole curve (which gives an obviously wrong result). I had deliberately omitted the amp-to-microamp scaling, and gotten a straight line at zero for my fit—I had them debug that as a group before we got a constant line that was in the middle of the graph. I got them to figure out what went wrong there also. Once they realized I was fitting the whole curve, I showed them how to limit the range of their fitting, and got a reasonable Isat value. My goal here was not to “show them how to use gnuplot”, but to show them that they could debug mistakes that they were likely to make, and that they should not shut down when things went wrong. (A lot of today’s class was this sort of meta-cognition stuff, while still getting in a reasonable amount of technical material.)

I then gave them the blended model, with $R_{DS} = \sqrt{R^2 + (V_{DS}/I_{SAT})^2}$, converting it to a current model on the board, then trying to fit the data. The result was (unexpectedly) a terrible fit—I did not have them try to debug this, because were were almost out of time, and just showed them that the problem was one of units: my initial guess for R was in Ω, but my currents were all in µA, so I needed to make the resistance in MΩ to have consistent units. After scaling the guess for R by 1e-6, I reran the fit and it worked fine. This gave me a chance to talk about the importance of starting fitting procedures with reasonable guesses, since they might not otherwise converge.

I’ve been getting good participation from the class, only occasionally having to get them to speak up (I’m getting a bit deaf, and when they mumble a guess, I can’t hear them). I’ve been trying not to suppress students who provide incomplete or wrong answers, but encourage them to amplify on or correct each other.  So far it seems to be working.

We did not have time to fit the 3-parameter empirical model, but they have the model in the lab assignment and they should be able to fit it using gnuplot now.  One student asked me if I was going to distribute a script, as I did last week. I assured him that I was not going to do that. The goal was to build up their gnuplot scripting capabilities, not provide them with crutches. There was very little “new” in this week’s lesson as far as gnuplot was concerned, and gnuplot does have an adequate help system for the sort of stuff they need (though I find the hierarchical help system to be quite poor for finding out about features you’ve not been exposed to—you have to know precisely what names things are hidden under).

I still haven’t gotten to complex impedance, but that will have to be Friday’s lecture.  I also wanted to get to load lines today, so that they could select an appropriate size for their load resistors that do the current-to-voltage conversion, but I’ll do that at the beginning of lab tomorrow, when they’ll be scratching their heads about how to choose the resistor.  Just-in-time teaching can be a powerful motivator, if they get concepts just after they realize the need for them, rather than months earlier in anticipation of need. I may at the beginning of lab if anyone figured out on their own how to choose the resistor, and get them to present first.

### First mic lab slightly too long

Filed under: Circuits course — gasstationwithoutpumps @ 09:32
Tags: , , , , ,

The first half of the microphone lab took a little longer than anticipated.  I had expected it to take about 2.5 hours, with some groups taking the full 3 hours, but it took more like 3–4 hours.

I have two conjectures about reasons for the extra time:

•  I had the students label all their bags of capacitors. this had originally been planned for a week ago, but the capacitors had not been ordered in time, and Thursday’s lab had been way too packed already, so this was the first opportunity we had.  I probably should have waited until this Thursday, when the lab time is less packed.
• The group that fell the furthest behind had really terrible luck, having sat at a bench where both multimeters had blown fuses and two sets of multimeter leads had open circuits. I helped them debug their setup, but we did not initially suspect the test equipment, and the delay in finding the problem cost them at least half an hour. It also cut into their confidence in debugging their own circuitry later in the lab. Problems with the equipment is one of the difficulties with using a shared lab—a lot of the courses are taught by EE TAs who do not bother to teach students proper use of the lab equipment (if they even know it themselves), so there is often damage of this sort to deal with.

A number of the students in the class are suffering from “imposter syndrome”—not confident of their abilities to master this new material. I’ll have to reassure them that they are doing fine—this class is intended to be pushing them into unfamiliar territory.  I may take a moment in today’s class to mention both “imposter syndrome” and “zone of proximal development”, so that they are aware both that it is ok to be uncomfortable and that I’m trying to maximize what they are learning.

Students had a lot of trouble wiring up their breadboards accurately. Most of the lab time was taken up with students asking for my help and my taking a quick look at the breadboard and telling them that it didn’t match the schematic they had copied. I eventually had the students write on each wire of the schematic what row (or rows) of the breadboard it was on, so that debugging the connections was easier.  I’ll have to try to remember to put that in the instructions for next year, as a way to get the students to learn to debug their breadboard wiring more independently.  I should also add a picture of the trimpot and an explanation of what a potentiometer does—students had a little trouble figuring out what the 3 pins on the package were for.

Many of the groups managed to look at their data in the lab using gnuplot, and collecting more data as a result of what they saw. The students got 1000s of data points that fall nicely along a curve, and they were able to superimpose different data sets that had different scaling for the current measurements. We’ll have excellent data to use in class today for fitting models to. I’m not going to give them real FET models for the FET in the electret mics, though.  Instead we’ll use some simple empirical models:

• current source.  This is the same as a saturation current model.
• resistance. This is essentially the same as the linear-region model for FETs.
• blended model with $R_{FET} = \sqrt{R^2 + (V_{DS}/I_{SAT})^2}$  This is a simpler blend than is usually used in FET models, I think, but it fits the data fairly well.  This blend is mathematically very similar to the ones that compute the gain in RC filters (where we take the magnitude of a complex number and either the real or the imaginary component provides most of the contribution).  Using the same function for rounding the corner when we join two straight lines in different contexts reduces the math burden on the students.
• blended model with $R_{FET} = \sqrt{R^2 + (V_{DS}/I_{SAT})^{2\rho}}$ The extra parameter here is to handle the increase in saturation current with increasing drain-to-source voltage. Normally, that is modeled with a fairly complicated “channel-length” model, and is not even mentioned in intro circuits classes.  But the phenomenon is very obvious in the data, and can be adequately modeled in the electret mic for our purposes with this 3-parameter empirical model.

I will have to give them one more concept about FETs: that the derivative of the saturation current with respect to the gate voltage is proportional to the saturation current. I’m not going to derive that for them from some more general model, because we have no way (in the mic) of actually measuring the gate voltage. Later in the quarter, when we look at FETs again before doing the class-D amplifier, I may give them a slightly more detailed model of an FET.

In addition to gnuplot tutorial today, I want to give them an intro to complex impedance, but I doubt that we’ll get far enough for them to choose the right size for a DC-blocking capacitor for the AC mic lab tomorrow. I may have to suggest that they try one of the biggest sizes of ceramic capacitor that they have (either the 4.7µF or the 0.1µF). We’ll need to get to RC time constants and corner frequencies before next week’s lab though.

Next Page »