# Gas station without pumps

## 2015 June 5

### Last day of class for Spring 2015

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 23:31
Tags: , , , , ,

Today was the last day of class, and I covered almost exactly what I proposed in last night’s blog post: one-transistor amplifiers, a review of the goals of the course, and getting suggestions for improvements for next year.

I briefly gave them an intro to NPN transistors (reinforcing the previous mention in the phototransistor lab), telling them that the collector current was basically β times the base-to-emitter current, and that the base-to-emitter junction was a diode.  The diode means that no current flows until the base-to-emitter voltage is at least 0.65V and that thereafter the current grows roughly with the square of the voltage above the threshold.

The first circuit I gave them was a common-emitter circuit with emitter degeneration:

Common emitter with emitter degeneration, which has gain of approximately –Rc/Re

I built the circuit outward from the transistor, first adding the two resistors for the base bias, to make sure that the base voltage was high enough to turn on the transistor, then the DC-blocking capacitor to remove whatever DC bias the input already has. I did not take the time to tell them that the RC time constant is $(R_{1}||R_{2}) C_{1}$.

I then asserted that $V_{E} \approx V_{b} - 0.65V$ and that $I_{c} \approx I_{e}$ (because β is large, so $I_{be}$ is a small fraction of the current).  But $V_{out} = V_{cc} - I_{c} R_{c} \approx V_{cc} - I_{e}R_{c}= V_{cc} - (V_{e}/ R_{e} )R_{c}$.  That means that the gain is $\frac{d V_{out}}{d V_{in}} \approx - R_{c}/R_{e}$.  I said that this design was good for providing high voltage gain, but was not good for providing high current (because $R_{c}$ is large).  I did not give them all the constraints on the components and signal levels needed to make sure that the amplifier works correctly.

I also gave them a common collector circuit:

This common collector circuit is good for high current gain, particularly if Rc is the load that current needs to be delivered to. I gave the example of a loudspeaker as the load.

The common-collector circuit is even easier to analyze: the emitter voltage follows the base voltage, but about 0.65v lower (hence the common name “emitter-follower” for this circuit), and the current is increased by up to about β.

I explained the difference between class-A, class-B, and class-C amplifiers by giving the clipping one would get on the common-collector amplifier as the DC bias of Vin got lower.  I pointed out that the class A amplifiers were always passing a wasted DC current, but that class-C were very efficient, being on for only a tiny part of the time.  I said that class C amplifiers were mainly used with LC tanks, and gave the analogy of a pendulum that you only gave a little tap at the end of each swing, to keep it swinging back and forth.

I then switched over to the review of the goals:

• Students passing BME 101L will be able to design simple amplifiers and RC filters for a variety of sensor-interfacing applications.
• Students passing BME 101L will be able to find and read data sheets for a number of analog electronics parts.
• Students passing BME 101L will be able to measure signals with multimeters, oscilloscopes, and data-acquisition devices,  plot the data, and fit non-linear models to the data.
• Students passing BME 101L will be able to write coherent design reports for electronics designs with block diagrams, schematics, and descriptions of design choices made.

Students were in agreement that these goals were mostly met, though they still felt a bit shaky on fitting non-linear models and were aware that there was a lot on the data sheets that they still didn’t understand. I confessed to them that I can’t read everything on most analog data sheets, but that the goal here was to get them to understand the basics of the data sheets (just some of the key parameters).  They felt that they’d gotten at least that far.  I will look into beefing up the presentations in the book and in class on fitting non-linear models, but I think they’re right that many of them have not really mastered that (though some are doing fairly well at it). I didn’t really ask them about their writing skills (an oversight on my part, not a deliberate omission). Many of them have improved their writing, though the average level is still not as high as I’d like to see.

I also checked on some of my subsidiary goals:

• to turn a few of the students into electronics hobbyists,
• to encourage a few to declare the bioelectronics concentration of bioengineering, and
• to teach some tool-using, maker skills (calipers, micrometer, soldering iron, …).

Somewhat surprisingly (and gratifyingly) about a third of the class now wanted to do electronics as a hobby—a topic they had mostly dreaded coming into the class. Only one was planning to the bioelectronics concentration, but a few said that if they were sophomores instead of seniors, they would have chosen bioelectronics. All felt that they had picked up a number of tool-using skills. Because there were a fair number interested in becoming hobbyists, I shared a number of company names that might be good for them to know about, giving a little information about each: Digikey, Mouser, Jameco, Sparkfun, Adafruit Industries, Itead Studio, Seeedstudio, Smart Prototyping, Elecrow, OSH Park, Pololu, Solarbotics, Santa Cruz Electronics, and Frys.  I forgot to mention Idea Fab Labs.

So on the matter of goals (major and minor), I think that the class was fairly successful, but there are still improvements to be made,  and I asked the class for suggestions. Here are a few of the main ones:

• oscilloscope training. The students did not feel that there was a usable tutorial or reference they could turn to on how to use the oscilloscope (and the Tektronix TDS3054 has pretty confusing controls).  I agree with them on this, and promised to write some material for the book to serve as a tutorial on using oscilloscopes.
• the sampling and aliasing lab in the first week didn’t mean much to most of them. Again, I agree, and I originally had that lab later in the quarter, after the students had done some work with time-varying signals. I had some difficulty packing all the labs into 10 weeks and having a report due each Friday—I didn’t want to split any 2-part labs over the weekend.  I’ll look into trying a rearrangement of the labs, but I’m not sure how to accomplish that.  Something to think about over the summer. It might be a good idea to talk about aliasing in some of the places where clipping is discussed, though they are rather different phenomena, sharing only the idea that the output data is not really what the input is about.
• students still felt uncertain of their ability to fit functions (like the power-law fit I asked for in one lab, but never gave them an example of).  I probably need to have some more worked examples in the book, and perhaps some exercises that are in prelabs rather than just in the final design reports.
• students did not identify any parts or tools that should be removed from the kits, but one suggested that tweezers be added (a good idea, though a finer tip pair of needle-nose pliers might be a better solution). Several felt that fume extractors should be added to the lab—I’ll talk to the lab staff about that for next year.

I also asked students about my idea of removing the soldering of the instrumentation amp board and soldering an audio premap board as well, so that the power amp lab could go faster (and that we could have them test single-transistor class A amplifiers before building the class D amplifier). The students were a bit dubious about this idea, but I think I might try it next year anyway.

Students were more enthusiastic about the idea of my writing variants of each lab to perform at home, without the expensive equipment of the lab.  I’ll try to do that this summer, maybe writing up three versions of some labs: one using only the KL25Z board and a cheap (\$10) multimeter, one using those plus a USB oscilloscope (like my Bitscope oscilloscope), and one using the suite of expensive equipment in the lab.  I think that some of the labs will be very challenging with cheap equipment and others will be straightforward.

The loss of the good oscilloscope will probably be most limiting, though with a decent laptop the PteroDAQ data acquisition software can run with a sampling rate of 600Hz for a single channel (the limitation seems to be the program on the laptop keeping up with the USB input so as not to lose a byte and get out of sync).  The old Windows boxes in the lab start dropping bytes even at a 100Hz sampling frequency, but I can go up to 600Hz (but not 650Hz) for a single channel on my MacBook Pro. A newer laptop could probably keep up with a 1kHz sampling rate.  We can do a lot even with the low sampling rate, but it is nice to see somewhat faster signals (like the rise and fall times of the FETs in the power amp lab).

A USB oscilloscope like the Bitscope B10 should be enough for just about all the labs in the course, though I will have to look into how well it does with looking at the rise and fall of the FET gates and drains (without slowing down the waveforms: see Last power-amp lecture for  Bitscope recording of slowed-down transitions and Power amps working for Tektronix images of full-speed transitions). (I did a cursory check tonight, and it looks like even with subsampling it is difficult to get a good view of the gate signal with the Miller plateaus with the Bitscope unless I slow the transitions down.)

My old Fluke 8060A multimeter seems to have died this spring, so I’ll see how much I can do with super cheap hardware-store multimeters.  I think that the impedance characterization of the loudspeaker and electrodes will be the hardest to deal with, but some careful attention to the input impedance of the voltmeter may make even those labs feasible. I’ll probably have to limit the frequency range and use two cheap meters (which I have, and my son has yet another cheap multimeter that I could borrow this summer).

I did mention to the students my idea (borrowed from UCSB) of having students buy their own oscilloscope and voltmeter probes, rather than having to contend with locked down probes that can’t reach the bench or probes broken or stolen by other students. They were lukewarm to the idea—neither endorsing nor embracing it. They’d probably like a cheaper solution, but I don’t know of one as long as EE lets their students into the labs unsupervised (something else I’m trying to get changed, as the EE students do not seem to be willing to follow even simple safety rules, like not bringing open cups of tea and coffee into the lab).

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