Gas station without pumps

2015 May 14

Blood pressure lab

Despite fairly poor prelab homework turned in, the first half of the blood pressure lab went well.  After seeing how poorly students were doing on breaking down the problem into pieces (perhaps the main transferable engineering skill I’m trying to get them to develop), I ended up giving them more explicit instructions on the board at the beginning of lab:

  1. calculate sensor voltage difference for 100mmHg with 3.3v power
  2. measure sensor voltage difference for 100mmHg with 3.3v power (also 0mmHg and -100mmHg)
  3. determine upper and lower inputs of voltage for instrumentation amp INA126P from the data sheet, using worst-case rather than typical specs (“worst-case” meaning the smallest remaining voltage range)
  4. use Vout-Vref = G(V+ – V) to determine maximum gain to avoid clipping if input swing is +-180mmHg (+-24kPa)
  5. compute needed gain resistor, wire it up (and virtual ground)
  6. measure voltage at output of instrumentation amp at 0, +100mmHg, -100mmHg
  7. compute gain needed in second stage to get maximum range (without clipping) at final output
  8. wire up op amp and measure final output voltage at 0, +100mmHg, -100mmHg
  9. What is Vout as function of pressure?
  10. record with the PteroDAQ a blood pressure measurement with pressure slowly decaying from 180mmHg down to 40mmHg (not too slowly, or your hand will get swollen).  Check for clipping at high end.  Check that you are using nearly the full range. Check that pulsations are visible when plotting the data.
  11. Use bandpass-filter.py to filter the first channel of the recording (later channels will be discarded)

I may have to put some version of these instructions in the book, though this sort of hand-holding is precisely what I’m trying to cut out in the “descaffolding”.  I’m afraid we’re training a generation of technicians rather than engineers—they’re good at following very explicit instructions, but not so good at breaking problems down into smaller problems.

With these explicit instructions, most of the students managed to get breadboard versions of the pressure sensor amplifiers working. I may have to help out bench 4, as it turned out that their pressure sensor seems to have a 0.7mV offset (which is pretty big—way out of spec).  They’ll have to decide whether to change benches to get a different sensor, compensate for the sensor offset electronically, or compensate for it in the post-processing of the data.  Any of these solutions would be acceptable, but they aren’t all equally easy.

The students needed less help than in previous years in the lab, so I think that having the students struggle with the prelabs, even if they don’t get the answers right, is helping make the lab time more efficient—they only have to get past a couple of misunderstandings, rather than trying to learn all the material for the first time in lab, as so many did the last couple of years.

In lecture on Wednesday, I went over blood pressure waveforms defining pulse rate, systolic pressure, and diastolic pressure, and talking about the frequency ranges of the pulse rate. I then explained to them how the filter program was run (many students still don’t know about the “<” and “>” conventions for standard in and standard out on command lines). I also showed the gnuplot trick that allows using standard out from a program in place of a file in a plot command:
plot '< python bandpass-filter.py < pressure.data' using 1:3 with lines

I did not explain how digital filters worked, but I did say why I chose Bessel filters (to preserve as much of the time-domain structure of the signal as possible).  In response to a question I also explained the effect that choosing 5th order filters had (the rolloff as f5 or f–5, rather than f1 or f–1 as with a first-order RC filter). I also explained that the computation required more and more precise numbers as the order got higher, and that 5th-order was a good tradeoff between needed precision and fast rolloff.

One thing that I didn’t get to was explaining that “filtfilt” does the filtering twice: once with time going forward and again with time running backwards. The time reversal cancels a lot of the distortion in the time domain (so the choice of Bessel filters is not crucial), but doing two passes also doubles the order of the filter, so that the rolloff is really f10 or f–10.

I did remember to tell students that they needed to have the scipy package installed in order to run the filter program, and that if their python was installed from python.org that they could probably just run “pip install scipy”. At least one student in the class is using the Anaconda installation of python, which already has scipy installed.

At the end of the lecture I had only 10 minutes left, so I did not get into the internals of instrumentation amplifiers (needed for the EKG lab at the end of the quarter) nor transimpedance amplifiers (needed for next week’s lab). Instead I covered the voltmeter impedance measurements I made last week, explaining how I did the measurements, how I did the fitting, and what the results were.  In particular, I mentioned that swapping the sets of leads changed the behavior, so the extra capacitance (beyond the 100pF of the meter itself) appears to be coming from the leads.  I sent the data files and gnuplot script to them via e-mail, after one student requested them.

2015 May 13

Checking on my pedagogy

Filed under: Circuits course,Uncategorized — gasstationwithoutpumps @ 08:40
Tags: , , ,

Mark Guzdial just posted some of his pedagogical advice for teaching beginning programmers in How to Teach Computer Science with Media Computation | Computing Education Blog.  I decided to check how much of this I follow in my applied electronics course, which is aimed at a similar level of student (college students with no previous exposure to the content, and perhaps a belief that the material is not relevant or over their heads).

Over the last 10 years, we have learned some of the approaches that work best for teaching Media Computation.

  • Let the students be creative. The most successful Media Computation classes use open-ended assignments that let the students choose what media they use. For example, a collage assignment might specify the use of particular filters and compositions, but allow for the student to choose exactly what pictures are used. These assignments often lead to the students putting in a lot more time to get just the look that they wanted, and that extra time can lead to improved learning.

I’ve not allowed students much room for creativity in the course.  Of the 20 3-hour lab sessions, only one is a “tinkering” lab that allows students to explore several different things.  It may be the most fun of the quarter, and I should look into more ways to let students play with electronics design.

  • Let the students share what they produce. Students can produce some beautiful pictures, sounds, and movies using Media Computation. Those products are more motivating for the students when they get to share them with others. Some schools provide online spaces where students can post and share their products. Other schools have even printed student work and held an art gallery.

I’ve not had the students share their work.  This is difficult to do with the small electronics projects they do—unlike media computation, there isn’t an art by-product of the design process.  The electronics, being hardware and often on breadboards, is much harder to share than software, and the output is generally not easy for average students to appreciate. (EKG traces, though interesting, are not really art-gallery material.)

  • Code live in front of the class. The best part of the teacher actually typing in code in front of the class is that nobody can code for long in front of an audience and not make a mistake. When the teacher makes a mistake and fixes it, the students see (a) that errors are expected and (b) there is a process for fixing them. Coding live when you are producing images and sounds is fun, and can lead to unexpected results and the opportunity to explore, “How did that happen?”

I have always coded live in my classes.  All my lectures are extemporaneous improv performances with audience participation.  I certainly show debugging when doing gnuplot scripting live!  For the electronics design, it is a little harder to show debugging, as most of the problems that occur are difficult to debug at the lectern (I don’t usually carry oscilloscopes and voltmeters around with me, though I have taken out my Swiss Army knife to reseat a loose wire in a screw terminal).  Design errors are also hard to show how to debug—introducing fake errors in a design just confuses students, rather than clarifying the debugging process.  Real errors don’t get caught until the circuits are actually built, which takes more time than is available in a 70-minute lecture.

  • Pair programming leads to better learning and retention. The research results on pair programming are tremendous. Classes that use pair programming have better retention results, and the students learn more.

I have students work in pairs for every lab, and I force them to change partners every week.  This frequent partner changing prevents the common problem of one student carrying another through the course, and allows me to deconvolve performance into individual grades (which I have to issue at the end of the quarter). I do see evidence that students working in pairs do a better job on doing the designs than students working alone, though a big part of that may be just that max(a,b) is better than average(a,b)—that is, that the pair does as well as the better of the two students.

  • Peer instruction is great. Not only does peer instruction lead to better learning and retention outcomes, but it also gives the teacher better feedback on what the students are learning and what they are struggling with. We strongly encourage the use of peer instruction in computing classes.

The students do help each other learn in lab—particularly in the afternoon section.  As long as I’m around enough that they check confusing points with me, rather than propagating wrong ideas, the peer instruction works well.  I think that the afternoon lab section has been better about checking with me when they are confused.  A lot of the morning section still seems caught in “answer-getting”, asking their friends for the “answer” rather than for help with the method—that sort of sharing interferes with learning, rather than aiding in learning.

  • Worked examples help with learning creativity. Most computer science classes do not provide anywhere near enough worked-out examples for students to learn from. Students like to learn from examples. One of the benefits of Media Computation is that we provide a lot of examples (we’ve never tried to count the number of for and if statements in the book!), and it’s easy to produce more of them. In class, we do an activity where we hand out example programs, then show a particular effect. We ask pairs or groups of students to figure out which program generated that effect. The students talk about code, and study a bunch of examples.

I’ve not developed a good set of worked examples. Part of the problem is that I have trouble coming up with good design exercises, and I’ve ended up using almost all I’ve come with as assignments, leaving very little for use as worked examples.  I see this as the biggest hole in my book and in my course, and I hope to try to fill it in a bit over the summer.

Another problem with worked examples is that I’m using this course to try to “descaffold” the students, who have been getting far too much fill-in-the-blank sort of labs and homework.  I’m trying to get them from having their hands held for everything to being able to solve many-step design problems in only 10 weeks, which is probably an impossible task. I just wish that other teachers would do less scaffolding, so that the students were used to doing some problem solving and not just rote procedure following.

So I need to come up with worked examples that give students an idea how to solve multi-step problems (subdividing a system into parts, calculating sensitivity of sensors, working out needed gain by working from input and output constraints, … ) without solving the specific problems that they will address for them.

 

2015 May 11

Lecture on pressure sensors

Today’s lecture was fairly straightforward:

  • Feedback on the audio-amplifier design report
  • Explanation of RMS vs. amplitude vs. peak-to-peak voltage measurements
  • How pressure sensor works
  • Wheatstone bridge, developed from voltage divider, with second fixed voltage divider to subtract off effect of supply voltage changes

I had wanted to get to the internals of how an instrumentation amplifier is built (the 3-op-amp and 2-op-amp designs), but that can wait until Wednesday.  I also wanted to do a demo of the pressure sensor with digital filtering, but that can wait until Wednesday also (and I forgot to bring in my KL25Z board today anyway).  Discussions of systolic and diastolic blood pressure will need to be done on Wednesday also—I’ll start with that, then move to the demo and show how to measure pulse rate and estimate the blood pressures from the recording.

The main feedback I gave on the design reports consisted of the following points:

  • A lot of students are still invoking V=IR without thinking about what the variables mean—they have to be talking about the voltage across and current through the same resistor, not some other random voltage in the system.  For the design they just did, it was impossible to know the voltage across the resistor until the power supply voltage was chosen, but the voltage across the resistor was not the power-supply voltage!
  • Many students did not justify their design choice for the power supply.  There were constraints on it (from the op-amp data sheet), and they should have chosen a voltage near the upper end, because they wanted as loud an output as possible, and the current limits increased with power-supply voltage.  One or two sentences that said those two things would have sufficed.
  • RC time constants have units (called “seconds”).  I showed the students that ΩF is seconds, by using the definition of Ω as V/A, A as C/s, and F as C/V.
  • Voltage gain, on the other hand, is unitless, being a ratio of two voltages.  I also explained the convention of showing what the ratios are of, express  gain in “units” of V/V.
  • The gain for their audio amplifiers needed to be designed (based on the current limits at the outputs and the loudspeaker impedance, divided by the calculated or measured input voltage to the amplifier).  Too many students got a hint from the group tutor for the class (that turned out to be wrong) and took it as a specification, rather than doing their own design.
  • Many students did not report their loudspeaker impedance, but it was essential for computing the voltage at which the amplifier would clip, and different students had different loudspeakers (some 6Ω and some 8Ω).
  • Paralleling op amps doesn’t increase the gain, merely the current limit for the amplifier.  So clipping happens at a higher voltage, but the gain for small signals remains unchanged.
  • Several students had misdrawn the gain control circuit, using the two ends of potentiometer symbol as if it were a variable resistor. I showed them both the standard symbol for a variable resistor and how to draw the potentiometer used as a variable resistor correctly.
  • Lots of students had very approximate gain measurements, because they had relied exclusively on the oscilloscope for measuring voltages.  I explained why the oscilloscope is inherently less accurate for measuring voltage than a voltmeter.
  • I explained that “surround sound” and “stereo” require different signals to the multiple loudspeakers—multiple speakers wired to the same signal don’t produce the aural position illusion that stereo and multi-channel sound does.
  • One of my pet writing peeves is the mixing up of prepositions in “substitute x for y” and “replace y with x”.  Note that what replaces what swaps positions in the two phrases.  When students mix and match to get “substitute x with y” or “replace y for x” I don’t know whether the verb or the preposition is dominating the meaning.  (In some dialects of English one or both of these phrases may be unambiguous, but they don’t seem to be consistently used in California, so I treat them as errors, rather than as dialect variations.)
  • Students are still starting numbers with periods.  I’ve told them repeatedly not to—numbers shouldn’t start with punctuation (other than a + or – sign), and there should always be a digit in front of any decimal point.
  • The triangle used as a ground symbol should always point down.

2015 May 8

First instrumentation-amp lecture

I started today’s lecture by returning a parts-and-tools kit to a student who had left it in lab yesterday—but admonished students not to tease him, since I had left my laptop in the classroom on Wednesday (a much more valuable item in a much less secure location).  That’s the second time in about a year that I’ve left my laptop in a classroom, which is something I never used to do.  (Of course, I’ve been using my laptop in classes a lot more than I used to, so it may not be that I’m getting old and forgetful, just that I have had more opportunities to leave it behind.)

I talked to the students about color-coding their wiring on their breadboards and on their prototyping boards.  The main lesson about color-coding was that black was reserved for ground, red for the positive power supply, and that I had four other colors available for them (blue, green, yellow, and white) in 22-gauge wire. They also have 24-gauge wire in the lab in white and orange, but I’m trying to discourage the use of 24-gauge wire, since it is not well held by the breadboards or KL25Z-board headers, and debugging the loose wires is a pain. I told them that I would not help them debug any boards that did not follow the red and black convention (red for all connections to the positive power supply and for nothing else, black for all the ground wires and nothing else). The other wires I suggested be color-coded on both the schematic and the board, based on the function. For example, all the virtual-ground wires might be white, all the input wires blue, all the wires after pre-amplification green, and so forth.  The exact color coding they use doesn’t matter, as long as they document it clearly and use it consistently.

Hmm, it looks like I’ve never blogged about the newer version of the prototyping boards, so I should include a picture here. I did include a picture before in Twenty-first day of circuits class:

Instrumentation amplifier protoboard with circuit wired for the pressure sensor lab (top left connector to pressure sensor, bottom center connect or to Arduino)

Instrumentation amplifier protoboard with circuit wired for the pressure sensor lab (top left connector to pressure sensor, bottom center connect or to Arduino)

Here is a layout as represented in the Eagle program. Most of the PC board wiring is on the bottom layer, but the +5V power supply crosses over on the top layer (the red trace).  We’ll actually use the 3.3V supply on the KL25Z boards, not +5V power, but that is a minor detail.

This is a layout of the board as shown by Eagle.

This is a layout of the board as shown by Eagle.

The students are given a worksheet for them to plan their layouts on:

This layout worksheet is distributed to the class as a PDF file.  The students can either mark up the PDF with  PDF editing tools (which some students have done successfully in the past), or draw on it with pencils or colored pencils. Only the holes that wires can be placed in are shown—the holes intended for components are omitted from this worksheet.

This layout worksheet is distributed to the class as a PDF file. The students can either mark up the PDF with PDF editing tools (which some students have done successfully in the past), or draw on it with pencils or colored pencils.
Only the holes that wires can be placed in are shown—the holes intended for components are omitted from this worksheet.

I also talked about the importance of keeping wires short and close to the board, and of not routing wires over components.  I’m not expecting students to really internalize that message until they’ve had to debug an inaccessible chip in a nest of long wires, but I’ll put the message out there as often as I can.  I’ve already grumbled at several students in lab for having incomprehensible tangles of wires that were all one color, and I’ll continue to do so.

After the brief warm-up on wire colors, I talked about instrumentation amps as circuit blocks—how they differed from op amps, though both look like differential amplifiers. The key is that op amps have unspecified gain and offset, so need to be used in a negative feedback circuit, which turns them in to amplifiers for single-ended inputs, with inputs and outputs both referenced to a single Vref.  The instrumentation amp has a specified gain (usually controlled by a single external resistor) and a true differential input, with the output still referenced to an external Vref input.

