Gas station without pumps

2012 December 19

Trying the oscilloscope practice lab

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

The back of the electret mic, which looks just like the drawings of the CUI Inc part number CMA-4544PF-W, the microphone I’ll be including in the parts kit.

While my son worked on debugging the data logger software on Windows, I tried out the Oscilloscope practice lab, using the power supply, scope, and multimeter in the lab.  The first bench I sat down (Bench #1) had no power supplies, though I believe that problem will be remedied before classes start (returning the borrowed supplies from another lab or from other benches in the lab, since several had 2 power supplies).

The power supplies are quite nice, and provide very precise voltage control, but it will definitely be necessary for the students to  use the power supply together with the multimeter set up as an ammeter to measure the DC current through the microphone.

The current through the electret microphone as a function of the voltage across it.Note that the current measurements fluctuated by about ±0.3µA.

The current through the electret microphone as a function of the voltage across it.
Note that the current measurements fluctuated by about ±0.3µA.

I clearly needed to do more measurements between 0 and 1v, to get a better sense of the shape of the curve there, and the limitations on using the microphone at a low voltage. Had I been by myself, I might have spent more time in the lab, but we had to get my son home for an early dinner so that he could get to his theater practice on time. I’ll certainly be suggesting to the students in the write up that they use 0.1 v spacing up to 1 v, then 1v spacing up to 10v (the maximum rated voltage for the mic they’ll be using).

It was a good thing I went in before the course started to play with the equipment—I had expected some trouble with the oscilloscope, since those controls seem to be randomly organized on all digital scopes, but I had not expected trouble with the multimeter. The fancy ones in the lab have options for front or back connections of the leads, and for triggered or auto-running measurements. It took me a bit of random button pressing to figure out how to turn off the triggering and get continuous measurement.

I also put the microphone in series with a resistor and stuck a scope probe on it. It took me quite a while to get the voltage scaling and time base set reasonably on the digital scope, but I eventually managed to find all the controls I needed, and I think that I can show them to the students. Given the complexity of the user interface for the oscilloscope, I think that the simple measurements of the current vs. voltage curve and getting the scope to show both continuous waveforms (whistling or speaking) and triggering on a hand clap will be sufficient for the second lab. If students are done sooner, I could have them hook up the frequency meter and try to determine the pitch of their whistling or sustained vowel sounds.

The digital scope does allow seeing much lower frequency waveforms than my analog scope at home, and was clearly able to see 2Hz signals from moving my hand towards and away from the microphone (though 4Hz signals from faster hand movements were much clearer).

I still need to decide how many amplifier labs will use the microphone. I was figuring that the first op amp lab would do a gain of around 6 or 7 with AC coupling.
And that we’d follow that up with a power amp lab using an nFET and a pFET to make a class AB output stage after an op amp, but I’ve not wired up a power amp circuit yet, and I should do that before I order 20 copies of the transistors.

I think I’ve done all my orders except the Digikey one (and plastic bags to put the parts in). Unfortunately, it looks like lost 2 days worth of edits to the page of parts orders, which is going to be hellishly hard to replace. [Correction: the updates were in the autosave repository, and I was able to restore all but a few minutes work.  Hooray for autosave!]

2012 September 1

Pressure sensing lab possibilities

I’ve been thinking about a lab in the middle of the circuits course that uses linear circuit modeling techniques to model a non-electrical system.  This is a common engineering technique, particularly for low-speed fluid flow, and so would give the bioengineers who are not interested in bioelectronics another reason for learning the material of the circuits class.

My first thought was to have two containers of water connected by a hose with pressure sensors in each:

Two reservoirs of water connected by a thin hose, with a pressure sensor near the bottom of each reservoir.

If we can induce a sinusoidal pressure variation in one reservoir, then analyzing the response in the other should allow us to characterize the hose in much the same way that we characterized the electrodes in the electrode lab.  We may want to put the pressure sensors next to the hose outlets, so that we can also do time-of-flight measurements for a single pulse traveling through the hose.

I think that the appropriate model is probably something like a large capacitor for each reservoir and a transmission line for the hose. If the characterization turns out to be fairly easy, then the lab could be extended by having the students characterize hoses of different lengths and wall stiffness (we probably want to keep a constant inside diameter, so that we can use barbed connectors for the hose).

We are looking mainly at static pressure here, not flow, so applications are mainly to very low-flow systems, like the fluidic systems of lab automation or blood pressure measurements in catheters.  Blood pressure measurement is a good application, as we are interested in the shape of the low-frequency blood pulse as well as the DC pressure.

Pressure sensors

We need to think about what pressure sensors to use and how to produce the pressure waves we’ll measure. In the robotics club, we had some success using Freescale’s MPXHZ6250A integrated pressure sensors, which are $10 each in quantities of 10. Those produce a ratiometric (that is, proportional to the supply voltage) voltage output that is linear over the range 0–250kPa (absolute pressure).  If we read them with the Arduino’s 10-bit ADC, we get a resolution of about 244Pa (1.8 mm Hg, to use the old-fashioned units that blood pressure is measured in).  That’s not really enough resolution for blood pressure measurements, and we’d need a pretty powerful excitation to make much difference in the reading, since the resolution is about 1 inch of water.

Freescale makes several other pressure sensors, with different ranges.  Their “medical” sensor, MPX2300DT1, made with biocompatible materials, is a gauge pressure sensor (which is more appropriate for our setup than an absolute sensor) and a full-scale range of 300mm Hg (40kPa).  It costs only $4.80 in quantities of 10.  The part is intended for disposable medical applications (since it makes contact with the patient’s blood), and may not be durable enough for repeated use in a lab class.

But the MPX2300DT1 is not an “integrated” sensor like the MPXZ6250A, which means that it does not contain an amplifier.  It has a piezoresistive strain-gauge bridge and a resistor network for temperature compensation and calibration, but the output is a 5 µv/V/mmHg differential signal (that is, with a 5V power supply and a maximum pressure of 300mm Hg, we’d get a 5v * 300 mm Hg * 5 µv/V/mmHg = 7.5mV output.

Students would have to use an instrumentation amplifier with a gain of 667 to make this be a full-scale reading for the Arduino ADC.  Resolution would be 0.3mmHg (39 Pa, 4mm water), which is fine for blood pressure measurements, but requires a fairly powerful excitation for characterizing the hose and reservoir system. For a circuits class, the need to design the amplifier may be a plus rather than a minus for this part.

For the lab, we don’t really need the full scale 300 mm Hg, so we could get better resolution by using a higher gain. The highest recommended gain for the INA126 instrumentation amp is 10000, which would give us 0.25V/mmHg, for a full-scale range of 20 mmHg and a resolution of 0.02 mmHg (2.6 Pa, 0.27 mm water).  That should be sensitive enough for characterizing the hose-and-reservoir system, though noise might be a problem with that high a gain.

We may also have to address the frequency response of the sensor, which has a rise time (10% to 90% of a 3oo mmHg step) of 1msec.  For the low frequencies and small scale signals we are interested in, this is probably fast enough.

Another approach to measuring pressure would be to use an electret microphone and seal it to make a hydrophone.  We can get much higher sensitivity without amplification (the CMA-4544PF-W microphone gets 10.5 mV/Pa or 1.4V/mmHg) and good high-frequency response (flat up to 3kHZ, ±4 dB up to 20kHz). I don’t know how good the DC response would be, since the mic is only has specifications down to 20Hz.  I suspect that there is a high degree of non-linearity at low frequencies, and some problems with saturation when the static pressure exceeds 400Pa (4cm water).  The biggest problem with using an electret microphone is that we’d have to make the enclosure that turns it into a hydrophone, as commercial hydrophones cost hundreds of dollars (lowest cost I’ve found is $67 for a condenser hydrophone, which has much lower sensitivity than the electret mics). Although there are DIY hydrophone instructions on the web (sealed in silicone or in an oil-filled capsule), they look like they’d add a fair amount of extra trouble to making the equipment for this lab, as well as having enormous variation in calibration.

So it looks like our best bet is to use the Freescale MPX2300DT1 pressure sensor. We’ll need to build the reservoirs for the students ahead of time, mounting the sensors on PC boards (to protect the exposed dies and wires on the back of the sensor) and gluing the PC board and the sensor to the reservoir. Making the reservoirs out of PVC pipe would probably be simplest (especially for connecting the hose barbs), but gluing on the pressure sensors may be trickier then.  I also need to think about whether the PC boards should just be breakout boards for the sensors, or whether they should include an instrumentation amp and switchable-gain op amp (like the LTC6910-1, which can use jumpers or digital input to get gains of 0,1,2,5,10,20,50,100).  My preference as a designer would be to put the amp right by the sensor, but if the students are to design the amp it should be on a different board.


Having figured out how to sense the pressure, how do we provide a pressure waveform input to characterize the system?

I’ve seen two approaches described (in the Medical Instrumentation text, if I remember right):

One uses an underwater loudspeaker to create the pressure wave from a signal generator.  This is fairly simple, and underwater speakers can be had for as little as $60 (OK for the lab if they work, but more than I want to spend out of my pocket to test the lab).  The cheap underwater speakers have very poor low-frequency response (only down to about 100Hz), which is not so great for the experiments we want to do.

The other uses a bursting rubber membrane to create a pressure step.  This is a fairly simple setup: fasten the membrane (they suggested latex from rubber gloves) over the top of the reservoir, pump in some air with a bike pump, then burst the membrane with a match or knife.  The pressure in the reservoir will drop rapidly to room pressure, and the time-domain response to the step can be recorded by the pressure sensor.  This approach allows a fairly large pressure change (up to the pressure at which the rubber membrane bursts without assistance), with very simple equipment, but only provides large-scale step response, not small-scale response to different sinusoidal inputs.

Theoretically, one could differentiate the step response to get an impulse response, then take the Fourier transform to get the transfer function of the system.  This is, in fact, a practical way to get transfer functions for real-world systems, since step inputs are fairly easy to create in many systems (geologists use explosives for that purpose, for example). I don’t know whether the Tektronix 3052 digital scopes in the lab have the FFT module installed, and I don’t know whether we want to teach all the Fourier transform theory necessary to explain how the Fourier transform of the impulse response provides the transfer function, but it is certainly something to consider.

Another approach I’ve considered is moving the entire reservoir with an external driver, eliminating the need for a waterproof speaker.  A cheap subwoofer costs under $20, and could be coupled to the reservoir either by mounting it in a PVC tube that slides over the top of the reservoir or (more precariously) by shaking the reservoir from below. One cool thing (almost certainly beyond the scope of this course), is that one could use a random excitation and take the cross correlation of the pressure signals in the two reservoirs to get the impulse response of the path between them.

It takes a fair amount of power to drive a subwoofer, so we would need an audio amplifier on the output of the function generator.  The Agilent 33120A function generator provides a 10V Peak-to-peak signal into a 50Ω load with a 50Ω output impedance, so a typical 8Ω speaker would see 2.76V peak-to-peak or about 0.98V rms, which would be only 0.12W, far less than the typical 100W limit of the speakers, and probably not enough to make much of pressure wave in the water, given the inefficient coupling from the air.

A TDA7294 100W audio amplifier chip costs about $5 and a TDA7292 40W audio amplifier costs about $3.12, but both need a bunch of external components, power supply, heat sink, … .  I might be better off getting an audio amplifier kit like the Ramsey kit CK003, which provides 7W RMS to a 4Ω load for $13, though the low frequency response is poor (it only goes down to about 40Hz).  Better may be a subwoofer amplifier like the Dayton Audio SA25, which provides 25W RMS into a 4Ω load for $36.  A woofer or subwoofer would add another $15–30, and the PVC and enclosures would probably add another $10-20.

Bottom line

Each lab setup with a subwoofer driver would cost about $60–90 in parts, plus the labor cost of building it.  Since the parts are reusable, this is an OK cost, but the lab would have to be worth the money and effort involved in building the setup.

The step response setup is much cheaper (about $10–20 in parts) and simpler to build, so I should probably investigate it first.  The downside is having to teach the rather non-intuitive Fourier transform of the derivative of the step response as the way to get the frequency response.  I’m also curious whether the step-response lab could be done with just the Arduino data logger program and some FFT software on the computer, so that the students would not need the digital scopes.  There are 12 of the digital scopes in the lab, so that may not be such a big deal for the class, but I don’t have one at home, and I’d like to do my experimentation here.

2012 June 22

Oscilloscope practice lab

My thermistors and op amps were shipped yesterday morning, but did not come in today’s mail.  I hope to get them tomorrow. In the meantime, I’ve had a good conversation with Mylène in the comments on my previous posts.  She had some suggestions which are probably worth following up on:

  • Do a stethoscope project for one of the labs, which would require simple audio amplification.
  • Start student familiarization with the test equipment by having them use the multimeters to measure other multimeters.  What is the resistance of a multimeter that is measuring voltage?  of one that is measuring current? what current or voltage is used for the resistance measurement?
  • Start oscilloscope familiarity by looking at the output of power supplies. What ripple can you see on the voltage output of a benchtop supply? of a cheap wall wart?  This requires the students to learn the difference between DC and AC input coupling for oscilloscopes.
  • On the first day that students are using oscilloscopes, have them try looking at the output of a microphone.  Most already have some idea about what sound should look like as a time-varying signal, and it is fun for them to play with different sounds (singing vowels, clapping, playing music or test tones from their phones, … ).

Since my thermistors weren’t here, but I did have an electret microphone that I bought some time ago, I decided to try the oscilloscope labs.

The first thing I had to do was to adjust the scope probes to match the input impedance of the scope, using the square-wave calibration output.  I seem to need to do this every time I use the scope, even though I never change the leads. Perhaps I’m just impatient and don’t give the scope enough time to warm up, since I sometimes have to readjust the scope probes after using the scope for a while.  I assume that Steve has a handout on how to adjust the scope probes and why it is needed.  If not, we need to either find a good tutorial for the students on the web, or write one.

The first thing I should have done after adjusting the scope probes was to look at the wall wart output using AC coupling on the scope, to see how much ripple there is.  In fact, I did not do this until much later.

Ripple on the wall wart power supply with no load. The vertical scale is 20mv/division, so the ripple is about 40mV peak-to-peak.

If I filter the power supply with a simple RC low-pass filter (33kΩ and 470µF, for a 15.5 second time constant), the 100Hz ripple goes away (and it does seem to be 100Hz, not 60Hz—the trace is not steady if I use the 60Hz “line” trigger instead of the internal trigger).

Even after filtering, I’m still left with some high-frequency noise, decaying 23MHz bursts that seem to be somewhat irregularly spaced (I can’t seem to get a steady enough trigger to capture a second burst in a stable position, but they seem to be over 10µsec apart).  I assume that this is some sort of ringing in the input of the scope, as it is present even with the wall wart unplugged, and with the scope probe not connected to it. It gets bigger if I put a long loop of wire between the scope probe and the scope ground, but adding bypass capacitors seems to have little effect.   This signal is about 7mV peak-to-peak with the scope probe on the breadboard at the output of the RC circuit with or without the wall wart plugged into AC power.  Disconnecting the wall wart using the DC barrel plug reduced this high-frequency noise to about 2mV peak-to-peak, so I suspect that the wires connected to the scope probe make a difference.   The noise happens on both channels and seems to be the same on both.

The back of the electret mic. It looks just like the drawings of the CUI Inc part number CMA-4544PF-W, which is the cheapest microphone at DigiKey, so I assumed that it was that part.

I had bought the electret microphone without any spec sheet, and it is completely unlabeled. To figure out how to use it I had to guess and do a little web searching. I don’t remember where I got it (not DigiKey, since I don’t have their inventory label for it), so I pretended it was the cheapest mic from Digikey, the CUI Inc CMA-4544PF-W. While I was writing up this post, I remembered that I probably bought it from Sparkfun, as their electret microphone. But they give the spec sheet for the Knowles Acoustic MD9745APZ-F, which has very similar specs. But the pictures on the Sparkfun website and in the Knowles data sheet don’t match as well as the pictures in the CUI data sheet, so I think I have a CUI microphone, though not necessarily the one whose data sheet I used.

Circuit copied from the CUI CMA-4544PF-W datasheet. I used a 4.7kΩ resistor for the load, though the datasheet suggests 2.2kΩ—I didn’t have a 2.2kΩ resistor handy. I also used 0.56µF capacitor instead of a 1µF capacitor—again, using what I had on hand.

An electret microphone does not produce any electricity—you need to power it from a power supply using a series resistor.  The circuits shown in data sheets are all fairly similar.

With this circuit I had no trouble getting a good signal from the mic. My first attempts had just connected the wall wart power supply directly to +VS, but that produced a fairly large ripple signal (which lead me to look at the wall wart ripple directly with the scope).  Adding an RC filter with a fairly large resistor and capacitor (33kΩ and 470µF, for a 15.5 second time constant) cleaned up the power supply and no ripple was visible in the output.  The output of the electret microphone varied depending on how loud a sound was produced, but easily got 60mV peak-to-peak for a vowel sound and 150mV peak-to-peak for clapping.

A trace of rough vowel sound.

One interesting thing I observed is that I can get quite a large pulse just by moving my hand toward and away from the microphone, with pulses about 100msec wide. So it looks like the mic can go down to 10Hz, and possibly lower.

We would need an amplifier to use this as a stethoscope. Crude attempts (pressing the mic against my chest) were not very promising. I did not see any signal that seemed correlated with my heartbeat.

%d bloggers like this: