# Gas station without pumps

## 2015 April 29

### More model fitting in lecture

Filed under: Circuits course — gasstationwithoutpumps @ 22:05
Tags: , , , , ,

Today’s lecture was all about fitting models for the electrode data. I started by showing them how one could hand-sketch Bode plots, at least for RC and RL circuits.  We did a hand plot and a gnuplot plot for the $R_{s} + (R_{p} || Z_{c}(C))$ model with arbitrary values, showing the initial horizontal $R_{s} + R_{p}$, the final horizontal $R_{s}$, and the diagonal at $\frac{1}{2\pi f C}$.

In class I went through trying to do fits to data collected for stainless-steel electrodes, and showing how to debug various problems (it was all live-action plotting—I did not script my actions).  The biggest problems were getting very bad fits (in one case from taking the log of the function but not the log of the data, in another case from having bad initial values) and singular matrices (mainly from having variables in the function that didn’t affect the fit, though in some cases from trying to fit complex models to real data without taking absolute value of the complex model).

It turns out that the standard R+(R||Z_C) model is very hard to fit to the data we collected for the stainless steel electrodes.  The oxide coatings don’t leak much current, so we had no low-frequency plateau for estimating the parallel resistance from.  I suggested making the parallel resistance infinite and using a simple R+Z_C serial connection.  That can model the data well at high frequencies, where the change in |Z| is fairly small, but at low frequencies the model is poor.

I came up with a different model on the spur of the moment (not one I had ever tried before on electrode data): $R + \frac{1}{j \omega^\alpha D}$ with a capacitor-like element having a smaller slope that the normal 1/f slope of a capacitor (about 0.6).  This turned out to fit the data quite well.  I don’t have a convincing physical explanation for the exponent α, but I suspect it has to do with diffusion times for ions near the surface of the electrode and depletion regions in the electrolyte.

In the new model, the R term probably corresponds to the bulk properties of the electrolyte solution and the $\frac{1}{j \omega^\alpha D}$ term to the surface chemistry at the electrode, so 1/R should be proportional to the concentration of the NaCl, I think.  I wonder whether students will get that result in their fits.  I’m thinking that I should rewrite some of the book to incorporate this model.

I ended by trying to model some of the data collected by students that did not work well—they had a huge inductance uptick at high frequency (fitting nicely to something like a 3mH inductance).  I’ve no idea how they got that data, as I saw their setup and they couldn’t have had more than a few µH of stray inductance.  Other students had small upticks at the high frequencies that were almost certainly stray inductance, since moving the voltmeter leads to connect directly to the electrodes eliminated the uptick, which did not happen with the students whose data I tried modeling.  I showed students how to model the uptick with an additional inductor, but I really don’t know what went wrong with the student data—I didn’t see any problems with their setup or recording, so I can only assume we all missed something.

Some of the students at least are getting the idea that modeling is not forcing your data to fit the theory in the book, but looking for regularities in the data.

### UC messes with 403B plans

Filed under: Uncategorized — gasstationwithoutpumps @ 21:21
Tags: , , ,

This week I got a letter from the University of California Retirement Savings Program saying

If you take no action: After 1 p.m., Pacific Time, on Thursday, July 2, 2015, your existing balances in any affected funds, and any future contributions currently set to be directed to any of the affected funds, will be directed to the UC Pathway Fund 2015.

What they are saying is that unless I stop them, they will take all the money that I carefully allocated in my 403B fund and dump into an untested new fund that they are creating.  The alternatives provided are to transfer the money to other UC funds, or to start paying Fidelity for a BrokerageLink account.

Why?  Well, they claim

UC is streamlining the fund menu to help RSP participants make better investment choices by reducing overlap between options and simplifying the fund-selection process. For those participants who desire more choice, the BrokerageLink® option will still be available.

Also the smaller menu allows for more efficient monitoring so that we can continue to offer high-quality funds in a range of asset classes, with expenses that are generally lower than many similar publicly traded investment options.

Quite frankly, I don’t believe them.  Not that many people are currently using the wide range of options that are available, and those of us who are chose to do so despite hassles in setting up the accounts this way.  Only those who already believed that they could make better choices than the UC managers are affected by the changes.  So it isn’t to help us make better choices—it is to take choices away from us.  So why?

• One possibility is that the current deal they have with Fidelity to manage funds and provide access to many non-Fidelity funds was not being lucrative enough for Fidelity, and Fidelity wanted to start charging brokerage fees. That is plausible (though not very), but if this were just a matter of charging fees, then the University would have informed people with the accounts that were affected that Fidelity was about to start charging fees, but people could avoid those fees by transferring the money to UC-managed funds, rather than sweeping up the money if they weren’t stopped.  In fact, BrokerageLink® isn’t going to charge fees for Fidelity funds (beyond the management fees built into the funds), so this isn’t a bid by Fidelity to get more fees (though it is possible for them to collect rather large fees if people choose funds unwisely and it may cost me more to keep the Calvert accounts if I do it through BrokerageLink®).
• Another possibility is that the University wanted to terminate the Fidelity deal and keep as much money in UC funds as possible.  But Fidelity is still in the loop so they aren’t terminating a Fidelity deal (though perhaps the terms have changed—neither UCOP nor Fidelity talks about the details of the arrangements they make with each other).
• What seems most likely is that UC has recently hired a new manager for the retirement program, and randomly changing policies with no thought to the consequences is what new managers do. Sort of like dogs pissing on fire hydrants—it isn’t for the benefit of the hydrant.

Because of the botched way that they implemented this reduction in investment options (from hundreds of plans to 15 UC-managed plans) with this stop-us-if-you-can fund snatch, I’ve lost all faith in the UC Office of the Chief Investment Officer of the Regents (the official title they claim in the letter).  I no longer believe that they are investing retirement funds on my behalf, but are only interested in playing games with my money.

I suppose I should call up Fidelity Retirement Services and find out how much it would cost me (in time and in fees) to “do nothing”—that is, to set up a BrokerageLink® account with my funds in exactly the same allocation as currently and with future 403(b) contributions allocated exactly as now.  That is what UC should have done as their default option, not sweeping all funds not on their short list into one of the UC Pathway funds.

Luckily, I’m over 59.5 years old, so I can roll all my 403(b) money into traditional IRAs, and that is currently what I plan to do—not only with the plans that they are trying to shut me out of, but all the 403(b) money, including that in UC-managed funds. But I don’t know what I can do about the “defined contribution” plan (401(a))—I believe that can also be rolled over into a traditional IRA.

Switching to an IRA means that I’ll have to find some mutual funds that I trust to move the money to.  I’ll be looking for socially responsible investment funds (two of the funds they are shutting out are Calvert funds that I’d chosen years ago for socially responsible investing), for a more general stock fund (I have some money in Fidelity Magellan), and for corporate bonds (taking my money out UC bonds, because of my lack of trust in UC’s new fund manager). For socially responsible investing, I’ll probably start by looking at http://charts.ussif.org/mfpc/?, which provides statistics from Bloomberg on various socially responsible funds—then digging a bit into what the funds claim their principles are.

I don’t really have time to deal with all this hassle this quarter—I’m sure they counted on most faculty and staff not having time to think about the investment and just follow the manager’s default choice.  I wish they had made the “change nothing” choice the default, even if it meant that some of us would have been charged some fees.

## 2015 April 28

### First half of electrode lab a bit long

Filed under: Circuits course — gasstationwithoutpumps @ 20:47
Tags: , , , ,

Monday’s lecture went fairly well—I used my post  Comments for class after grading as lecture notes, and pretty much covered everything, though not necessarily in the order presented there.

Today I spent a long time in the lab, from about 9 a.m. to after 6 p.m., because it takes a fair amount of time to set up and clean up when we are dealing with liquids (in this case, salt water) in the electronics lab.  I have to make sure that everything is in secondary containment tubs, so that nothing gets spilled.  (It irks me that the EE faculty don’t bother enforcing the clearly posted “no food or drink” rule on their students, and I’ve had to chide several EE students coming into the lab with cups of coffee and open bowls of food—I often see drink containers in the room trash.  I spend hours making sure that my students don’t spill anything, but the EE students routinely spill their drinks (judging from the mess on the never-cleaned floor.)

I did two demos today: one planned, one unplanned.  The planned demo was of vernier calipers, which the students used to measure their stainless steel electrodes.  The unplanned demo was of what happens if you pass a large current through a salt solution.  I considered that grade-school chemistry (I’m sure I was in grade school when I took two carbon rods from inside batteries and passed a current through them, measuring the amount of H2 and O2 that bubbled off—I even looked at the difference between AC and DC (initially by using Al foil on a turntable to do the switching, but 33rpm (0.55 Hz) was still too high a frequency to get any electrolysis, and I had to switch to a DPDT switch and a watch to manually get something like 0.1Hz to get small amounts of electrolysis. OK, I admit that was a science-fair project (6th grade? 7th?) to measure the amount of electrolysis as a function of frequency, but electrolysis was not a strange subject for middle school students.

No one in the morning class had any idea what would happen if you passed a current through a salt solution, and I couldn’t even get guesses.  In the afternoon class, I badgered the students a bit more and finally got someone to realize that H2 would bubble out, and (after a bit more badgering) got them to predict which electrode this would happen on. With 6V and a 1A limit, I got vigorous bubbling (about 0.6A current drawn), and the other electrode produced a yellowish color in the solution (probably an iron oxide).

Note: all but one or two of these students have taken at least a year of college chemistry that included a full quarter on electrochemistry, but they had never seen a demo of the H2 reaction, despite it’s being the standard reaction of defining half-cell potentials. (Most of them had seen the reaction before, since it happens in gel electrophoresis boxes all the time and nearly all of them have done gel electrophoresis in biochem labs, but not one of them put 2 and 2 together and realized what was going on.)

What prompted the electrolysis demo was students asking why the readings kept changing on their ohmmeters when they tried to measure DC resistance. I tried through socratic questioning to get them to realize that the ohmmeters work by measuring the voltage across the device under test while passing a known current through, and that passing a DC current through an electrode will result in chemistry on the surface of the electrode, changing the electrode properties. I got some groups as far as realizing that there was a current, but no one seemed to realize that having a current meant there must be redox reactions taking place on the surfaces of the electrodes, changing the surface properties.

Did I already mention that almost all of these students have had a quarter of electrochemistry? I wonder what (if anything) is taught in that class! I’ve never taken it, so I’m relying entirely on what I learned in grade school and high-school—I would have thought that a college-level class would have more than what I recall from a high-school sophomore class in the 60s.

The rest of the lab went fairly smoothly, but a number of students saw a change in the behavior of their electrodes at high frequencies. This was unexpected (I’d not see the effect in my versions of the experiments), so I spent some time debugging the problem. I’m pretty sure that the problem was long wires—the students were getting a series inductance added to their electrodes. About 1.5µH would be enough in some cases to cause the observed phenomenon, though in other cases a much larger inductance would seem indicated. For one student, I suggested hooking up a voltmeter right at the electrodes rather than at the other ends of the wires to the electrodes—the saw a 2-fold reduction in voltage at 1MHz, which pretty much cancelled their apparent increase in impedance. We’ll discuss the problem in class tomorrow, and I’ll suggest modeling the electrodes not with just the standard R+(R||C) model but with L+R+(R||C), with the extra L corresponding to the long wires in their test setup.

We used up about half the salt solutions a colleague had made for me, and we’ll use up the other half on Thursday. It seems we need at least 110ml/student, so next year I’ll probably want to get 150ml/student or even 200ml/student, so that we don’t run out. Today we characterized stainless steel electrodes (which are highly polarizable) and on Thursday we’ll characterize Ag/AgCl electrodes (which are non-polarizable). So I’ll have another long day in the lab on Thursday.

## 2015 April 27

### Ideas for improving hysteresis lab

Filed under: Circuits course — gasstationwithoutpumps @ 08:38
Tags: , , , , ,

The hysteresis lab was the least successful one so far this year.  Students got the designs done and built, but they learned less than they could have from the lab (too much copying of “answers” without understanding) and the lab took too long for the time allotted.

I’m considering going back to a 2-day hysteresis lab, but expanding the lab slightly to include using an nFET to control a loudspeaker (probably with a series resistor to limit current to 500mA). Adding the nFET as a low-side switch would be a useful thing for them to know about (it is a standard arrangement for controlling heating elements, solenoids, and other devices in lab equipment), and would prepare them better for the class-D power-amp lab.

The problem here is that a good oscillation frequency for a touch sensor uses a small capacitor (hence a high frequency), while a good oscillation frequency for the loudspeaker is much lower (200Hz–4kHz).  I can have them add an external capacitor (resulting in little or no touch sensitivity) when driving the loudspeaker, or I can have them build two oscillators: a high-frequency one and a low-frequency one.

I’d want to redesign the board they solder the hysteresis oscillator on to make room for the nFET and loudspeaker connections,  plus giving them more holes for connecting up unused pins on the 74HC14N chip.  This will probably make the board bigger than 2.5cm×5cm, raising the price by 50¢.  They’d need an extra nFET in their kits (another 40¢) and perhaps another screw terminal (80¢).  An extra buck or two for the parts is no big deal, as the lab fee is already larger than what the students are getting, though the extra cost for having to use UC-approved vendors may be eating up most of the “excess” fees.

The lab could be split between the breadboard and the soldering phases, with students who are behind still completing the breadboarding in the second lab.

One question I’ve not resolved is how to reschedule the labs so that there is room for a 2-day hysteresis lab.  Is there any lab that currently takes 2 days that can be squished to 1 day (with less damage than squishing the hysteresis lab)?  How do I keep the reports on schedule so that I can grade over the weekend?

## 2015 April 26

Friday’s lecture went fairly well.

There were a few questions at the beginning of class, one of which lent itself well to my talking about choosing different models for the same phenomenon and using the simplest model that worked for the design being done.  In this case it was about the relaxation oscillator using a 74HC14N Schmitt trigger and where the constraints on the feedback resistor came from.  I told them about some more detailed models we could do of the Schmitt trigger, including input capacitance (max value on the data sheet), input leakage current (not specified, but probably fairly small, under 1µA), and output resistance (which would get added to the feedback resistance).  I’ll have to incorporate some of those ideas into the book, when I rewrite those chapters this summer—the hysteresis lab needs the most rework of anything so far this quarter.

After the questions I mainly talked about polarizable and non-polarizable electrodes developing the R +  (R||C) + half-cell model of an electrode that they will be fitting (without the half cell) in labs this week.

This weekend’s grading was a bit painful, and I’m probably going to have to spend all of Monday’s lecture filling in gaps in their prior education that I had not anticipated.  Some holes also became apparent from e-mail questions I got from students over the weekend.

I’ll try to gather the common problems here, so that I can use the list as lecture notes tomorrow.

• There were a lot of REDO grades for errors on schematics.  I hate giving REDO (since it doubles my grading load), but I told students at the beginning of the quarter that any error on the schematics was an automatic REDO.  I plan to stick to that, despite the pain for both me and the students, because they have to develop the habit of double and triple checking their non-redundant documents (schematics, PCR primers, …).  Sloppy documentation is a serious problem in engineering and too many faculty and graders have been perpetuating the myth that the almost right idea is good enough.  I’m particularly harsh on students who change kHz into Hz or pF into nF.  Off-by-a-factor-of-1000 is not good enough!  The most extreme case so far is someone who specified a capacitor as being in the gigafarads (they’d typed 109 instead of 10-9). A factor of 1,000,000,000,000,000,000 off is not the sort of thing one can ignore.  I also get annoyed by students who randomly pick a unit (H when they need Ω, or Ω when they need Hz), as if all units were just decorations to please a teacher, with no real meaning to them
• Frequency is 1/period.  For the relaxation oscillator, they do two charge/discharge calculations to get the period as a multiple of RC (though many blindly copied one of the formulas for just the charge time without understanding it, and assumed it was the period). But even after computing the charging time students blindly used  2πf = 1/(RC) as a magic incantation.  That formula was relevant for the corner frequency of RC filters, but has nothing to do with the oscillation frequency of the relaxation oscillator.
• The capacitance calculation being done in the prelab was for the capacitance of a finger touch to the touch plate, but a lot of students claimed that it was the calculation to determine the size of the ceramic capacitor.  Only a couple of groups bothered to explain the connection between the two capacitances. I think I need to rewrite the prompts in the book to force the values to be more different, so that students have to think which capacitance they are talking about.
• I find that students often talk about “the voltage” or “the capacitance” as if there was only one in their circuit, and when asked which one they are talking about are completely mystified—to them invoking the magic word is all that can be expected of them—actually knowing what it refers to is unreasonable.
• Students in general were doing too much ritual magic. They would put down a formula they thought was relevant (often copying it incorrectly), then claim that from that formula they got some number for their design.  Often the formula was not relevant, or additional assumptions needed to be made (like choosing arbitrary values for some variables).  At the very least, there was some substantial algebra to be done to convert the formula into a usable form.  Some students claimed that Wolfram alpha gave them the solution (when there was not enough information to solve for the variable they wanted a value for).  Basically, I’m a bit angry at the students for trying to bullshit their way through the assignment. One pair of students said quite honestly that they did not know how to do a computation and got the value they used from the students at the next bench.  I gave them bonus points, and I’ll help them figure out how to do the computation they were having trouble with—I have no problems with students not knowing how to do something new and somewhat tricky, but I do have trouble with students deliberately looking dishonest and stupid by writing bullshit.
• The computation that the honest students had trouble with is one that many students had trouble with, so I’ll go over it in class.  I gave the students a derivation of a formula for the charging time of the capacitor in the relaxation oscillator, but I didn’t have time to step them through the derivation.  It seems like most of the class can’t read math, since many just copied the final formula without reading the text that said it was the time to charge the capacitor.  There was an exercise immediately afterwards asking students to compute the time to discharge the capacitor, but this exercise was added to the book after the students had done their prelab exercises, so they didn’t bother to look at the exercise. What they needed to do for the lab was to add the charge and discharge times (which are not quite the same) to get the period.
• I need to remind the students that they are turning in design reports, not lab reports.  I’m not looking for fill-in-the-blank worksheets, but descriptions of how they designed and tested their circuits.  Omitting the design steps is omitting the most important part of the report!
• I gave the students three models to fit to the data, and showed them how to do the fits for two of the models in Wednesday’s lecture.  There wasn’t time to get to the third model, so I just told them to use the same technique as the second model, but with the different formula.  Most of the class never bothered to fit the third model (the only one that really fits the data well)—if I didn’t do all the work for them in lecture, then they weren’t going to generalize even a tiny bit to do it themselves.
• A lot of students did not do a good job of fitting the models, because they fit the data with linear scaling, rather than with log scaling as I had shown them.  This is a fairly subtle point (errors on a linear y axis are differences, but on a log y axis are ratios), so I’ll review it in class.
• I  think that some students don’t have any idea when one would use a log-log plot, a log-linear plot, a linear-log plot, or a linear-linear plot.  I thought that was covered in precalculus, but I guess not. So tomorrow I’ll present the idea that the only curve most people understand visually is a straight line, so one wants to choose axis scaling so that the expected relationship is a straight line.  Linear plots are for linear (or affine) models, log-log plots are for power laws, log-linear are for exponentials, and linear-log are for logarithmic relationships.  I’ll put a general straight line on each and derive the form of the function that matches that straight line.
• The purpose of the Tuesday lab was to collect data and model the loudspeaker with a few parameters.  But many students neglected to report those parameters in their design reports!  They produced a plot and fitted models to it, but nowhere on the plot, in the figure caption, or in the main body (in decreasing order of usefulness) did they report what the parameter values were that the fit produced.  For students who are so focussed on answer getting that they neglect to explain how they came up with their answers, this seems like a strange omission.
• For the Thursday lab, no one did back calculations from their observed frequencies to estimate the capacitance of the 74HC14N input, of the untouched touch plate, or even of the touch itself, to see whether their observations were consistent with their design predictions. One group of students claimed to have done sanity checks, but I don’t believe them, as they also reported oscillations around 20Hz, instead of 20kHz.
• For the prelab, it seems that a lot of students computed $R + \omega L$ instead of $| R + j \omega L|$, though most got it right in the gnuplot scripts for the lab itself.  I have to remind students that $|A+B| \neq |A|+|B|$.
• On the typesetting front, I’m making some progress on getting students to put their plots in as figures with captions, though way too many are still referring to “the plot below” rather than to “Figure 3”.  I’m also having some difficulty getting them to be sure to refer to all the figures in the main body text.  A lot of times they’ll toss in a handful of plots with no reference to them at all.
• On the opposite side of the coin, I have to teach them that equations are properly part of a sentence, generally as a noun phrase, and are not standalone sentences.  When there is an explanation of variables after a formula (“where A is this, and B is that”), the where-clauses are still part of the same sentence.
• Some other little things to tell them:
• The word “significant” should be reserved for its technical meaning of “statistical significance”—very unlikely to have occurred by chance according to the specified null model. It should not be used in the normal English way to mean “big”, “important”, or “something I like”.
• To get gnuplot to produce smooth curves when there are sharp changes in function, it is necessary to do set samples 3000 to compute the function at more points than the small default number.
• Students have been misusing the word “shunt” for any resistor. Properly, it is a low resistance used to divert current from some other part of the circuit—in our designs, it is the resistor being used to sense current and change it into voltage. I wonder if I should switch terms and talk about a “sense” resistor, though “shunt” is the standard term for ammeters.
• A minor pet peeve of mine: I hate the word “utilize”. I have yet to see a context in which “use” does not do the same job better.
Next Page »