I talked about the output voltage limits of the INA126PA chips they’ll be using, but I did not go to the data sheet to look up the limits, but made up some approximate ones.  I warned them that I was making up approximate ones and that they needed to look the real limits up on the data sheet, but I’m betting that over half the class won’t do that, preferring to believe numbers in their notes that they have been told are fake to looking up the real numbers.

I then had the students help me create a Vref source (a pair of resistors in a voltage divider, followed by a unity-gain buffer), so that we could take current from Vref without violating the voltage-divider constraint.

I showed the students the prototyping board worksheet and where all the components went, and explained how to use the worksheet to do layout before soldering.

I ran out of time, so on Monday, I’ll have to talk about the pressure sensors they’ll be using, and about what the inside of an instrumentation amp consists of (how to build one out of op amps).  I’ll want to do both the 3-op-amp design and the 2-op-amp design, because I’m going to have them build their EKGs in the last week using the 2-op-amp design.

2015 May 7

Lecture in middle of first op-amp lab

Filed under: Circuits course — gasstationwithoutpumps @ 16:47
Tags: ,

The lecture between the halves of the first op-amp lab did not cover much material.  A big chunk of the first part was a discussion with the class about whether we should have a midterm quiz.  After much discussion of the advantages and disadvantages of different approaches, we finally decided that I would give them a take-home, ungraded quiz, so that they could test themselves and later ask questions in class for things they needed more help with. This discussion also brought out some suggestions from students of additional resources that they had found useful (Khan Academy videos, the new edition of Horowitz and Hill, and the All About Circuits web textbook). I also got a chance to give them some reassurance that they are doing well, since some are getting discouraged. I’m packing a lot into the class, and it is easy for the students to get overwhelmed—especially since some are just now getting to capacitors in their algebra-based physics classes.

Because most of the class had working audio amps in the Tuesday lab, I made a number of suggestions for a tinkering lab on Thursday.  In addition to the ones I already mentioned in

  • Switching from a symmetric dual power supply to a single power supply.
  • Paralleling two op-amp chips to get twice the current capability.
  • Adding a potentiometer for variable gain.
  • Adding a unity-gain buffer to separate the loudspeaker driver from the gain amplifier.
  • Adding a tone-control circuit, like the Baxandall tone control on http://www.learnabout-electronics.org/Amplifiers/amplifiers42.  They can’t use exactly that circuit, as they have only 10kΩ potentiometers, not 100kΩ ones.  The idea can be adapted, or the students could do simple treble-cut or bass-cut circuits.
  • Using a loudspeaker as a microphone. I think that should work, as I get about a 500µV signal from my loudspeaker when I talk into it.  The don’t need any DC bias for the loudspeaker mic, and they may even be able to eliminate their high-pass filter, as the loudspeaker mic can be set up to have its output already centered at 0V.

I also suggested hooking up a plug to the output of a music device, investigating how the amplifier clips, and hooking up a function generator (with a voltage divider) to replace the input and high-pass filter so that gain can be measured without the difficulty of varying sound level in the room.  The point of the lab (after they’ve done a good job of explaining how they designed the basic amplifier) is to get them to play with the design—to do something they see as fun.

I also talked about why some student had been seeing asymmetric clipping when they hooked up their loudspeakers.  The key concept (which they had not had) is that the input-referenced voltage offset could be as large as ±4.5mV for the MCP6004 op amps that they are using. With a gain of 50, that makes an output offset of up to ±225mV, but with an 8Ω loudspeaker the current limits cause clipping at about 200mV, so the output signal could be shifted far enough so that half of it is clipped, even it all looks like it should be in range.  I talked a little about the possibility of doing offset nulling, but didn’t really give them a circuit that they could use.

In lab today, people did seem to be having a lot of fun, and both morning and afternoon sessions ended early.  I’m looking forward to reading the design reports this weekend, because they should be different in interesting ways, as different students chose different directions to explore.  I helped a few students debug their circuits (as usual, the most common problems were loose wires, power supply not providing power, and scope probes set differently from what the oscilloscope thought).

« Previous PageNext Page »

The Rubric Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 313 other followers

%d bloggers like this: