# Gas station without pumps

## 2016 June 30

### Seventeenth weight progress report

Filed under: Uncategorized — gasstationwithoutpumps @ 08:58
Tags: , , , , , ,

This post is yet another weight progress report, continuing the previous one. I skipped posting last month, because I was busy and my weight was up—I had hoped to bring it back down during June so I could report good news, but a trip to Montreal and a trip to San Francisco, with the concomitant loss of diet control resulted in my weight going up even more in June:

My weight has been creeping up, mainly as sudden upward spikes that take a while to recover from.

The detailed view of the last year shows a fair amount of scatter over an underlying gain of 2.81lbs/year (1.275kg/year). May had only 5 days above my self-imposed target range, but June had only 4 days within the range!

Exercise has been very low this month, with only 2.59 miles/day of bicycling (though I did more walking than usual, particularly on the Montreal and San Francisco trips). Because I’m not commuting up to work daily over the summer, I don’t have exercise built into my daily routine, and I find it very difficult to exercise just for its own sake.

It has also been difficult to be diligent about my raw-fruit-and-vegetable diet, both at home and when traveling. There are lots of snacks and leftovers in the house, because my son is home from college, and he needs lots of calories—he’s almost as skinny as I was at his age, though he doesn’t eat as much as I did at that age. He needs the calories, and I don’t, but I find it difficult to resist snacks when they are right there, even when I’m not hungry.

I’d like to lose 7 pounds to get back to the middle of my target range, and that will probably take the rest of the summer, even if I manage somehow to be as diligent about my diet as I was for the first few months of it. I don’t know that I have the willpower to be that diligent over the summer.

## 2016 June 27

### Space Opera

Filed under: Uncategorized — gasstationwithoutpumps @ 18:50
Tags: , ,

Last night my family went to a workshop production of Act 1 of Menagerie, an opera based on the Star Trek episode of that name. The libretto is by Linc and Lee Taiz, the composer is Ben Leeds Carson, and the direction was by John De Lancie.

My wife is the only one of us who is an opera fan (though all of us liked Star Trek), and she was the only one who understood most of what the singers were singing—operatic voice is not the most comprehensible form of singing.  If I had thought to look up the website for the opera, I would have found that the libretto was on-line.  Printing it out would have made it much easier for me to follow the singers, as the workshop did not have the time nor the budget for supertitles.

Because the purpose of the workshop was to provide the librettists and composer with a live performance for refining the opera further, several other economies were made: the orchestra had 17 musicians instead of 47 (mostly student musicians), there were no costumes, the set consisted of a couple of blocks for the actors to stand on, Captain Pike was represented by a blue glowing ball on a Genie lift, and only the first act (of 3) was performed. Despite the deliberately limited production values (they spent their short rehearsal time focusing on the music), our family found the workshop interesting and entertaining.

The role of Commodore Zuna Tor  was not in the original Star Trek episode, replacing Commodore Mendez, so that the opera could have more sopranos and Captain Kirk could have a love interest.  One unexpected bonus of the casting: the woman who sang Zuna Tor was very visibly pregnant—if the character is intended to be pregnant, there is the question of whether the child is Captain Kirk’s.

I was a little surprised by Spock being sung as a bass-baritone (even though Leonard Nimoy himself was a baritone), because I had thought of Spock in the plot as more a classic tenor role—but I know very little about opera, so I bow to the wisdom of the composer here.  Kirk as a baritone and McCoy as a tenor made sense to me.

I think that the opera has some promise of bringing some younger audience members to the opera. “Younger” here is a relative term—a lot of Star Trek fans are now in their 60s and 70s, matching the median age of opera subscribers (around 65). But there are a lot of much younger Star Trek fans, who might serve to seed a future opera audience, if anyone ever manages to raise the \$1 million it would take to stage a full production (estimate from the director of the San Jose Opera, who was in the audience for the question-and-answer after the workshop and who corrected Ben Carson’s estimate of a quarter million).

That would be a very big Kickstarter project, and it would probably take a year of raising awareness at all the Trekkie conventions and social media before starting fundraising.  Traditional opera angel funding would probably be needed, unless there is a tech billionaire who is both a Trekkie and an opera fan.

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

Next Page »

Blog at WordPress.com.