Gas station without pumps

2013 January 31

First soldering lab went fairly well

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

Today’s lab, the hysteresis oscillator lab, went fairly well, though it needs a bit of tweaking for next year.  There were three parts to the lab: finding the upper and lower threshold voltages of the 74HC14N Schmitt-trigger chip, choosing a resistor and capacitor for the relaxation oscillator and testing it on the breadboard, then soldering the circuit and demonstrating it working as a capacitance touch sensor.

The first part, finding the threshold voltages, took longer than I expected.  Students needed more help than I thought they would in setting up a circuit to determine the thresholds—not unreasonably more, but I was a little over-optimistic about how independent they would be at this point.   I think I should provide a bit more support for the threshold measurements in the lab handout, and allow a bit more time for it. Using a bench power supply to provide the input voltage confused them and did not really save much time compared to setting up a pot from the 5V supply, as they did for the microphone characterization.

The hysteresis oscillator was the main design challenge, deepening their understanding of RC timing.  They had the circuit for the oscillator (though I should switch to using a CircuitLab circuit, since the Eagle one for the board was too confusing with the extra symbols for off-board connectors and extra holes).  All they needed to do was to pick appropriate resistor and capacitor values and wire it up.  There was one constraint and one design goal.

the low pulse width has to be between 20µsec and 1 msec
the low pulse width has to increase by 40% or more when the capacitive touch sensor is touched

For the pre-lab students were supposed to have computed the approximate increase in capacitance of the touch sensor  they made (Al foil covered with a layer of packing tape) when touched by a finger, but many were scrambling to do it during lab, which increased the lab time. I did not tell students whether they had gotten the value right, nor whether their resistor and capacitor values were reasonable. Instead, I told them what my Dad always said, “Try it and see!” [I need to make a poster for that!] In fact, some students appeared to have calculated the capacitance close enough, while others messed up their units and were off by a factor of 100–1000.  I hope that in their design reports, they provide both the corrected estimates and what they did with the initial mis-calculation.

I did do a 5-minute mini-lecture when one of the students was stumped because he couldn’t find a formula to compute the resistance and capacitance, and several other seemed similarly stuck but were too nervous to say so.  I had a mini-tirade about how the course wasn’t about finding the right formula, but about thinking through problems with the tiny set of  formulas on the study sheet they’d gotten the day before.  Then I calmed down and stepped them through a series of questions to show them how to think about the problem:  the goal was to pick R and C to get the right low pulse width.  What was the capacitor doing when the output was low?  About what voltage did it have? About what current was there?  How much charge had to be removed from the capacitor to get it from one threshold to the other?  How long would that take with that current?  I did say that they could use the proper exponential decay formula if they wanted, but that we only needed crude approximations, so a constant-current approximation was good enough.

One of the beauties of the Schmitt trigger oscillator is that it will oscillate over a huge range of resistor and capacitor values, so even if the students were way off in their component values, the circuit would still oscillate, once they wired it up correctly.  A lot of them are still rather careless about converting schematics to wires on the board, and fixing wiring errors was a big part of their debugging time.  Several still had the wires in place from the hysteresis voltage measurement, which really interfered with the oscillator.  When the oscillations were visible on the scope, I  had them touch their capacitive sensors to see how much the pulse width changed.  Most of the students who had mis-computed the capacitance of the touch found almost no change when the sensor was touched, but (with only a little hinting) could figure out that this meant they had used too large a capacitor and tried again with a much smaller one.  (I’m so glad I had them buy a large assortment of capacitors, so that they didn’t get strong hints about the “right” values from what was in the parts kit.)

Once they had an oscillator that responded to touch with a large change in period, I had the students estimate the low pulse widths from the scope display.  Many found that they were not in spec for the pulse width, so had to change their resistor values.  I think that this exploration of the design space is a valuable aspect of this lab, so I actually am pleased that students did not immediately get the “right” answers.  I hope that some students recorded the low pulse widths with and without the sensor touched, and use it to compute a better estimate of the capacitance of the touch.  (If they didn’t, that is a quick addition to the lab that they could do Monday after class, since it only requires the oscillator board, an oscilloscope, and a 5V power supply—they don’t even need the Arduino.)

Once they had the oscillator working, I had them connect up to the Arduino boards, downloading the following code that I had written for them:

// Capacitive sensor switch
// Sun 2013 Jan 27 15:23 Kevin Karplus

// To use, connect the output of the hysteresis oscillator to
// pin CAP_PIN (default is digital pin 2) on the Arduino.
// The code turns on the LED on pin 13 when a touch is sensed.

// The Arduino measures the width of one LOW pulse on pin CAP_PIN.
// The LED is turned on if the pulse width is more than high_pulse_usec
// The LED is turned off if the pulse width is less than low_pulse_usec
// The LED state is unchanged if the pulse width is between these

// pin that oscillator output connected to
#define CAP_PIN (2)

// Two thresholds for detecting touch by change in period of oscillator
// The initial values here are not used---the values are automatically
// set when the Arduino is reset.
// The sensor should not be touched until the LED is flashed 3 times,
// to indicate that the automatic sensing is done.
static uint16_t low_pulse_usec=40;
static uint16_t high_pulse_usec=50;

void setup(void)
    pinMode(13, OUTPUT);
    digitalWrite(13, 0);

    // Assuming that the touch sensor is not touched when resetting,
    // find the maximum typical value for untouched sensor,
    // and use this for the lower threshold.
    uint32_t start_time=millis();
    while (millis()-start_time < 300)
    {   uint32_t pulse=pulseIn(CAP_PIN,LOW);
        if (pulse>low_pulse_usec)
	    {    low_pulse_usec =pulse;
    low_pulse_usec += 1;	// add some room for noise

    // Set the high threshold for detecting the pulse at 20% longer low time
    high_pulse_usec = 12*low_pulse_usec/10;

    // flash the LED three times to indicate that the board is ready
    digitalWrite(13, 0);
    digitalWrite(13, 1);
    digitalWrite(13, 0);
    digitalWrite(13, 1);
    digitalWrite(13, 0);
    digitalWrite(13, 1);
    digitalWrite(13, 0);

void loop(void)
    // Measure the pulse width from the hysteresis oscillator
    uint32_t pulse_width= pulseIn(CAP_PIN,LOW);

    if (pulse_width>= high_pulse_usec)
    {   // pulse is long enough to turn LED on
    	digitalWrite(13, 1);
    	// wait, to make sure LED stays on for 1/5 second
    else if (pulse_width<= low_pulse_usec)
    {   // pulse is short enough to turn LED off
    	// wait, to make sure LED stays off for 1/5 second

Most students had no trouble getting this code to turn an LED on and off from their capacitance touch sensor. A few students had trouble with poor wire connections to the Arduino headers. The 24-gauge wire that is provided in the lab is really too fine a gauge—a 22-gauge wire would work better. I think I may want to mention the flexible wire jumpers that I use for connecting off a breadboard (I prefer short solid wires on the breadboard, but flexible wires for off-breadboard connections). There are lots of hobbyist electronics places that sell the jumper wires (for as low as $4.32 for 65 jumpers ordered from China or $5.50 for 75 shipped from California by wosang). They aren’t really needed for the course, so I didn’t include them in the parts kit, but they do make connection to the Arduino a bit easier.

My co-instructor gave a brief tutorial on soldering, which included having students melt solder on scraps of copper-covered PC boards (blanks, not etched) to see the flow when the solder is hot enough.

The students were all showing me their solder joints after soldering up the boards, and most were ok, though I had to send a few back for reheating the cold solder joints. One student who was in a hurry had to reheat his solder joints twice, because they were cold both times, and the oscillator did not work. After the second time, he heated the joints enough and the board worked beautifully. (He was late for his next class, though.) A couple of student had gotten solder blobs into vias that they needed to put components through. In one case, we were able to clear it fairly easily with a solder sucker, but in the other case, the via and attached trace delaminated from the board by the time the hole was cleared. It is probably easier for the student to start over with a new board (I ordered lots of extras of this board), rather than try a complicated repair. Only one student soldered the 14-pin DIP in backwards. While it is possible to unsolder the chip and turn it around, that’s a real pain and it will be faster to start over with a new board and a new chip—the 50¢ board and 30¢ chip are not worth trying to salvage. The 60¢ screw terminal probably is worth removing—not for the part value but for the desoldering practice, since it is pretty easy to remove and reuse.

Overall, the soldering went fairly well for a group of students who had never held a soldering iron in their lives. A few students did not get the soldering finished, but will come in over the weekend (supervised by the undergrad group tutor) or after class on Monday (supervised by me). There will be two more soldering projects later this quarter, after which the students will be as good as most hobbyists at through-hole soldering (I’m not going to try surface-mount soldering with them!)

I’m not sure where best to break this lab in two next year. There are really three distinct parts: determining the hysteresis voltages, designing the relaxation oscillator, and soldering the oscillator (perhaps plotting out the full Vout vs. Vin transfer characteristic). I think it could profitably be broken into three shorter labs, spending a bit more time on characterizing the 74HC14N, then having a day to think about the RC values before coming back to the lab, then having a separate day just doing the soldering.

Overall, I think that the students are beginning to get the idea of the course, and starting to have some fun with the labs. I definitely need more time for the labs next year—I was in the lab from 2 to 7 today, and that is too long a stretch at once. I’m beginning to think that I’ll need to have three days a week of lab and only two of lecture.

2013 January 30

Tenth day of circuit class

In today’s class I had originally planned to cover the following topics:

  • RMS voltage. I keep putting off a discussion of the 3 different systems for reporting AC voltage (amplitude, peak-to-peak, and RMS), so I’d better start with it.
  • hysteresis.  I have a pretty decent writeup (I think) in the lab handout, but I’m going to have to step the students through it, because I’m not sure that all of them learn well from reading.
  • hysteresis oscillator. Yet another time to talk about RC time constants.  The problem here is going to be that there is a somewhat arbitrary scaling of the RC time constant based on what the threshold voltages are.

After last night’s late-night blog post, I decided to add a few minutes at the beginning of the class talking about the “comfort zone” and the “zone of proximal growth”, and how it was ok (even good) to be uncomfortable, but that I was trying to hit the sweet spot of maximizing learning for them without good feedback on when I had hit it.  There were likely to be times when I went too fast or too far, and took them into the range of “impossible”, where they either shut down or ran around in mental circles without getting there.  I pointed out that I was out of my comfort zone in teaching this class, and learning a lot about how to teach the subject, since the class was not quite like any of my previous courses, which had either involved students who had already started “thinking like engineers” or for which that was not a major goal.

As it turned out, there was a natural segue to this topic, as several students complained about how much time they were spending struggling with gnuplot.  They were reporting times in excess of 12 hours on gnuplot, when I had expected the plots for last week’s lab to take them only an hour.  They reported having more trouble using gnuplot than with the circuits concepts and electrochemistry that the lab was supposed to be helping them learn. I believe that learning to use a plotting and model-fitting tool will be very useful for them no matter what branch of bioengineering they end up working in.

I don’t think that the problems they were having are unique to gnuplot and changing tools is not likely to help—in fact, gnuplot has one of the simplest interfaces of tools that can fit multiple parameters for complicated functions. I’m not sure, however, where the conceptual difficulty is for them, and so I asked if one or two of the ones who were having the most difficulty could sit down with me and show me where they were getting stuck (after lab tomorrow, on Friday, or after class on Monday).  Perhaps by watching them work, I can get a better idea where the difficulty is and devise a lesson, handout, or other intervention to get them unstuck.  I also offered one-on-one tutoring to them (again after lab or in Monday’s office hours), but until I know what the sticking point is, my tutoring is likely to be pseudoteaching again, where I guide them through the process and we’re all convinced they’ve got it, but when they try a real problem on their own, they still get stuck.

Not everyone who was introduced to gnuplot is having this difficulty (a few students have reported to me that they are now applying gnuplot for their senior theses), but enough were having trouble that I certainly can’t dismiss the problem as irrelevant nor can I expect the students to tutor each other (an intervention that works well when most of the class understands the concepts, since explaining to the few who need help can help people clarify their own understanding).

The circuits topics that I wanted to teach went well.

I introduced RMS voltage as the DC voltage that provides the same average power as the AC signal of a given amplitude, and we did the definite integral for computing the average power.  (I gave them trig formula \cos(2\theta) = 2\cos^2(\theta)-1, and reassured them that I did not expect them to remember trigonometry—this may be the only place this quarter where we use a trig identity.)  I also had them derive the RMS voltage for a square wave, so they could see that the \sqrt{2}/2 ratio was a special case for sine waves and not a general phenomenon.

I then covered digital amplifiers and hysteresis, using the figures from the lab handout.  I think I got across the idea of hysteresis using the figures and  the example of a thermostat and furnace that you don’t want to cycle on and off a lot. It’s hard to tell whether they’ve really gotten the idea or not, though, and I don’t know how to check other than by seeing what they write in their lab reports.

The relaxation oscillator was not as thoroughly covered.  We stepped through the charging and discharging of the capacitor, but did not derive formulas for how long it takes to charge and discharge, as a function of R, C, the two threshold voltages, and the two output voltages.  We did wave our hands at the idea that all the times are proportional to the RC time constant, but did not attempt to determine what the proportionality constant is.  I suggested that they determine it empirically in the lab, rather than deriving the formula, since I’m not confident that they could derive the constants, given that the input voltage is decaying exponentially towards the output voltage.  The math seems simple to me, but explaining it to them would take more time than we had in class today, and I’m not sure how much they would retain of it.  I’m hoping that some of the more diligent students will attempt the derivation on their own, as it provides another concrete use for the \omega=\frac{1}{RC} formula.  I suspect that most of them can handle the algebra for the exponential decay towards 0V, but that they will have trouble with expressing the exponential decay towards 4V (the output high voltage).

I did demo the relaxation oscillator, using the same PC board that they’ll be soldering and displaying the output waveform with the BitScope USB oscilloscope I bought.  I had to power the Arduino board and the oscillator with a separate power supply, since my trials ahead of time showed me that the BitsSope could not display the signal if I powered the Arduino from the laptop.  I think that the problem has to do with the difference between the BitScope ground and the USB ground that is shared with the Arduino—I’ve not yet tried to track it down.  But with a separate power supply everything worked ok.  The projection of the BitScope oscilloscope display worked ok (despite their projection-unfriendly insistence on a black background), and I hope to be able to use it again in a later class.  It is a bit of a pain to set up before class, though, so I’ll want to use it only when the live demo is worth the time and the risk of equipment failure.




Formal reasoning in intro physics

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

My post last night on teaching engineering thinking had a coincidental resonance with another blog post that came out yesterday: Calculus and formal reasoning in intro physics, by Bruce Sherwood, one author of the textbook I’m using with my son for us both to learn calculus-based physics: Matter and Interactions. I’ve had several e-mail conversations with Bruce Sherwood, and I’ve been reasonably pleased with the textbook.  He is an infrequent blogger, but he generally has something interesting to say when he does post to his blog.

In the Calculus and formal reasoning in intro physics post, Bruce says

… there is a tendency for older faculty to deplore what they perceive to be a big decline in the mathematical abilities of their students, but my experience is that the students are adequately capable of algebraic manipulation and even calculus manipulation (e.g. they know the evaluation formulas for many cases of derivatives and integrals). What IS however a serious problem, and is perhaps new, is that many students ascribe no meaning to mathematical manipulations.

We are convinced that an alarmingly large fraction of engineering and science students ascribe no meaning to mathematical expressions. For these students, algebra and calculus are all syntax and no semantics.

This problem with formal reasoning may show up most vividly in the Matter & Interactions curriculum, where we want students to carry out analyses by starting from fundamental principles rather than grabbing some secondary or tertiary formula. We can’t help wondering whether the traditional course has come to be formula-based rather than principle-based because faculty recognized a growing inability of students to carry out long chains of reasoning using formal procedures, so the curriculum slowly came to depend more on having students learn lots of formulas and the ability to see which formula to use.

I had not thought of the problem along those, lines, but that is fairly consistent with what I’m seeing in the circuits class.  They can do algebra and calculus when the problems are set up for them, but they have difficulty turning word problems and electronics problems into the corresponding algebraic problems.  They also rarely do “sanity checks” to make sure that they haven’t reversed the sign or inverted the value.  If they see math as consisting purely of formal manipulation of symbols, with no attached semantics, or only a purely formal mathematical semantics, with no connection to the real world phenomena they are modeling, then the difficulty with setting up equations and the lack of sanity checks becomes much more explicable.

Unfortunately, being able to explain their behavior doesn’t immediately give me a handle on how to modify it—if this explanation is even the right one (or,  more correctly, if this model of their behavior is a good enough one to be useful).  I will be continuing to give problems that require thinking rather than applying a random formula, trying to get them to reason from a few basic principles rather than from memorized formulas.  My “basic principles” are not as basic as Sherwood’s, of course, since this is an electronics course, not a physics course.  Throughout Chapter 19 (which my son and I just finished), Sherwood prohibits the use of Ohm’s Law, which has not yet been derived in the book, insisting on more fundamental, but more difficult, reasoning based on fields, electron mobility, and density of mobile charges.  In my class, I’m happy to take Ohm’s Law as a fundamental principle in electronics, without going deeper into the physics.

I made a one-page study sheet for the students and handed it out today, listing the small number of formulas I expect them to have instantly available in their memory.  There are only 15 formulas so far, and most are pretty trivial.  I suspect that we’ll only add 4 or 5 more for the rest of the quarter.  I’ll be using all the impedance formulas in Monday’s quiz, but not much else.  But it will be a closed-notes quiz—I want them thinking, not randomly scrambling through their notes looking for a formula that isn’t there.  Of course, the small number of basic formulas doesn’t mean they’ll find the quiz trivial, because I’m not going to ask them to recite the formulas, derive them, or apply them to problems they’ve already done, but to apply them to problems they’ve not seen before.  They’ll be needing to figure out how to apply these few formulas to the design and analysis questions I’ll ask.

Teaching engineering thinking

Yesterday I wrote

Maybe I should recommend some generic problem-solving books, like Polya’s How to Solve It, since it seems that the class has not been taught many problem-solving skills. I keep feeling that I’m teaching stuff that they should have had much earlier, but clearly haven’t, as if every teacher they’ve ever had has pushed off teaching the important stuff in order to cram in more factoids. There are times when I’m tempted to kick the can down the road myself, but these are all seniors, and it seems almost criminal to let them graduate as engineers without ever having been taught to think like engineers. I’m going to end up working them pretty hard, trying to get them up to speed in circuits, writing design reports, and how-to-think-like-an-engineer in just 7 more weeks.

I’ve been trying to pin down just what I mean by “how to think like an engineer”—something I’ll need to have at least some handle on before I can teach students how to do it.  I have a few vague ideas of what it means, but not anything crisp and clear enough to serve as a design guideline for planning my teaching.  Here are a few random thoughts:

  • Engineers pay attention to details.  It isn’t enough to have the right general idea—the execution has to be right also.
  • Engineering is about solving new problems, not memorizing solutions to old ones. It is better to have a few general principles that can be used over and over in different contexts than an encyclopedia full of formulas and protocols for every known situation.  If the problem has already been solved, it isn’t really an engineering problem.
  • Design is often about a tradeoff between conflicting goals, or between goals and constraints that limit what can be done.
  • Sanity checks are essential.  Every schematic, every wiring connection, every computation should be subjected to quick checks for consistency.  Some of the checks are easy: Does every 2-terminal component on the schematic have two connections to it? Is every pin on the chip accounted for—either wired up or labeled as not connected? Do the units for the computation match (ΩF=seconds, not Hz)? Does replacing the ammeter with a short-circuit change the expected behavior of the circuit?  …
  • Design is not a process of randomly trying things until something happens to work, but of carefully planning how things should behave.
    Don’t get me wrong—I’m not denying the role that chance and luck can play in engineering. There are occasional serendipitous events, where something works despite mistaken thinking, but that is rare. My first patent, the plucked-string algorithm that Alex Strong and I developed, resulted from just such a serendipity—Alex had been attempting to implement something and had mistakenly added an averaging of two adjacent samples. My main contribution was to figure out why that mistake produced much more interesting results than what he had originally set out to do.  But even with that initial serendipity, we spent a couple of years doing careful design—coming up with different software and hardware implementations for the plucked-string algorithm (which we called the Digitar algorithm, but is now more commonly called the Karplus-Strong algorithm).  I even took a  VLSI design course so that we could implement the algorithm as a custom chip—a course that shaped my career for the next 15 years.
  • Debugging is a process of thinking carefully about why the circuit, program, device, system, … is not doing what you want, and what modifications to it should change it in the desired manner. It is even less random than design—one has to build useful mental models of the failing system that explain the cause of the failure, then determine modifications that would fix that mental model, before trying fixes in the real world.
  • There are no right models, just useful models and useless ones.  (Even that’s wrong: there are more useful and less useful models, where the usefulness depends on what questions you need to ask of the model.)
  • Quick estimates from rules of thumb and extreme cases are handy.  A capacitor is an open circuit at DC and a short circuit at ∞ Hz, so low-frequency and high-frequency behavior of RC circuits is easy to estimate without much computation.
  • Empiricism rules: the answer to the question “Is this right?” is almost always “Try it and see!”

How can you tell if someone thinks like an engineer (or will learn to think like one)?

Some people point to kids who like to take things apart to see how they work, and say that they are budding engineers.  While taking things apart to see how they work is sometimes done by engineers, it isn’t the normal mode (they even call it “reverse engineering”, because it is backwards from what engineers usually do).  Scientists take things apart to see how they work—engineers put things together to make them work.

I posted about science vs. engineering 2½ years ago. In looking over that post, I see that even then I was thinking about the differences in training:

There is a distinct difference in the training one should give a student who is planning to be a scientist and one who is planning to be an engineer.  Sure, the basics are the same at the beginning (basic science, math, lab technique, computer programming, statistics, and so forth), but the engineer has to be taught how to design and debug, while the scientist has to be taught how to question dogma and discover new ideas.  These are not the same skills at all and both need substantial practice before people are competent at them.

For scientists, the tradition has been to devote the undergraduate years to acquiring basic knowledge, but not to practice being a scientist at all.  As a result it takes 5–7 years of grad school (and often several years of post doctoral training) to turn science undergrads into scientists. For engineers, the tradition has been to do 2–3 years of basic training, followed by 2–3 years of project work of gradually increasing complexity, culminating in either a B.S. or an M.S. degree.

The shorter training time for engineers means that it must be much more focused—you can’t hope that the students will pick up skills they need gradually as a by-product of years of doing something else (the way that scientists are trained). Instead, the specific design skills and group management skills need to be explicitly taught and practiced while the students are still undergrads.  This has a lot of consequences for curriculum design, as almost all junior and senior courses have to include design practice, and there needs to be at least one big project (preferably one too big for a single engineer to handle).  Explaining these curricular needs to faculty trained as scientists can be difficult—they want to leave all that to the grad curriculum or one-on-one training of postdocs.

I’m afraid that the bioengineering students in my circuits class have all been trained like scientists, with a huge number of courses in basic scientific knowledge, but almost no training in debugging or design practice. Hmm, that’s not quite fair.  Several of them have worked pretty intensively on debugging wet-lab protocols, though mostly in senior thesis projects, not in regular courses.

I can’t teach everything about “thinking like an engineer” in one course, even if I could articulate exacly what I meant by it.  I will try to give them problems that are puzzles, rather than rote application of formulas, and that emphasize design goals rather than analysis of what is already designed.  Since the traditional circuits course is almost all analysis with very little design, this makes the crafting of this course into an engineering design challenge: I need to create something new, not just copy exercises and lesson plans from elsewhere.

Unfortunately, I’m still wrestling with the precise design goals of the course and the constraints imposed by the time available and the prior training of the students. I had taken “thinking like an engineer” for granted earlier, for example, and not thought of it as a pedagogical goal for the course.  Now I need to rethink how I present material and how I get students to wrestle with it so that their lifelong habits of thought are shifted.  I was thinking I would be adding a couple of new tools (from circuit design) to their toolbox of mental models, rather than having them build a whole new toolbox.

Having to debug a course design is a lot like other engineering design challenges, except that I need to debug the course while it is running—I can’t turn it off, restructure it, and turn it back on again.  The problem I have right now is that my mental model of the material and how the students would interact with it is not quite right (I get too many surprises), and I’m trying to decide if it is a good enough model to continue with, or whether I need to find a substantially different mental model in order to debug the course.

Perhaps my new view of needing to teach “thinking like an engineer” is wrong—maybe the problems I’m seeing are not that fundamental, but are just unfamiliarity with the material, and that a little more practice to get comfortable with it is all they need.  The pedagogical interventions I’d need to do are quite different in these two views of the problem, and I’m not sure how to tell which mental model is more useful.

Does anyone who got this far in my post-midnight rambling have any suggestions for me?

2013 January 28

Ninth day of circuit class

After the last class I wrote

So we have the basics now of Bode plots (just for gain, as I’m not sure we want to do much with phase in this class, at least not for a while).  I did not get to any electrochemistry or why stainless steel is a good mechanically and chemically, but not electrically, for implants.

I think that Monday will see more gnuplot plotting, looking at the impedance of more complicated circuits, so that they can better understand the behavior of polarizable electrodes like the stainless steel electrodes they were characterizing.  If I can show them how the Bode plots help think about and sketch the behavior quickly, I hope that they’ll have a better appreciation of this shortcut.  Given that plotting with gnuplot is easy, I’ll have to convince them of the usefulness of the Bode plots for thinking about circuits, rather than the classical approach of using them to do quick sketches of behavior.

It may be Wednesday before we get to hysteresis and the hysteresis oscillator that they will build on Thursday.

One other thing I wanted to do today but spaced: I wore my banana slug genomics t-shirt so that we could discuss the possibility of designing a t-shirt for this course, but then I forgot to discuss it.  I think I want to use the same basic “slug-dreaming” design, but put something different in the thought balloon.  I don’t have any good ideas yet for the thought balloon.  Given how much we’ll be doing with voltage dividers, doing something like an RC low-pass filter with the appropriate gain equation is not too bad an idea. [This did get discussed today, and students liked the idea of a T-shirt.]

Well, it will definitely be Wednesday before we get to hysteresis.  We did not get to talking much about stainless steel, though we did do some plotting of the electrode circuit.  The problem is that I started with a quick “do now” question to check that they had absorbed Friday’s material:

For each of the following circuits, give the gain at 1Hz, 1kHz, and 1MHz:

The four circuits I put on the board.  Of course, I used 0.01µF, not 10nF, and 0.56µF, not 560nF, since no one uses the milli- and nano- prefixes for capacitance, but CircuitLab is incapable of that distinction.

The four circuits I put on the board. Of course, I used 0.01µF, not 10nF, and 0.56µF, not 560nF, since no one uses the milli- and nano- prefixes for capacitance, but CircuitLab doesn’t seem to realize that.

I expected that most of the class would be able to do the resistance voltage divider, and half the class would get the low- and high-frequency gain values for the RC circuits. I expected that students would have trouble with the capacitance voltage divider, since I had suggested they look at it at the end of last Friday’s class, but with little expectation that any of them would have the curiosity to actually do it without being required to.

I was a little disappointed that no one in the class got any of the questions, even with far more time than I had planned to spend on them. I guess I’ve been guilty of pseudoteaching—something that looks like good teaching, but the students don’t actually learn. So we went over the 4 problems in class, with me extracting the answers from the students and pointing out where sanity checks are needed (like whether the corner frequency is 1000 or 0.001, based on keeping track of units). So what was intended as a 5–10-minute check on what students had retained turned into a 45-minute repeat of the previous class.

I’ve also told the students that there will be a quiz next Tuesday, covering everything we’ve done with impedance and voltage dividers. I’ll be making the quiz closed notes, since far too many students wasted time looking for magic formulas in their notes, rather than thinking about what they knew and using it. I will expect students to bring a calculator to class from now on also.

Now I have to come up with a quiz—and if it turns out that most of the class can’t learn this stuff without pages of mindless drill, then I’ll have to start assigning pages of problem sets, an approach to education that I’ve always hated.

That repeat teaching left me with less time than I had planned, so the only new material I covered was plotting impedance versus frequency for the model we had for the electrode pair:

The model the students are supposed to fit to the data from last week's lab—a standard model for a pair of polarizable electrodes.

The model the students are supposed to fit to the data from last week’s lab—a standard model for a pair of polarizable electrodes.

Before showing them how to set up gnuplot to plot the model, I first had them think about what happens at DC and at ∞ frequency.  After a bit of fishing, I finally got them to elucidate the behavior of a capacitor (open circuit at DC and short circuit at very high frequency), and figure out what that meant for the overall impedance.

I showed them the following gnuplot script (and walked them through it line-by-line, since I’m not confident that they understand function definition yet):

set xlabel "frequency (Hz)"
set ylabel "|Z| (ohms)"

set logscale xy
unset key

# voltage divider
divider(z1,z2) = z2/(z1+z2)

# two impedances (resistances) in parallel
parallel(z1,z2) = z1*z2==0? 0: z1*z2/(z1+z2)

# impedance of a capacitor at a given frequency
j = sqrt(-1)
Z_C(c,f) = 1/(j*2*pi*f*c)

# corner frequency for an RC time constant
freq(RC) = 1./(2.*pi*RC)

 R2 = 5.

 min(a,b) = a<b? a:b
 max(a,b) = a<b? b:a

set xrange [1:1e6]	# 1Hz to 1MHz
# set yrange [0.9*R2:1.1*(R1+R2)]
set yrange [*:*]

unset label
unset arrow

set label "f(R1*C1)" at freq(R1*C1),R1+R2
set arrow from freq(R1*C1),1e-12 to freq(R1*C1),1e12  nohead lw 0.5
set label "f(R2*C1)" at freq(R2*C1),R2
set arrow from freq(R2*C1),1e-12 to freq(R2*C1),1e12  nohead lw 0.5

set title sprintf("(%.3gF || %.3gohm) + %.3gohm", C1, R1,R2)
plot abs(parallel(Z_C(C1,x), R1)+ R2), \
 		R1+R2, R2

For those who don’t have gnuplot handy in another window, here’s what the script produces:

Plot of impedance of a model of polarizable electrodes, showing the asymptotes and the critical points.

Plot of impedance of a model of polarizable electrodes, showing the asymptotes and the critical points.

I had a little time to show them the plot of data that I had taken on the stainless steel electrodes and the somewhat poor fit I got. I also explained (a little) what the resistances and capacitance corresponded to physically: R2 is the saline solution, C1 is the insulation of the chromium oxide layer on the steel (and maybe other insulating effects), and R1 is leakage through the insulating layer.

After class, I went to the lab for office hours, and spent another 2 hours explaining the model, how to represent it in gnuplot, how to get impedance from the voltages they measured, and what plots I expected. I also talked a bit about the meaning of models—how there are no “correct” models, just ones that are more or less useful. One of the students had tried to fit a simple capacitance model to the electrode data, and the resulting plot was instructive in seeing where that simple model failed (the resistance is not infinite at DC, nor does it go to zero at very high frequency).

The students seemed to be understanding what I was talking about (I ask a lot of questions and draw most of the stuff out of the students, rather than just talking at them), but the same was true in class last Friday, but nothing was retained for today’s “do now” question. One of the students commented that he/she could do the problems with a few hints, but was lost without them. That’s actually an encouraging sign—the student has almost learned the material, and if they can just learn to give themselves the hints, they’ll be all set. One habit I want to wean them of is memorizing huge numbers of formulas. There are very few formulas in circuits worth the trouble to memorize—a few basic principles and an ability to apply them is far more versatile and less prone to stupid mistakes.

Maybe I should recommend some generic problem-solving books, like Polya’s How to Solve It, since it seems that the class has not been taught many problem-solving skills. I keep feeling that I’m teaching stuff that they should have had much earlier, but clearly haven’t, as if every teacher they’ve ever had has pushed off teaching the important stuff in order to cram in more factoids. There are times when I’m tempted to kick the can down the road myself, but these are all seniors, and it seems almost criminal to let them graduate as engineers without ever having been taught to think like engineers. I’m going to end up working them pretty hard, trying to get them up to speed in circuits, writing design reports, and how-to-think-like-an-engineer in just 7 more weeks.

After the office hours, I chatted a bit with a student in the EE circuits course who was in the lab trying to make up their first lab (which is a somewhat simpler voltage divider lab than our thermistor lab). The total set of parts for the EE circuits class is a lot smaller than for our applied circuits class and undoubtedly much cheaper (no sensors, no instrumentation amp, no PC boards, no solder sucker, only a handful of resistors in selected sizes, a 0.2W speaker instead of a 10W speaker, no transistors, …). The student was a bioengineering student who was taking the EE course because he wanted to do bioelectronics and EE won’t accept my course as a prereq for any of theirs (turf battles). He was envious of the more interesting labs that we were doing, even if they did take a lot longer. He also said that the EE course has not gotten to capacitors or impedance yet—they’ve spent all three weeks on equivalent circuits with resistors, voltage sources, and current sources.

I suspect that at the end of the quarter my students would not be able to pass the final exam for the regular circuits class (they have only a vague understanding of equivalent circuits), but could do all the labs and design exercises. I suspect that the EE circuits students would not be able to pass the final exam nor do the labs for my class.  Although both courses are intro circuits courses, we’ve chosen to emphasize very different aspects of the subject.

On Wednesday, I need to cover the following topics:

  • RMS voltage. I keep putting off a discussion of the 3 different systems for reporting AC voltage (amplitude, peak-to-peak, and RMS), so I’d better start with it.
  • hysteresis.  I have a pretty decent writeup (I think) in the lab handout, but I’m going to have to step the students through it, because I’m not sure that all of them learn well from reading.
  • hysteresis oscillator. Yet another time to talk about RC time constants.  The problem here is going to be that there is a somewhat arbitrary scaling of the RC time constant based on what the threshold voltages are, and I’m not sure I can convey that clearly, since I’m sure that developing the differential equation for charging and discharging capacitors through a resistance will just make their eyes glaze over.  They had all that in physics, and doing it again isn’t going to make it stick any better than last time.  I’ll have to think about this some for tomorrow, and see what I can come up with to make it more intuitive for them.

I also need to give them generic feedback on the second lab report—they got the lab reports back with specific feedback for individual reports, but no general comments that applied to several groups.  I think I’ll do that on the class website, though, rather than taking up class time.

Next Page »

%d bloggers like this: