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.

2015 April 21

Loudspeaker lab went well

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

I’m falling behind in my blogging about the applied electronics class, and so the notes on the lectures may be a bit skimpy.

Last Friday, I had several topics:

• Some metacognition talk about answer-getting vs problem solving, with an emphasis on the descaffolding (removing the detailed what-to-do instructions and worksheets) that needed to happen as undergrads, and how too many of their classes had not been doing it, so I had to descaffold them faster than was really optimal.  I warned them that this would be uncomfortable.
• Test equipment as part of the circuit. One of the main points of the lab they had just completed the day before was to make them aware that test equipment (like oscilloscopes) become part of the circuit that they are testing, and can affect that circuit. I’d not made that clear in the book (there is a chapter that needs a massive rewrite this summer), so I spent some time in class on the idea.
• Inductors.  I didn’t do much with magnetic fields, but I did give them $V= L \frac{dI}{dt}$ and derived the impedance $j \omega L$.  There was an unplanned digression about transformers, in response to a question. I did have students give me the impedance of a resistor in series with an inductor, which they had to plot vs. frequency as one of their pre-lab assignments over the weekend.
• Loudspeakers. I showed them a labeled diagram of a loudspeaker, and the magnetic field near the voice coil. I reminded them of the EMF right-hand rule, and showed them how current through the voice coil would push the voice coil up or down (in the orientation of the pictures).
• I then quickly went over measuring the magnitude of impedance with a frequency generator and a pair of  AC voltmeters. This is almost identical to the lab they just did for DC characterization of a microphone, but I would have liked to spend more time on it.

The students did a prelab exercise over the weekend, but I forgot to tell them to do the prelab exercise for Thursday’s lab as well as Tuesday’s, so I had to tell them that in class on Monday (assigning it for Wednesday).

Monday’s lecture was supposed to cover several topics, but I didn’t get to them all:

• feedback on the previous week’s design report.  This took far too long, in part because I went over some fundamentals—I’m not sure, based on their writing, that all the class understands the difference between voltage and current. I introduced the hydraulic analogy (voltage=pressure difference and current=flow), but I’m sure that there are still several who think of both voltage and current as some incomprehensible measure of “electricity”.
• Another fundamental that came up as a result of the report is what a “model” is.  Too many people had been trying to stick voltmeters into the middle of the model for the loudspeaker.  I think that the physics classes are doing a poor job of getting students to think in terms of models, but I’ll do what I can to remedy the deficit.
• I also spent some time on writing fundamentals, like who the audience is for a design report, and that the document must be written for someone who does not have the book or the assignments.  Students are so used to fill-in-the-blank answers that they often don’t get the idea of a self-contained report—but that is what they will have to create as engineers, so they need to start learning how to do it. I had a full page of notes on feedback for the students, much of it specific to the writing assignment I was returning.
• I went over how to determine the shunt resistor for the current measurements in the loudspeaker lab. I was surprised to find out that most had never heard of a geometric mean and had no idea that it was the appropriate way to average numbers when errors were measured by ratios not by differences. I’m not sure that the idea came across well, because I had not anticipated having to teach them that part of high school algebra (silly me—they’ve needed to be retaught everything else they should have learned in high-school algebra, so I should have known that they would never have heard of geometric means).
• I never did get to the main topic for the day: hysteresis.  I’ll have to cover both model fitting and hysteresis on Wednesday, though I’d only originally planned to do model fitting.  Fitting the models for the loudspeaker is a bit tricky, since the main R and L values have to be fitted away from the resonance peak, then the resonance peak needs to be fitted on just that region. I hope that there is enough time on Wednesday to cover hysteresis and relaxation oscillators as well as the model fitting.

Lab today went fairly smoothly.  Everyone managed to get good data from 3Hz to 1MHz, with lots of data around the resonance peak, so they have good data for fitting models to.  There were three problem loudspeakers: Two had bad insulation-displacement connectors on the ends of cables to the loudspeakers.  They didn’t fail as open circuits, but as about 70Ω resistances that remained fairly stable until the wire was jostled.  This meant that the students had inconsistent results that were hard to debug. I think that the cheap connectors were slightly oversized for the wire, so that there was not a gas-tight connection and some corrosion had formed between the wire and the connector.  I finally managed to figure out what was going on for one of the groups, and a little while later applied the same thinking to another group.  Unfortunately, it was getting rather late by then, so that group only got one of their two loudspeakers characterized—they’ll probably try to finish up on Thursday, after doing the next lab.

The third problem loudspeaker behaved normally as far as resistance was concerned, but its resonant peak was nowhere near where it was supposed to be.  Instead of a resonance at 137Hz (as reported on the data sheet), it was out around 700Hz—way too high for a mid-range loudspeaker.

Incidentally, I was wrong about which loudspeakers the staff had bought this year—they got the 15W midrange speaker rather than the slightly cheaper 5W one, so we don’t need to worry about burning out loudspeakers on the power-amp lab.

2015 April 16

Microphone labs went OK

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

The microphone labs this week went OK (much better in the afternoon session than the morning session).  On Tuesday the students collected data for an I-vs-V plot of the electret microphone, both using a power supply and a pair of voltmeters and using just the PteroDAQ system on the KL25Z board (see New modeling lab for electret microphone for the basics of the PteroDAQ portion of the lab).  Most groups got all the data they needed on Tuesday, but some were still struggling with it on Thursday.

On Wednesday, I went over the model fitting in gnuplot used to produce the fits for the 4 models I gave them: linear resistance, constant current, a “blended model” that is asymptotically the same but switches smoothly between them, and one that adds one more parameter to get a slope for the saturation region(again, see New modeling lab for electret microphone for the models) .  Some students in the class asked for a copy of the script I developed in class, but I turned them down—the goal is to get them to develop their own scripts, and they had examples of most of what I did from the previous week’s class, which included a worked example.

In previous years, I used to give out all the things developed in class as worked examples, but I’ve stopped doing that, because far too many students just blindly copied and ran scripts without understanding them (often not even changing the parameter values that were different between what I did in the example and the data they collected).  One point of this class is to get students to stop thinking of class work as ritual magic that just requires doing the right memorized or copied procedure, and to get them to think in terms of creating new stuff from building blocks that they understand. It is unfortunate that most of the chemistry and physics labs they have had are exactly that sort of ritual magic, with a worksheet telling them exactly what steps to perform and what results to fill in the blanks with.

They need to learn to generalize from worked examples, read documentation, and figure out how to make things work. I’m always happy to help them debug their efforts, but not to do the work for them.  I’m not in the class to get right answers from the students, but to get them to learn how to design and debug—to ask their own questions and figure out how to answer them. (See Answer getting for more on what change I’m trying to invoke.)  Some of the top students are already on board with the concept and are working hard to understand electronics, modeling, graphing, debugging, and so forth , but a number of the students are still stuck in the “tell me exactly what to memorize and what steps to do” state that seems characteristic of many high school students.  The biology classes they’ve had have not done much to move them away from that—there is far too much memorization without understanding going on in the bio courses.

In addition to the model fitting, I answered questions from the homework—mainly about the calculation of the output voltage from the mic for a given input sound level. I reviewed decibels again and went through the various scaling operations needed to get the output in µV RMS from sound pressure level.  I think that the top students got it, but I’m also pretty sure I lost the bottom ones—it’s a little hard to tell as they all work so hard on looking intelligent that I have a hard time telling when they are lost and when they are bored because I’m going too slow.

Today’s lab was a little bit of design (choosing a load resistor based on the I-vs-V curve, and designing a high-pass filter to block the DC) and practice using the oscilloscope. I did something different this year, having them design their high-pass filter with the input impedance of the oscilloscope as the “R” of the RC filter. In part this was to get them to realize that connecting a test instrument like an oscilloscope or voltmeter always changes the circuit that is being tested.  I even had them design around the 10MΩ input impedance of the 10× scope probe—so the 10MΩ impedance was not “almost infinite” the way many intro electronics courses teach it.  I don’t think I made a clear enough point of this message—neither in the book nor in the lab sections, so I’d better mention it in class tomorrow also.

Unfortunately, some of the material from the old lab (where they used bigger capacitors and smaller resistors for the high-pass filter) was not edited out in making the changes, so the lab chapter was rather confusing.  I’ve left some notes to myself to update the chapter, but I probably won’t have time until this summer.