Gas station without pumps

2015 July 8

Testing nFET body diode with function generator

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

Continuing yesterday’s post on the i-vs-v characteristics of the PSMN022-30PL nFETs, I decided to look at the body diode characteristics. I changed the circuit only slightly from

Circuit for measuring I-vs-V characterisitics of nFET.

Circuit for measuring I-vs-V characteristics of nFET.

to

The circuit is essentially the same, but some of the wires are swapped to make measurements all be in 0–3.3V range.

The circuit is essentially the same, but some of the wires are swapped to make measurements all be in 0–3.3V range.

The plots I got were the exponential dependence of current on voltage that I expected:

The leakage current around 6nA may be from the breadboard or ADC—note that the load resistor here is an open circuit, getting about 170MΩ resistance from the breadboard or the KL25Z ADC inputs.

The leakage current around 6nA may be from the breadboard or ADC—note that the load resistor here is an open circuit, getting about 170MΩ resistance from the breadboard or the KL25Z ADC inputs.

To get the straight lines to fit so nicely, I had to do two things: throw away any points where E20  was less than 5mV or E21 was greater than 3.29V (the voltages may have been going outside the ADC range of 0V–3.3V, and the last few counts at each and of the range are always a bit suspect), and subtract a tiny offset from the E20 voltage (1.2mV).

I did run into one surprising phenomenon: the max current was not as high as I expected.  With a 47Ω output impedance from the FG085 and a 10V maximum voltage, I expected the 27Ω resistance to give me a current of about (10V - 0.7V)/ (27\Omega + 47\Omega) = 126mA, but I only got 77mA.  I investigated further and looked at the voltage across a 27Ω resistor with no FET:

Both currents are show as positive, for convenience in plotting (as the KL25Z only records positive voltages—I swapped leads on the function generator to examine negative swing.

Both currents are show as positive, for convenience in plotting (as the KL25Z only records positive voltages—I swapped leads on the function generator to examine negative swing.

The triangle waves, which look ok with no load or with large impedance loads, get very distorted at high currents.  For triangle waves going positive, the current starts getting limited at about 72mA, and strong clipping kicks in at about 80mA.  For triangle waves going negative, the current starts getting limited at 50mA, and strong clipping kicks in around 65mA.  The clipping actually gets stronger as the voltage of the source attempts to rise further, so the waveform isn’t flat on top but dips.

Unfortunately, the current limits do not seem to be a simple thing.  Using a 3Ω load instead of a 27Ω load gets different values for the limits:

With a 3Ω load, the ultimate current limits are substantially higher.

With a 3Ω load, the ultimate current limits are substantially higher.

For positive wave forms, the limitation starts at around 74mA with strong clipping at 93mA, and for negative transitions limitations start around 52mA with strong clipping at 80mA. The values where the current limiting starts are about the same as before, but the strong clipping limits have gone way up.   It is probably reasonable to treat the FG085 as really having  either ±50mA current limits or –50mA,+72mA limits.  The specs for the LM6172 op-amp that drives the output is typical ±60mA, min ±50mA, so treating the limits as ±50mA seems reasonable.

Note that the bad glitches from the cheap fake DAC used in the FG085 are very evident in these plots—the glitches are at each of the high-order bit transitions, with the really big glitch in the middle of the output range (switching from 0x7F to 0x80).  The glitch there is about 3.2LSB (that is, the voltage for 0x80 is slightly less than for 0x7D), which is really terrible for an 8-bit DAC. The 0x40 transition has about a 1.5LSB glitch, and the 0x20 transition about a 0.7LSB glitch. Using a cheap DAC0800 multiplying DAC would have added about 50¢ to their parts and assembly cost (a big deal for a $50 retail product), but allowed them to increase the sampling rate and avoided the non-linearities.  Switching to a better microprocessor (like the KL25 from Freescale could have gotten them more bits, better linearity, and a fast sampling rate at no higher parts cost than the ancient ATMega processor they chose).

I noticed one other problem with the FG085 function generator when doing these measurements—the buttons have very weak springs and often don’t return after being pressed, because the caps rub against the holes in the panel (they made the holes a bit too small or used buttons with crummy springs).  If the button stays down, subsequent button presses look to the firmware like the earlier button pressed again.  I often had to flick the button back up by pressing it up from below the panel—not an ideal user interface!

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).

2015 May 5

First op-amp lab was quick

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

On Monday I provided a little feedback on the design reports for the electrode lab.  The big issues were

  • Students not reporting the models they were fitting to the data.
  • Students not reporting the parameters of the fits after doing the fitting.
  • Students choosing overly complicated models (like R+(R||C) for data showing constant impedance)
  • Students not modeling important phenomena (like the (R||C) input impedance of the voltmeters)

Little issues included

  • Using “due to the fact that” rather than “because”
  • Omitting leading zeros before a decimal point.  Numbers should never start with punctuation.

After that brief intro, I worked with the students to develop a block diagram for an audio amplifier using the electret microphone and loudspeaker that they had already characterized.  This had been part of their homework, but I expected them not to have really grasped the point of a block diagram.

Another thing I went over in class, because I’d seen problems with it in previous reports and prelabs ,was reminding students that V=IR is not a ritual magic incantation. Reciting it doesn’t make solutions to problems right, if it is just randomly applied.  I reminded them that the voltage has to be across the resistor that the current is through—picking random voltages or currents in the circuit is meaningless.  I showed them an example taken from the prelab they were turning in at the end of class.

When I did the grading for the prelab homework Monday night, I saw that many of the students managed to copy the block diagram we had done in class, but none had appropriately labeled the signals between the blocks.  I think I need to provide some more and better examples in the book.  (Ah, I see I already have marginal notes to myself to add a couple in Chapter 2.)

The V=IR error was very common, mostly with V was taken to be the power supply voltage, rather than the voltage across the resistor that biases the microphone.

Students also had a lot of trouble with computing the AC voltage of the signal out of the microphone, based on the loudness of the sound input and the sensitivity of the microphone. I knew this was a difficult assignment, but I thought that it would be relatively easy, because they had supposedly already created a worksheet for themselves as part of Lab 4 (the microphone lab).  Either they forgot everything they learned there, or they never really got the idea of the worksheet they created.  One student asked in class on Monday, quite reasonably, for a worked example.  I’m going to have to come up with one that doesn’t just do all the work for them—I know these students can fill out worksheets, but what I need to get them to do is to solve problems when the steps aren’t all set out for them.

The afternoon lab section (many of them working together) did much better on the prelab than the morning section—the difference between the sections has been noticeable from the beginning, but it seems to be getting bigger, not smaller.  For some reason the descaffolding is working better with the smaller section.  Individuals in the morning lab are doing quite well, but there are more floundering students in that section, and I don’t know how to get them back on track.

Even though the morning lab is struggling more than the afternoon lab, I think that both are doing better than previous year’s classes at this point of the quarter.  With only one or two exceptions, everyone in both lab sections got their op amp circuit designed, wired, and demonstrated within the 3-hour class period.  That means that Thursday’s lab can be a tinkering lab for most of the students, where they can try various ways of improving the design:

  • 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’ll talk about some of these possibilities in class tomorrow (plus stroking the students a bit about getting the lab done quickly). I attribute he good performance on the lab to them having put in more time on the prelabs, even if they didn’t get the answers to the questions exactly right.  Thinking about the design ahead of time (and getting a little feedback) goes a long way toward clearing up confusion they have had.

There are 4 more amplifier labs coming:

  • Instrumentation amps with a strain-gauge pressure sensor (measuring breath pressure and blood pressure using an arm cuff).  Will need to be 2-stage, since the INA126PA chips we are using aren’t rail-to-rail amplifiers.
  • Transimpedance amplifier fora photodiode to measure pulse.  This will also need to be multistage, since the first stage will have to have limited gain to avoid saturation.  After high-pass filtering much more gain will be needed.
  • Class-D power amplifier.  This is always the toughest lab of the year.  Even small mistakes can result in shoot-through current that gets the FETs hot enough to melt the breadboards (I have two breadboards that I’ve melted holes in).
  • EKG using only op amps (making their own 2-op-amp instrumentation amp, plus high-pass filtering and a second gain stage.  They’ll be using all 4 of the op amps in the quad op amp package for this amplifier.

I’m about a week behind on grading redone assignments—weekends are spent grading design reports, Monday nights grading prelabs, weekends plus Tuesdays adding to the book a chapter ahead of the students, and I squeeze in the redone assignments Wednesday or Thursday night, if I don’t crash too early.

2015 May 3

Ag/AgCl electrode lab went ok

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

Like on Tuesday, on Thursday I spent a long time in the lab, from about 9 a.m. to after 6 p.m., because it takes a fair amount of time to set up and clean up when we are dealing with liquids (in this case, salt water) in the electronics lab.  The lab itself went fairly smoothly and the students all seemed to be collecting good data.

As I feared, we ran out of one of the 4 stock solutions: 3l per concentration for 28 students was not enough, unless students shared by transferring solutions from one group to another.  Next year I’ll have to get 200ml/student made up, or change the way the lab is run so that students have 6 sets of cups already pre-poured, and just grab a cup that they haven’t already used.  I worry a bit about careless students not cleaning and drying their electrodes between uses, though and contaminating a low-salt solution with salty electrodes.

I had one surprise this year.  We changed which brand of EKG electrodes we ordered (from Vermed to some foam-backed electrode with no brand name—not a substitution I remember approving, but I probably would have if asked).  It turns out that the new electrodes do not seem to be silver/silver-chloride.  Instead of resistance around 10Ω as the Vermed electrodes have, the new ones are in the 10MΩ range.  They must be using some polarizable electrodes instead of non-polarizable Ag/AgCl.  I hope that they work ok for the EKG lab at the end of the quarter (10MΩ should be ok, as the instrumentation amps and op amps have input impedances of 1GΩ and 10TΩ respectively, so a mere 10MΩ resistance should be negligible).

I am going to have to rework a big chunk of the book this summer, though, as the measurements ran into trouble with the input impedance of the voltmeters not being too large to matter, as we usually assume.  The AC voltmeters claim to have 1MΩ  || 100pF, which is great at low frequency but at 1MHz, that’s only 1.6kΩ.  The 1MΩ is tightly specified, but I believe that the 100pF is only an upper bound: there may be considerable variation in the capacitance from meter to meter.

The students who were attempting to measure the impedance of the new foam-backed EKG electrodes were probably actually measuring the impedance of the voltmeter.  Several of the measurements of the stainless-steel electrodes were also marred by the input impedance of the voltmeters.  On Tuesday afternoon, if I have any spare time in the lab, I’ll try measuring the input impedance of the voltmeters myself, to see what it looks like.  The test setup will be a simple one: two voltmeters in series, driven by a function generator.  I’ll shunt one of the voltmeters with a smallish resistor (say around 500Ω) and plot the ratio of the two voltages as a function of frequency (I’ll need a moderately high voltage from the function generator to make sure that the voltmeter on the shunt has enough voltage).  The voltage ratio should follow a simple pattern: \frac{V_{meter1}}{V_{shunt}}=\left| \frac{Z_{meter1}}{R_{shunt} || Z_{meter2}} \right|.  I can model the meters as a 1MΩ resistor in parallel with an unknown capacitor and fit the parameters (trying both meters having the same capacitance, and having different capacitances).  I can even do another set of measurements swapping which meter I shunt.

I think that a lot of the weird data we saw in Tuesday’s lab came from using large shunt resistors, so that the voltmeter impedance became more important (smaller) than the shunt resistor.

I’m considering also putting in the book a derivation of how to compensate for the meter impedance (if it is known).  I think that I’ll move the electrode lab later next year, closer to the EKG lab, so that we can go more directly from the microphone lab and the loudspeaker lab into the audio amplifier lab, and so that the electrode characterization is more immediately motivated.

In Friday’s lecture, I talked briefly about the possibility that the problems we were seeing with model fitting were that we had neglected the voltmeter input impedance, but I did not work out the details, because I had to introduce them to op amps and negative-feedback amplifier configurations.

I like to use a generic negative-feedback configuration, which includes inverting and non-inverting amplifiers as special cases, as well as the single-power-supply variants:

Generic negative-feedback amplifier design using op amps.

Generic negative-feedback amplifier design using op amps.

On Friday we got through the derivation of the various gain formulas, based on letting the open-loop gain go to infinity, but I’ll have to refresh that on Monday and introduce the unity-gain buffer: especially the unity-gain buffer as a voltage source for a reference voltage between the power supply rails.

Next Page »

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

Follow

Get every new post delivered to your Inbox.

Join 315 other followers

%d bloggers like this: