Gas station without pumps

2013 February 25

Tinkering lab reports show problems

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

I thought that the tinkering lab (lab handout)had gone ok, because students had done a lot of experimenting and had all ended up with functional circuits.  But the lab reports that I graded this weekend indicated some serious problems:

• A lot of the students made serious errors on their schematics.  Shorts, missing wires, and mislabeled parts were common. I’m making the students who had serious errors redo the report, and keep redoing it until they can produce correct schematics.  It wasn’t just the weakest students in the class making errors on the schematics—almost everyone was.
• A lot of the students did not check their predictions of the behavior of the board when components were added between pairs of terminals.  If their initial predictions had been accurate, this would not have been a problem, but students with predictions that were way off didn’t check them.
• There was no evidence that anyone improved their mental model of how the hysteresis oscillator worked as a result of either making the observations (which about half the class did) or thinking about the model more (which those who did not check their predictions could have done).
• Some of the students appear to have poor technique for recording observations, as they tabulated observations that were not really consistent with how the boards behave.  Either they mis-recorded the conditions under which they did the test or they shorted together some nodes without noticing.  No one checked for consistency of the observations to see whether things that should have been nearly the same were nearly the same.

I’ll probably rant in class about wrong schematics ruining otherwise fine reports, and hope the message gets through that they have to check their work much more carefully.  They’ll really suffer on the labs that they have to solder up on the protoboards if they continue to work with such sloppy, useless schematics. I may rant about lab notebook technique also, since that will be even more important in biomolecular labs.

Next year, I’ll want to split this lab into 2, with one lab dedicated to collecting data, a class in between to analyze the data, and the next lab dedicated to doing the design.

2013 February 14

Tinkering lab

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

Today’s lab was a “tinkering lab”, using the oscillator board they made in the hysteresis lab as a component to make a light-controlled sound generator.  They did not have a specific goal, other than to use the oscillator board, to produce sound on the loud speaker, and to be able to control/change the sound by shadowing a phototransistor.

I had them try to predict the effect of adding resistors or capacitors between each pair of points on the oscillator board (+5v, GND, Cap, and OUT), and to test how many of their predictions were right.  A lot of students turned out to have such weak mental models of the oscillators that they couldn’t figure out what would happen in even the simple cases. Few of them were able to do the prelab exercise of predicting what would happen if the added components in various places. Most of them eventually remembered or figured out again how the oscillators worked, and so were able to modify them in reasonable ways, but a lot of lab time was wasted doing what was supposed to be prelab work.

A few of the students were trying to figure out what to do without even a schematic in front of them, and when they drew a schematic it did not correspond to what they told me they were trying to do.  They worry me a bit, as by this point of the quarter the students should be able to copy schematics accurately and wire from them, even if they are sometimes a bit hazy on how the circuits work.

I’m also finding that several of the students seem to be incapable of learning from written material—students with no understanding of FETs as switches seemed to understand it fairly well after I explained it—using almost the same words as I used in the lab handout.  I’m not sure I understand why the explanation given verbally seemed to work, while the same one given in writing seemed to fail.  I find it difficult to believe that they really can’t learn from written materials, so there must be a different explanation.  Too much in the handout, so that they shutdown while reading it?  Not having read the handout? (possible with some of the students, but unlikely with the ones I observed the problem in)

I rely heavily on written material to communicate both design goals and details about the parts they are using, so I really need to figure out what is going wrong with the written channel for information.  Is there a way I could write the lab handouts that would be more digestible for the students? If the difficulty absorbing information from written sources is a real one, I may have to do more lecturing, though that seems like the wrong thing to do, as engineers have to be able to read spec sheets and learn from written sources.

Only a few of the students did the systematic exploration of what components in different places and predicting/observing the effect.  I may need to reduce the emphasis on that next year, and focus their attention more on potentially useful interventions (one pair wasted a lot of time looking at the least interesting pair: connecting extra components between power and ground).

Everyone eventually managed to get loud sounds out of the loudspeaker, and to control the sounds by shadowing the phototransistor, but I think that some just copied what others had done, without completely understanding what they were doing.  I think that they all ended up with essentially the same design I had, with the phototransistor shorting out the capacitor in bright light.  Everyone did eventually get the right pFET driver for the loudspeaker, though one group worked through the other three circuits first, and found why they were less desirable. We’ll see in the lab reports whether all the groups can accurately draw their schematics and explain how their devices work.

Overall, I’m moderately pleased with how the lab went.  Students deepened their understanding of RC time constants and the hysteresis oscillator circuit, and they got a feel for “cut-and-try” engineering. But I think I need to rewrite this lab for next year, with a little more direction in which pairs of terminals are worth exploring and how to think about the effect on the oscillator.

2013 February 2

Idea for phototransistor/FET lab

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

Based on the conversation I had with the students at the beginning of class yesterday, I came up with an idea for a lab that uses both the phototransistor and an FET that should be fairly fun and easier than many of the labs we’ve done.  The students were saying they would enjoy a musical application—the student who mentioned it was thinking of a light harp, where the “strings” are light beams that you break with your hands to trigger synthesized notes.  It would be pretty easy for them to make a circuit that detects the presence or absence of light, but all the fun parts of such a lab are in the programming, which is not part of this class (and which most of the students have no training in).

I decided to try making a sound that the students could control in some way with a phototransistor, but not necessarily a particularly musical sound.  The obvious application of an FET is to put it in series with the loudspeaker and a power supply and turn the FET on and off.  The relaxation oscillator that they did for the hysteresis lab this week could be used to drive the FET (at least, if we lower the frequency down into a comfortable part of the audio range). The students don’t have another 74HC14N chip, but they don’t need one, since all four nodes of the hysteresis oscillator (+5v, out, in, GND) are available at the screw terminals of the board they soldered.

Since we are interested in increasing RC, we can do it by increasing C—adding another capacitor in parallel with the one on the board. All they need to do is connect wires from the board to a breadboard, add capacitance to lower the frequency, and connect the output to the gate of the FET.

So we’ve got sound (pretty loud sound if they use a high pitch) out, all we need is control.  The simplest thing I could think of was to put the phototransistor across the capacitor.  In bright light, it conducts a large current, discharging the capacitor and keeping the input low (thus keeping the output high).  In darkness, it conducts essentially no current and the oscillator oscillates as it did before we added the phototransistor.  At intermediate light levels, it conducts some current, which means that it takes the oscillator much longer to charge the capacitor up to the high threshold, so the output-high time is stretched.  If the current through the resistor is slightly larger than the current through the phototransistor, the oscillator oscillates at a low frequency.  If it is much higher, the oscillator output is stuck high, and if it is much lower, the oscillator oscillates at its maximum frequency.  So by shadowing the phototransistor, one can modulate the frequency of the output.

One problem with the design as a toy is that the resistor used determines the amount of ambient light needed to shut the thing off.  I had to add resistors in parallel with the one already in the oscillator to make the current large enough to oscillate even in dim light, and I needed to increase the current a lot more to have any control in sunlight.  When I had the current that high, though, the oscillator would not shut off with just room lights at night.

I suppose I can make a virtue out of this problem, though, by having the students measure the range of currents that they get from the phototransistor (with a bias voltage around the VIH threshold) for the lighting in the room and the shadowing they can do with their hand, then pick the resistance they would need to use in parallel with the existing resistor. After that, they could compute the capacitance they would need to add to get a reasonable high frequency in darkness.

This is a simple design exercise, gets another use out of the hysteresis oscillator board, and is sort of fun to play with (though the pulse-train buzzes do get annoying to listen to after a short while—I’m sure I’ll have a monster headache by the end of the lab session. I’ll try to write up this lab as soon as I get Monday’s quiz written.

I’m now thinking that next year I’ll rearrange the first 6 labs into several shorter labs:

1. buying parts kit and familiarization with it.  Marking bags of capacitors, learning to use multimeter to measure resistors.
2. thermistor lab using multimeter  (and make sure we have water hotter than 70°C and colder than 10°C)
3. thermistor lab using voltage divider and  Arduino
4. microphone lab getting DC characteristics with Arduino
5. microphone lab setting DC bias and learning to use the oscilloscope
7. soldering hysteresis oscillator design
8. phototransistor and FET lab
9. characteristics of stainless steel electrodes
10. characteristics of Ag/AgCl electrodes
11. audio amplifier with op amp, dual power supply
12. audio amplifier with op amp, single power supply

That order would give us more time to develop the notion of impedance before the electrode lab, as well as more time to learn to use gnuplot, but after 6 weeks will be in about the same place I hope to be at the end of next week after 6 weeks.  It might be necessary to spend two of the shorter labs on the dual-power-supply op amp, but we’ll see.

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.

constraint
the low pulse width has to be between 20µsec and 1 msec
goal
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.)

// 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(CAP_PIN,INPUT);
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.
low_pulse_usec=1;
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);
delay(100);
digitalWrite(13, 1);
delay(100);
digitalWrite(13, 0);
delay(100);
digitalWrite(13, 1);
delay(100);
digitalWrite(13, 0);
delay(100);
digitalWrite(13, 1);
delay(100);
digitalWrite(13, 0);
delay(100);
}

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
delay(200);
}
else if (pulse_width<= low_pulse_usec)
{   // pulse is short enough to turn LED off
digitalWrite(13,0);
// wait, to make sure LED stays off for 1/5 second
delay(200);
}
}


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.

Next Page »