# Gas station without pumps

## 2016 June 25

### Pulse monitor with log-transimpedance amplifier

Filed under: Uncategorized — gasstationwithoutpumps @ 02:04
Tags: , , , ,

I’ve been planning since the Santa Cruz Mini Maker Faire to wire up an optical pulse monitor with a log-transimpedance amplifier as the first stage, so that I could use the pulse monitor in full sun or in a dimly lit room, with a dim green LED or with a bright infrared LED. The idea is to make the output of the first stage proportional to the log of the photocurrent, rather than to the photocurrent, then use a band-pass filter to get rid of the DC component and any 60Hz fluctuation, leaving only the fluctuation due to the pulse.

This pulse signal should be independent of the overall light level but on the absorbance of the finger, because
$\log(I) = c + \log(\mbox{transmitted}) = c+ \log(\mbox{illumination}) + \log(\mbox{transmitted}/\mbox{illumination}$, for some constant $c$. If the illumination is constant or has only high-frequency components, then the bandpass filter will eliminate both $c$ and $\log(\mbox{illumination})$, leaving only the absorbance $\log(\mbox{transmitted}/\mbox{illumination})$.

I deliberately did not start working on it until I had finished my grading for the quarter, so only got it built last week, just before going to Montreal for a family reunion of my wife’s family. So I’m only now getting around to blogging about it.

To make the log-transimpedance amplifier, I need a component where the voltage is proportional to the log of the current.  For this I used a diode-connected PNP transistor:

The base-to-emitter diode has a current that is exponential in the voltage, and the collector-to-emitter current is proportional to the base-to-emitter current, at least until the transistor approaches saturation (which starts around 10mA).

The A1015 PNP transistor has a voltage proportional to the log of current, with about 60mV/decade. I did not use a unity-gain buffer when measuring the voltage and current, connecting the Teensy ADC channels A10 and A11 directly to the emitter and base+collector of the transistor. Measurements at less than 5µA were difficult, because the high impedance of the sense resistor made the ADC measurements inaccurate.

I tried a pulse monitor using the A1015 PNP transistor as the log-impedance element, and it worked ok, but I can do better, I think, using an IR LED as the log-impedance element:

The WP710A10F3C IR LED has a low forward voltage, and can be used from 100nA to 30mA, given that we don’t need high accuracy on the log function. We get about 105mV/decade, so it is more sensitive than the A1015 transistor. Note: I did use a unity-gain butter for these measurements, which allowed me to get down to about 50nA—still much higher than the photocurrents I observed in very low light.

The IR LED has a wide range over which the voltage is the logarithm of the current, or $\frac{dV}{dI} \approx 241mV/I$. For 10nA, the equivalent gain is about 24MΩ, and for 1µA, the gain is about 240kΩ. For 10pA (about the smallest current I’ve observed for operating the pulse monitor in very dim light), the equivalent gain is 24GΩ.

This amplifier uses only 3 op amps: a log-transimpedance stage with an IR LED as the impedance and two bandpass inverting amplifiers.

The 330pF capacitor in parallel with the log-impedance is very important—without it I get very short glitches which the next two stages lengthen into long glitches in the passband of the filters.  Making the capacitor larger reduces the glitches, but makes the corner frequency of the effective low-pass filter too low when light levels are very low, and the signal is attenuated.  Any smaller, and the glitches don’t get adequately removed.

I have tested the pulse monitor over a wide range of light levels, with a DC output of the first stage from 234mV to 1.033V, corresponding to photocurrents of 11pA to 463µA, a range of 42 million (7.6 decades). At very low light levels, the signal tends to be buried in 60Hz interference, but if I ground myself, it is still usable.

In very low light, the capacitive coupling of 60Hz noise buries the signal, but the bandpass filters help recover it.

At high light levels, it is easy to get clean signals, as the 60Hz interference is swamped out by the large photocurrent.

Note that the voltage swing is almost independent of the overall light level, as it depends only on the percentage fluctuation in opacity of the finger, which depends mainly on how much pressure is applied. If you get the pressure on the finger close to the mean arterial pressure (so that the finger throbs), you can get quite a large change in opacity—I’ve computed changes of 17% in opacity.

## 2016 June 21

### Net zero electricity

Filed under: Uncategorized — gasstationwithoutpumps @ 20:19
Tags: ,

After a winter of using more electricity than our solar panel generated, we’ve finally gotten our electric meter back to the reading it had before we hooked up the solar panel. We’ve generated about 2.25MWh over about 46 weeks, and the remaining 6 weeks should be among the highest generation days of the year, so we will end up with more electrical energy generated than consumed by our household when PG&E computes the net energy for the year.  They’ll give us a tiny amount of money for the excess electricity, but nowhere near enough to offset the monthly minimum charge for being on the grid.

I expected the peak electricity generation to be around the summer solstice (yesterday, 2016 June 20), but the biggest daily generation so far was actually 11593 Wh on 2016 May 31.  I think that the offset is partly due to morning shadows from trees and partly due to Santa Cruz’s morning fog.

## 2016 June 14

### Things to do for book

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

I’ve finally finished my grading for the quarter, after a solid week of grading, and so I can now catch up on some of my administrative tasks (like checking the articulation framework documents, trying to find an undergraduate director for bioengineering for Fall quarter, checking the 30 or so senior exit portfolios, and so forth).

I can also start thinking about the tasks for me on revising my book, which will take up big chunks of summer and fall:

• Move the book files into a source-code control system, probably mercurial, and use and off-site backup, probably BitBucket.  I should have had the files in a source-code control system from the beginning, but I never got around to setting it up.  This is a couple of years overdue, and I shouldn’t make any more updates to the book until I’ve done it.
• Rearrange book to put labs in new order, moving all the audio labs into the second half, and moving the instrumentation amplifier and transimpedance amplifier into the first half.
• Revise parts list for next year’s labs.
• May want to use a different phototransistor (without the filter that makes it less sensitive to visible light).
• Choose nFET with lower threshold voltage (maybe pFET also).
• Find better resistor assortment.
• Add hobbyist add-ons to the labs, for people who want to go beyond what we can do in class.  For example, I could add
• designing a triangle-wave generator to the class-D amplifier, so that it can be self-contained,
• sound input from a phone jack to class-D amplifier (with info about TRRS plugs)
• logarithmic transimpedance amplifier for optical pulse monitor, to make it tolerant of different light levels and finger thicknesses
• optical pulse monitor using reflected (actually back-scattered) light instead of transmitted light, so all the optics is on one side
• motor controller based on H-bridge used in class D
• temperature controller using thermistor, FET, and power resistor
• galvanic skin response measurement?
• oscillator design other than Schmitt trigger relaxation oscillator?  Maybe a Colpitts oscillator with the big inductor (though even with 10μF and 220μH, the frequency would be rather high for audio use)?
• make Schmitt trigger out of comparator chip
• EMG controller (either with analog envelope detection or with software envelope detection)
• Insist on LaTeX for design reports.  I had too many reports with terrible math typesetting, incorrect figure numbering, and bad font substitutions with Microsoft Word or Google docs reports.  I’ll need to include a short tutorial in the book, with pointers to more complete ones.
• Make it clear in the book that design reports build on each other, but each report needs to be self-contained—for example, the class-D amplifier report should contain circuits, results, and some discussion from the microphone, loudspeaker, and preamp labs; and the EKG lab report should include some information from the blood pressure and pulse monitor labs.
• Add more background physics and math at the beginning of the book, to review (or introduce, for some students) topics we need.
• Should I add a short lab characterizing the I-vs-V curve for an nFET and a pFET?  If so, where would I fit it in?  What about for a diode (could be LED)?
• Bypass capacitor discussion should be moved to between the preamp lab and the class-D lab.  I need to talk more about power routing and location of bypass capacitors for the class D lab (it is important that the bypass capacitors be between the the noise-generating FETs and rest of the circuitry, which is noise-sensitive).  May need to introduce the concept of the power wiring not being a single node, so that “clean 5V” and “dirty 5V” are different nodes.
• Class-D lab should have students measure and record the amount of current and power that their amplifier takes with no sound (removing the mic?) and with loud sound input, both with and without the LC filter.
• Class-D lab should require students to show oscilloscope traces of the gate and drain of an nFET and of a pFET in the final H-bridge, both for turning on and for turning off.
• EKG, blood pressure, and pulse monitor prelabs should have students compute the attenuation of 60Hz interference (relative to the signal in the passband) for low-pass filters that they design.

I should also review what students had to say about the course (look at discussion in previous post, for example).

## 2016 June 11

### Teaching writing lab reports

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

Greg Jacobs, in his post Jacobs Physics: Report from the AP reading: Teach your class to write concise laboratory procedures. Please., asks high-school physics teachers to teach students how to write concisely:

Part (a) of our question asks for a description of a laboratory procedure. It could be answered in 20 words: “Use a meterstick to measure the height of a dropped ball before and after it bounces. Repeat for multiple heights.

“But oh, no … when America’s physics students are asked to describe a procedure, they go all Better Homes and Gardens Cookery Manual on us. Folks, it’s not necessary to tell me to gather the materials, nor to remind me to first obtain a ball and a wall to throw it against. Nor do you have to tell me that I’m going to record all data in a lab notebook, nor that I’m going to do anything carefully or exactly. Just get to the point—what should I measure, and how should I measure it.

Please don’t underestimate the emotional impact on the exam reader of being confronted with a wall of text. We have to grade over a hundred thousand exams. When we turn the page and see dense writing through which we have to wade to find the important bits that earn points, we figuratively—sometimes literally, especially near 5:00 PM—hit ourselves in the forehead. Now, we’re professionals, and I know that we all take pride in grading each exam appropriately to the rubric. Nevertheless, don’t you think it’s worth making things easy for us, when we be nearing brain fatigue? Just as good businesspeople make it easy for customers to give them money, a good physics student makes it easy for the grader to award points.

Don’t think I’m making fun of or whining about students here. Writing a wall of text where a couple of sentences would suffice is a learned behavior. The students taking the AP exam are merely writing the same kinds of procedures that they’ve been writing in their own physics classes. It is thus our collective responsibility as physics teachers to teach conciseness.

As I’ve been spending far too much time this week grading an 11-cm-thick stack of design reports from my applied electronics course, I have considerable sympathy with Greg Jacobs’s view.

Technical writing is all about the 4 Cs: clear, correct, concise, and complete. Although there is always some tension between clarity and correctness, and between completeness and being concise, I generally find pretty high correlations between the four properties. Often, the very long reports are muddled, incomprehensible bundles of improperly applied factoids, while the essential information is missing entirely.

Part of the reason I have such a huge stack of papers to grade at the end of the quarter is that I have been giving “redo” grades for any errors in non-redundant representations (like schematic diagrams), putting a very high premium on correctness. For the class-D amplifier lab, 80% of the class had to redo the reports, mostly because they had not gotten the orientation of the FET transistors right in the schematics (a serious error that could lead to fires in the amplifier). I must have done a worse job at explaining the FET symbols—several times—than I thought, or maybe it is one of those things that people don’t learn unless they make a mistake and have it pointed out to them, repeatedly. I’ll be trying to fix the book and the lectures next year to reduce this problem.

I’ve also been down-grading students for lack of clarity (especially when the writing seems to indicate a lack of understanding, and not just inability to communicate) and for leaving out essential material (like not providing the schematics for their preamplifier as part of their amplifier lab report, not providing the parameters of the models they fit, or not providing the models they used at all). So clarity and completeness have had a fairly big impact on grades.

But I have not been giving bonus points for being concise, which I probably should start doing, as some students have started using a kitchen-sink approach, throwing in anything that might be tangentially related to the subject. Unfortunately, these are the students most likely to have unclear and incorrect reports, and they leave out the essential material in an attempt to throw in useless background, so their attempts at completeness generally backfire. I need to discourage this behavior, undoubtedly learned in middle school and high school, and get them to focus on the stuff that is unique to their design, rather than telling me Ohm’s Law or the voltage-divider formula over and over.

### Love’s Labour’s Lost

Filed under: Uncategorized — gasstationwithoutpumps @ 07:54
Tags: , , ,

Boyet with the ladies of France

Last weekend, my wife and I took a trip down to Santa Barbara, for three purposes:

• To see our son play Boyet in Love’s Labour’s Lost with Shakespeare in the Park
• To bring him two large wheeled duffel bags that we had stored for him
• To bring back about 100 pounds of his luggage

Earlier in the week, we had seen UCSC’s Shakes to Go do a very stripped down version of Love’s Labour’s Lost (45 minutes) at the elementary school where my wife works. It was interesting to contrast the two productions: one of which has to travel and be performed for elementary and middle-school audiences with no on-stage rehearsal, and the other which is only performed twice before a primarily adult audience.

The UCSC version had to be ruthlessly cut to fit in the class period schedules of schools, and almost all the verbal jests had to be jettisoned. Given that the play is full of now-obscure puns and sexual innuendo, there was not much left but the bare bones of the plot. It was still funny enough to amuse the students, but it was a bit unsatisfying for adults.  All 10 actors were theater majors, which is not surprising given the time commitment (a quarter of rehearsals, followed by a quarter with dozens of performances, each of which can take up a full morning).

The UCSB version was not cut as drastically (about twice as long with a running time of 1:28), but many of Berowne’s longer speeches were cut to the bone, and some jokes were lost.  The costuming was more elaborate for this production, and there was less double casting (17 actors instead of 10 makes a huge difference).  Several of the actors were not theater majors and one did not even have English as a native language, but the acting and directing was overall very good.

I took my cameras with me to UCSB and recorded the two performances of the play (with the permission of the director), so you can see for yourself how the production went (I think I did a better job of filming for the Sunday production than the Saturday one):

Saturday:

Sunday:

We were in a hurry on Saturday, so we took the Greyhound from Santa Cruz to Santa Barbara, making it in time to eat supper with him at Buddha Bowls before his 5:00 call.  Greyhound is the fastest public transit to Santa Barbara, but we prefer the comfort of the Coast Starlight train, even though it adds several hours to the trip, so we took the Coast Starlight and the Highway 17 Express back on Monday.

We had some time to kill between feeding him and the performance starting at 7:30, so we walked around the lagoon on the UCSB, which has quite a variety of birds (we saw egrets, cormorants, and a great blue heron).

I believe that this heron we saw is a great blue heron, based on pictures of herons I found on the web.

On Sunday, we helped clean part of the apartment and pack most of his clothes and bedding, leaving him with enough to get through to his trip home on Wednesday.  He ended up with an easily managed load of luggage, after he stored his bicycle with the police for the summer (a very handy service that cuts down on bike theft and abandoned bikes).

The large rolling duffel bag that we brought home for him was overloaded (68 pounds, compared to Amtrak’s 50lb limit), so I had to rearrange the luggage at the train station on Monday—I’d anticipated this need, so it only took a couple of minutes to remove the already packed pannier from the duffel, and transfer a few clothes to the carry-on suitcase.

One big difference from when I was a student is that he had practically no books—what few textbooks he’d had this year he’d been able to get electronically, and most of his recreational reading is from the web rather than on paper.

We had a little time to kill Sunday afternoon while he caught up on sleep (there’d been a cast party Sat night), so we looked at the newly refurbished library on the UCSB campus. The facilities seem quite nice, but were overloaded on the weekend before finals.  There seem to be enough computers and power outlets, but not enough WiFi bandwidth (we heard students talking about going elsewhere to study, because of problems with the WiFi).

Next Page »

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