Gas station without pumps

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.

2014 June 29

Soldered EKG from op amps

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

Today I decided to solder the EKG design from Instrumentation amp from op amps fine for EKG onto one of my instrumentation amp protoboards, leaving out the instrumentation amp chip—I wanted to see how much trouble it would be.  As it turned out, the build was fairly straightforward, but a little tedious. There are only dedicated spaces for 8 resistors on the board, but there are 9 resistors in the design I used, so one had to go elsewhere on the board.  I deliberately left out the low-pass filter on this implementation (eliminating one capacitor), which did not make a huge difference—I ended up with about 58µV peak-to-peak of 60Hz noise on my input signal (compared to about 40µV in the previous design with a capacitor for low-pass filtering), which is fairly small compared to the 870µV R spike or the 220µV T wave.  The 60Hz interference was large enough to interfere with the P wave and make it difficult to see whether or not there was a U wave.  Of course, these measurements were made in my bedroom/lab, which has a lot less 60Hz interference than the lab the students work in.  I’ll have to take the board into work and see how bad the interference is in that space.

Using a digital filter to remove the 60Hz noise reduced the 60Hz interference to under 100nV peak-to-peak (way lower than other noise components), producing very nice waveforms, even when sampling at 360 Hz.  I’ll probably want to include a digital filter Python script in the book so that people can see the cleaned up signals, even if there isn’t room in the course to design digital filters.

I still have to decide whether to have students do the EKG amplifier without the INA126P chip, using only op amps. Wiring up the bigger circuit takes time, and I’m not sure that 6 hours of lab will be enough time for students to debug their design and get it soldered—it took them long enough to solder the EKG with the INA126P chip, which has fewer components and fewer wires to route.  It took me quite a while to solder up the board, so it would probably take the students far too long.  Is the pedagogic value of designing and building a 2-op-amp instrumentation amp worth the time? I do want the students to end up with an EKG to take home, as it is a tangible artifact that can demo the function of.  I’m thinking that I could even drop the soldering of the pressure-sensor amp (since they don’t take home pressure sensors), and add soldering of the microphone pre-amp.  If I do that, I’ll probably want to redesign the protoboard again, making it an op-amp protoboard with no instrumentation amp slot, but with more resistor spaces.

Cutting one part that costs about $2.70 and the $1.90 thermometer might justify my switching back to the resistor assortment I used in Winter 2013:  1120 piece resistor assortment for $17.39 instead of 1280 piece resistor assortment (currently $10.65) without raising the lab fee.  Why would I want fewer resistors at a higher price? The 1120-piece assortment is 10 each of 112 values, while the 1280-piece assortment is 20 each of 64 values.  Also the 64 values don’t seem to be very repeatable from set to set, and some sets has duplicates (so only 62 or 63 different values).  The 112-value sets seem more reliably useful.  A hobbyist might be better off going one step further to the 3700-piece resistor assortment (25 each of 148 values), but I can’t justify the $31.48 price for my class. (The extra $14 would probably raise the lab fee.)

 

2013 March 8

Class-D power amp lab went smoothly

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

I was worried about the class-D power amp lab possibly being too complicated for a first circuits course, so I provided more scaffolding for this lab than for previous ones (see the handout and addendum).  We also spent a bit more time in class before the lab working as a group on the block diagram—though that was largely because the students seemed to be a bit clueless about the point of a block diagram on the last quiz.  I wanted to show them how to use the block diagram as design tool, showing how decisions in one block (like what power to deliver to the loudspeaker or what power voltages to use) propagated through the block diagram to other blocks.

In the lab yesterday, everyone came prepared with schematics, and I even was willing to look over them for obvious problems before the lab (in previous labs, I just said “try it and see”).  I still have a few students coming in with unreadable scribbles for their schematics—they see to think that the schematic diagram is something that they do “for the teacher” rather than for themselves as a working tool.  I refuse to help a student debug a circuit if they don’t have a schematic I can read, and I’ve had to do that refusal repeatedly with a couple of the students.  Students with unreadable or incomplete schematics are generally unable to debug their circuits—most of the debugging is finding differences between the wiring on the board and the drawn schematic, with a much smaller part being finding errors in the schematics.   The students who have been most productive are those who have been doing neat schematics (often using the drawing tool that they use for the final report) before coming to lab, and making changes to the schematics during lab as they debug, so that they leave the lab with a neatly done schematic ready to put into the report that accurately reflects what was actually done in lab.

In the three hours of the lab, everyone had their circuit working, or very close.  Both of the two groups that were close had amplifiers that produced gain, but had flaws: one was still making the output FETs too hot (probably a problem with the pull-up resistor sizing, possibly trying to run at a higher voltage or PWM frequency than was feasible for the design) and one had a lot of 60Hz hum being picked up (probably from having very loose wiring).  I think that the group with the loud hum just accepted that their design or construction wasn’t quite as good as hoped, and are just going to write up the problems. I think that the group with too-hot FETs is going to come in on Monday to try to finish the lab—they would have stayed later yesterday to finish, but they had to present posters in their tech writing class.

Since the poster session for the tech writing class was in “Jack’s Lounge”, the study area immediately next to the labs (and probably the most intensive group-study areas on campus—I’ve never seen it empty and there are usually 3 or 4 group study or TA office hour sessions going on),  I stayed after the lab to look at the posters.  There was quite a range, from grade-school-like reports on “something cool in engineering” to class projects to detailed senior thesis presentations.

I finally got home around 9pm, had some cold leftover pizza for dinner, and finished off the lab handout for next week’s lab on EKGs before midnight.

I had originally thought that the EKG lab would be the hardest one of the quarter, because of the low signal levels (interesting parts of the EKG signal are less than 0.1mV), but now I think that it is not much harder than the pressure-sensor lab, which did a lower-gain amplifier using the same chips and protoboard.  The use of the solderable protoboard does force the students to be more careful in their schematics and wiring, and they don’t have the problem of wires and components making poor contacts or falling out (like they do with the breadboards).  They are also much more likely to use short wires, which greatly reduces the problems with noise pickup.  I’m pretty pleased with the protoboard design I came up with, which is useful for both the pressure-sensor lab and the EKG lab:

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)

 

One important tool for the prototyping board is the PDF file that can be used for doing layout, either by PDF markup tools or with a pencil.    I might make some changes for next year, as I realized that it would be useful to have more access to the Rgain pins, particularly for EKG circuits that use them to get the common-mode signal to feedback to the reference electrode.  (We’ll probably just put a constant voltage on the reference electrode, rather than doing a feedback circuit to reduce the common-mode signal.)

After finishing the handouts last night, I spent some more time finishing reading the PhD thesis that is being defended today (I’m on the committee, but not the adviser).   I finally got to bed around 1am—not much later than usual, and not the all-nighter I was expecting to have to do to catch up (I’m still behind on several things, so there may be an all-nighter coming up).

%d bloggers like this: