# Gas station without pumps

## 2012 November 27

### Magnetic fields with no lab

Last week we did measurements of the magnetic field around a single wire, and I had planned to “do a lab winding a helix of wire and measuring the field around it.  We’ll use the computational problem (18P79) to compute the expected field in different places, and try measuring the wound solenoid in corresponding locations.  This means that in setting up the program we’ll have to make the number of turns, the radius of the solenoid, its length, and the current through the solenoid all easily changed, to match the simulation to the coil that we wind.”

As it turned out, my son had the simulation finished and we spent most of an hour exploring what the program told us.  The initial picture showing magnetic field arrows near the coil looked fine, but I suggested trying a different visualization: having a particle trace out a magnetic field line.  We expected to see something like the classic pictures of iron filings around a bar magnet, and were surprised to see the magnetic field coiling out from the end of the solenoid.

We did a bunch of debugging.  We looked at at the contributions to the field from the different segments of the coil, by color coding arrows from a fixed observation position. The simulation had n segments for each turn of the helix, so we summed the segments mod n, to get the different contributions from the different parts of the helix.  We also tried varying the number of turns of the helix, and we played with the step size for the particle tracing out the field line.

We finally got some very nice drawings of the field lines coming out one end of the solenoid, spiraling out, then spiraling back in to the other end, and running through the center of the solenoid.  It took us a while to realize that the behavior was indeed what we should have been expecting, because the helix has current running parallel to the axis of the helix as well as around the helix.  A simulation (as the book suggests) using only circular rings would not have included this longitudinal current, and we would have missed some interesting views of the magnetic field.

I’m wondering whether we could have gotten a similar result by superimposing two fields: one computed from a stack of circular rings and the other from a wire down the axis, both with the same current.  I might try writing a program that compares the two approaches.

Because we spent an hour doing simulations and looking at the results, we did not get around to doing homework comparisons (a good thing, since I haven’t done the homework yet) nor did we get around to winding a coil and measuring the magnetic field, which I still want us to do.

## 2012 November 24

### Hysteresis board

Now that we’re using a 74HC14 Schmitt trigger in the capacitive touch sensor for the hysteresis oscillator, that lab can be the first soldering project, in addition to learning about hysteresis.

I tried laying out a very compact PC board for the students to solder (still requiring them to do some design—they’ll have to breadboard their design first to get appropriate R and C values). I came up with one very compact design that could get 4 copies into the 50mm×50mm limit of the \$1 boards from ITEAD, making the boards only 25¢ each.

Compact layout to get 4 hysteresis oscillator boards out of one 50mm×50mm board. The gutters are pretty narrow, though, and I’m not sure I’m skillful enough with the board shears to cut that accurately.  The yellow “airwires” are Eagle telling me that the Gnd and +5V wires are not connected between the different copies.

It seemed a little silly to try to squeeze the price down to 25¢, when the other parts cost 90¢: 59¢ for the screw terminals, 28¢ for the Schmitt trigger chip, 1¢ for the resistor, and 2¢ for the capacitor. With this layout it is also a little tricky for the students to properly wire the unused inputs high.

Given the high risk of ruining the boards trying to cute them with the board shears, I decided to redesign for a 50¢ board.

Much looser layout, having only two copies on the 50mm x 50mm board. This version makes it easier for the students to see how things are connected, and has lots of room for the board shears to make the cut.

The lab would now require that the students measure the thresholds of the Schmitt trigger, breadboard the hysteresis oscillator, make a touch pad out of foil and packing tape, measure the frequency of the oscillation to estimate the touch pad capacitance, adjust the parameters of the Arduino program to match the frequencies of their oscillator, solder up the board, and demonstrate it working to control an LED. I think that is plenty for a 3-hour lab.

When I set up the web pages for the course, I’ll try to make sure I put the Eagle design files (.brd and .sch) for each board the students use on the web, so that future instructors can easily order more copies of the board, even if my laptop gets run over by a beer truck.  That will also make it easier for instructors at other schools to try to duplicate the course.

### Home school students at Baylor

Filed under: home school,Uncategorized — gasstationwithoutpumps @ 13:07
Tags: , ,

A couple of years ago, Baylor University released a report on home school students at Baylor and how well they performed (Profile of First-Time Freshmen from Home Schools, Fall 2005 to Fall 2009). Some home-schoolers point to this report as evidence for how good home schooling is, because of statements in it like

Home school students took a slightly higher credit hour load during their first semester compared to the entire first-time freshmen population. The home school group also had a higher cumulative GPA at the end of their first year.

Of course, the report is useless for saying much about home schooling, since it only looks at how well the students admitted to Baylor did.  But to get into Baylor, home schoolers have to have very high test scores (according to the report, 61.3% of the home school students who enrolled at Baylor had SAT reading+math ≥1300, while only 25.3% of the overall freshman classes did).  Because the report does not match the home school admittees to a population with a similar distribution of SAT scores, any conclusions about how well the home school students perform are meaningless.  It would have been interesting to see whether there was a difference in performance, retention, levels of depression, … between home schoolers and regularly schooled students, but only after first controlling for differences in admissions policies and practices (for example, by matching SAT scores, gender, and income levels).

What one can reasonably conclude is that to get into Baylor as a home school student took exceptionally high test scores (only 6.4% of home school students who enrolled had SAT scores less than 1100, while 21.7% of the overall class did). The median SAT score for home schoolers  who enrolled was 1325, while for the class as a whole it was 1200.  The entire distribution for home schoolers is shifted up about 120 points from the distribution for the whole class.  This difference may reflect the greater reliance on test scores rather than GPA for home school applicants, as calibration for home school GPA is difficult.

The difference is not proof of discrimination against home school students, of course, as we have no idea what the pool of home school students looked like (for all we know, Baylor may have accepted all that applied), but it is suggestive of a higher threshold for home school students.

What is most disturbing to me is that the Office of Institutional Research and Test at Baylor thought that this profile supported their conclusions about differences in performance related to home schooling—I would expect better controls from a collegiate study, even one done by staff rather than faculty.

## 2012 November 23

### Pressure sensor boards arrived

The breakout boards for the MPX2053DP pressure sensors arrived today.  They would have arrived two days ago, but I was at work and no one here heard the postman come—the packages have to be signed for, so I had to go down to the post office to day to get the package. I placed the order with ITEAD on 2012 Oct 29, they sent me e-mail saying they had shipped it on 2012 Nov 7, and it arrived 2012 Nov 23, for a total delay of 25 days.  I plan to order more sets of PC boards from them this weekend: another order of the pressure-sensor boards, a revised instrumentation amp prototyping board, and a hysteresis oscillator board.  If I order on 2012 Nov 24, I may get them by Dec 21, even without a special order.

MPX2053DP on the breakout board.

I assembled one MPX2053DP breakout board. It turns out that the leads are just barely long enough to reach the PC board, if you bend them at 90° right where they change size.  That is where I had planned the bend when I laid out the board, so I’m glad it worked.  The M3 machine screws do a fine job of holding the sensor in place, making soldering easy.  I’ll use metal M3 screws for the sensors I assemble for the lab, rather than nylon ones.

I’m using a different screw terminal than before.  This one has a 0.1″ pitch, which is convenient for matching up with dual-inline packages and is more compact than the 3.5mm pitch screw terminals I was using before (I got a bunch of 3.5mm and 5.0mm pitch screw terminals in the ITEAD order, very cheap, but I’ll probably not be using them for new designs, unless I need heavier wires than the 0.1″ screw terminals will take).  One minor problem with the new terminals is that you need a 1.5mm jeweler’s screwdriver—a 2.5mm screwdriver is too wide.  Luckily I have a smaller one, and the set I was planning to include in the student toolkit has not only 1.5mm, but several smaller ones.

I tested the pressure sensor with the amplifier I had wired up for the MPX2300DT-1 sensor, and noticed that it was very easy to peg the sensor at either extreme—I’ve got the gain set too high for this sensor.
Note that the MPX2053 has a response of 8E-08 Vdd/P, while the MPX2300 has a response of 3.75E-8 Vdd/P, where Vdd is the supply voltage to the sensor, and P is the pressure in Pascals.  So the MPX2053DP needs only half as much gain.  I also noticed that the INS126 instrumentation amplifier does not have rail-to-rail output.  I saw it going from 0.355 V to Vdd-0.7 V, though the spec only claims linearity from 0.8V to Vdd-0.75V typically.  I should probably turn the gain down by a factor of 10 in the instrumentation amp and use a second-stage op amp with a gain between 2 and 4 to get a rail-to-rail signal.  That will require unsoldering the gain resistor and wiring up a couple more resistors for the second-stage op amp.  I think I’ll do it in 2 steps: first adjusting the instrumentation amp gain by replacing Rgain and seeing what range of voltage I get from my breath pressure, then adding a second stage amplifier to bring that to full scale.

I think I’ll try a first-stage gain of 102.6 (instead of 1072), which should give me a response of 8.205E-6 Vdd/P, and a full scale reading of 121.88 kPa, or 119Pa/count.  With that resistor in place, I’m not pegging the output at either end, and I’m using a little over ¼ of the available range.   A second-stage gain of 2 should be safe, but 3 may occasionally hit the stop. Perhaps I should aim for 50Pa/count, which would need a gain of about 2.38.   The best way to do this with a non-inverting op amp using standard resistors would use (11.5+15.8)/11.5 for a gain of 2.3739 (about 0.004% lower than I want).  I wrote a little Python program which can find the best approximation to any ratio using standard 1% resistor values—I didn’t try them all by hand!  Unfortunately, I have the standard 10% series (though with 1% resistors), so I need to try something like (47+33)/33, for 2.4242, a 3.2% error.  My gain would then be 102.56*2.4242=248.63, for a full-scale reading of 50.275kPa, or 49.1Pa/count.  It would be reasonable to use 33kΩ and 47kΩ.

Using just the instrumentation amp (single stage), the lowest pressure I recorded was –19.2 kPa (–2.79psi) and the highest was 15.1kPa (2.19 psi).  Using a handheld vacuum pump, I found that the low-pressure stop was about -390mm Hg (-52kPa), but that is with a most-likely inaccurate cheap dial gauge.  The clipping when the vacuum pump goes beyond that is at -392 counts (-46.64kPa, if the specs and the gain computations are to be believed).

After I soldered in resistors and wires for the second stage, it bottoms out at -25.24kPa (-3.66psi), with zeros.  I looked at the first-stage output on one Arduino channel and the second stage output on another, and fit a straight line to the untruncated part using gnuplot.  If we fit  stage2=g*(stage1-m)+m, we get a gain g=2.4351 and a midpoint offset m=511.677.   The total gain is thus about 249.74, for a full-scale reading of 50.05 kPa, or 48.88 Pa/count. The midpoint is not exactly at ambient pressure: it is about 300Pa below ambient pressure.  The spec calls for an offset that is <2.5% of the full-scale reading, and what I’m seeing is less than 1%, so I suspect that the offset is in the sensor, not in my circuitry. Doing another run blowing into the tube and sucking on it, the highest pressure I could manage was about 17.3kPa (2.51psi).  The lowest pressure I could get by mouth was about -16.6kPa (-2.41psi).

It would probably be a good idea to calibrate the sensor with a water column, but I still need to think that through a bit more—I don’t want a flood.

### Other items in the package

In the same delivery from ITEAD, I got an assortment of 25 different capacitor values (10 of each).  These turn out to all have a 0.1″ (or 2.5mm) lead spacing, so I need to redesign the hysteresis oscillator board for that spacing (rather than the 0.2″ spacing I had used in the design). I had thought that there was about equal chances of 0.1″ or 0.2″ spacing, so I was not going to send out the new PC boards until I’d gotten the capacitors and checked.  The assortment comes nicely sorted in 25 tiny zipper-seal bags, but the bags aren’t labeled, so the first thing I did was to get out a Sharpie and a magnifying glass so that I could read the labels on the capacitors and label the bags.  I can’t order the capacitors for the students until Dec 14 (as students may still be registering for the course), so they will probably need to be ordered with express shipping.

Also in the same delivery was an assortment of 11 different bipolar transistors, 10 of each.  If we were doing anything in the class with bipolars, the price is pretty good (6.2¢ each), but now that I’ve decided we’ll use FETs for the power amplifier output, there won’t be any need for bipolar transistors.  I’ve not found a comparably cheap collection of FETs.

## 2012 November 20

### Updated things to do on circuits course

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

On 2012 Nov 1, I posted a to-do list for the course.  How many things have I checked off, and what has been added?

• Schedule the lecture.
• Schedule the lab.  I’ve asked for the slot, but not heard back yet.
• Advertise the course. I’ve sent e-mail to all the bioengineering students and made a few flyers to put up around campus. I’ll make a few more to post next week. Here are the two ads as PDF file: ad1 and ad2.
• Make a template for the lab handouts.  I started on this, but have not gotten very far.
• Start making lab handouts. This has made even less progress than the template.
• Get a university credit card for ordering parts and tools for the student kits that the students will have to buy. Can’t be done. Lab fees would have had to been approved last Spring, no “Pro cards” are available, and any orders would have to go through Purchasing anyway, who will be closed for a couple of weeks in December, right when I need to order. (Plus several of the vendors I plan to use are not “qualified” vendors, and getting the paperwork done for that can take weeks.)  I’ll have to buy all the parts out of my own pocket and sell (at cost) directly to the students.  I’ll probably end up losing some money on the deal, and being left with some extra parts.  That’s probably less painful than dealing with Purchasing, though.
• Make the parts list and tool list for the student kits.  See the draft. I’ve also pretty much decided that the pressure sensors should be treated as lab equipment and loaned out rather than having the students buy their own.
• Start finding sources for the parts and tools. See the draft.
• Try out the modified pressure sensor lab.  Still waiting for the breakout boards to be shipped from China.
• Redesign the instrumentation amp protoboard. I had hoped to do this last weekend, but am now aiming for Thanksgiving weekend.
• Decide whether to include a transistor lab and what it should be.  I talked with my co-instructor and he likes the idea of a power output for an op amp to drive a loudspeaker.  We discussed bipolar vs. FET—he’s happy with either, but I favor a cMOS design that can go rail-to-rail, especially as the biasing is just voltage-based, with no need to worry about base currents. We’ll also include an electrolytic DC-blocking capacitor, so that we can still use a single-rail power-supply. I’ve not selected the transistors or prototyped the circuit yet. I spent some time today looking at prices and spec sheets for nFETs and pFETs.  They’ll cost a bit more than bipolars, since the only ones I can find are much beefier than we really need, but this means something like 84¢ for the pair of transistors, rather than 42¢, so the difference is pretty trivial.
• Come up with a photodetector lab.  Still no good ideas here.
• Try to line up a biologist who can give a guest lecture on excitable cells and action potentials before the EKG lab.  Not even looked for possible candidates yet, but we need the lecturer near the end of the quarter, so there is time still.
• Figure out how much to teach about volume conduction for the EKG lab, and how to teach it.
• Get lab tech staff to install gnuplot, Arduino, and Python 2.7 on lab computers (unless they are already installed). They’ve agreed to do so as soon as Fall quarter ends.
• Get son to finish his rewrite of data logger code and test on the lab computers (will require getting him access to the lab over break). He’s made progress on the old version (fixing some minor bugs and adding features), but he wanted to do a full refactoring and has not finished that yet. I’ve not gotten lab access for us yet.