# Gas station without pumps

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

## 2013 February 22

### Nineteenth day of circuits class

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

Today’s class started out well, but ended up with one of the worst lectures of the quarter.

I had three topics I wanted to cover today:

• proper use of electrolytic capacitors
• strain gauges
• instrumentation amplifiers

The electrolytic capacitor part went fairly well.  I managed to get the students to come up with the two sensible ways to hook up a polarized capacitor in a low-pass filter (either tying the negative end to low-voltage rail or the positive end to the high-voltage rail) and why it would be a problem to have one end connected to ground or virtual ground in the middle.  It took a little longer than I thought it would, but I’m getting used to that by now, and I believe that most of the class understood the reasoning.  (I’ll see in the next lab report whether they remember to use the polarized symbol for the electrolytic capacitor or not.)

The strain-gauge discussion brought out the Wheatstone bridge circuit again, and I think it went ok, as did the listing of the three types of pressure sensors (differential, absolute, and gauge).  For their next lab, they’ll be designing and soldering up an amplifier for an MPX2053DP pressure sensor, which is a differential sensor, though they’ll be using it as a gauge sensor, by leaving one port open.

The third topic, instrumentation amps, did not go well, even though I had prepped material yesterday and this morning.  I made the mistake of inserting a topic I had not originally planned to cover (the precursor design to the 3-op-amp instrumentation amp, which uses two unity-gain amplfiers followed by a simple one-op-amp differential amplifier).  Because I hadn’t prepped that design, I did it from memory and made two serious mistakes in drawing the circuit (a misconnection and swapping the values of two resistors).  After working through some tedious algebra, I saw my mistakes and fixed them, but by then it was too late—I had lost the class.

I then went through the algebra for the three-op-amp instrumentation amp: This is the standard 3-op-amp circuit for an instrumentation amplifier, together with the algebra needed to compute the gain $V_{out}-V_{ref}=(1+2R_x/R_{gain}) (V_{in+}-V_{in-})$

I think it was a mistake to go through the algebra with the class—they zoned out. It was a bigger mistake to try to do the “simplified” 3-op-amp amplifier from memory, as I made mistakes and the presentation made the design more confusing, rather than less. I did derive and give them one simple shortcut for voltage dividers which have two non-zero voltages, Va connected to Ra and Vb connected to Rb: Vout= (Va*Rb+Vb*Ra)/(Ra+Rb). I suspect that they’ll remember the shortcut wrong though, and so I’m wondering whether they would be better off always going back to the voltage divider formula.

To make matters worse, the INA126P chip that they’ll be using uses a 2-op-amp design, rather than a 3-op-amp one: The INA126P chip uses this design, rather than the “standard” 3-op-amp design. This design requires more precise matching of resistors, but with modern laser trimming in manufacturing, that is no longer much of a problem.

I don’t think that I’ll give them the algebra in class for the 2-op-amp design, as it is even more tedious than the 3-op-amp algebra, because we need to use Kirchhoff’s current law, and not just a voltage divider. For the circuit shown here, the two current sums on the nodes where three resistors meet are $\frac{V_{in+}-V_{out}}{R_2} + \frac{V_{in+}-V_{oa2}}{R_1} + \frac{V_{in+}-V_{in-}}{R_{gain}} = 0$ $\frac{V_{oa2}-V_{in-}}{R_1} + \frac{V_{in+}-V_{in-}}{R_{gain}} + \frac{V_{ref}-V_{in-}}{R_2} = 0$

If we add the two equations, we get $\frac{V_{in+}-V_{in-}}{R_1} + \frac{V_{in+}-V_{out}+V_{ref}-V_{in-}}{R_2} + 2\frac{V_{in+}-V_{in-}}{R_{gain}}=0$.

We can simplify this to get the gain equation $V_{out}-V_{ref} = (V_{in+}-V_{in-}) \left(1+ \frac{R_2}{R_1} + \frac{2 R_2}{R_{gain}}\right)$

For the INA126P, R1=10kΩ and R2=40kΩ, so the gain equation further simplifies to $V_{out}-V_{ref} = (V_{in+}-V_{in-}) \left( 5 + \frac{80k\Omega}{R_{gain}}\right)$.

I told the students to form their lab partnerships today and work on the pre-lab for the pressure-sensor lab over the weekend, so that they can ask questions in class on Monday. I’ll bring in my board and pressure sensor on Monday also, so that they can see what sort of wiring I’m expecting.