Gas station without pumps

2017 September 27

Jig for drilling Lego bricks

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

For the pulse-monitor lab, I have students drill ⅛” holes through 1×2 black Lego bricks (see Lego as LED holder and Lego as LED holder revisited), to make holders for 3mm phototransistors and 3mm LEDs. I hauled my drill press up to campus in my bike trailer last year to have students drill their own bricks, but I was not happy with the plywood jig that I had put together at the last minute—it worked, but there was a tendency for the bricks to jack-knife when the drill press vice was closed, because I had a sliding piece to clamp the brick.

I redesigned the jig yesterday and came up with a much simpler and (I think) more reliable design:

This side view shows the jig cut out of a piece of polypropylene cutting board that had been retired from kitchen use as too beat up. The bottom edge is straight, and the top edge has a rectangular cutout exactly the width of a Lego brick. (The top edge is not flat, because it was cut from a part of the cutting board that had a handle.)

Here is a top view of the jig in the drill press vice. In classroom use, I’ll probably use some painters’ tape to hold the jig to the non-moving jaw of the vice.

To use the jig, open up the vice a little bit, snap the brick into place, and tighten the vice gently to hold the brick securely. The cutting board is just a little thinner than the height of the brick, so the clamping force of the vice is entirely on the brick.

I may add these photos to my book.

Advertisements

2017 August 19

Progress on my book

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

I have been slogging through the book, updating it to include feedback I got on it from students and notes I had made on grading assignments, and revising the labs to use the Analog Discovery 2 rather than conventional bench equipment.

I was a little disheartened when I noticed that I’ve just finished updating through Lab 3, out of the 12 labs. That looks like I’m only a quarter of the way through the rewrite, when I had hoped to be almost halfway by now. When I look at it in terms of pages, though, I’m much further along—I’ve revised through page 142, and there are 360 numbered pages before the references (not counting the 37 Roman-numeral pages), so I’m about 40% of the way through the rewrite. That’s a little behind schedule, but not terrifyingly so, especially since it is the beginning labs that needed the most changes to convert to using the Analog Discovery 2.

There are still 132 to-do notes scattered through the book, some of which are in sections I’ve counted as “done” for the summer, so I’m not going to run out of work on the book any time soon.

The PDF file is currently at 411 total pages, with 179 figures (203 distinct images, as there are some figures with subfigures) and 13 tables. It is up to 22.8Mbytes, which I could probably reduce by a few MBytes by better compression of some of the JPEG figures.

I’ve previously thought that it would be good to be able to make paper copies of the book available to students (see Textbook should be on paper), but the print-on-demand services seemed too expensive.  I was apparently not looking at reasonable services, as IngramSpark’s “print-and-ship” calculator says I can now get a single copy (perfectbound paperback, standard color, simplex cover) for about $24 (including shipping and sales tax).  Ordering 50–100 copies doesn’t reduce the price much (still $20 a copy—all the reduction is in shipping).  Unfortunately, their “weight and spine width” calculator says that my page length is out of range for an 8.5″×11″ book, but if I reduce my trim size slightly (t0 8.25″×10.75″), I can print with them and the cost is about a dollar more.  (There may also be an initial setup charge to create the book the first time, including things like getting an ISBN.)

If the book gets much fatter, I’d have to switch to a smaller trim size, which would make the book fatter still, and the increase in the number of pages would increase the cost.  I think that a 7″×10″ trim (which would allow up to 1140 pages) would cost about $3.50 more than an 8.5″×11″ book for the same content, assuming that I reduced the margins and the text block, but didn’t change font sizes.

Paper books through distribution channels are expensive: to get $4 a book (about what I get from the $5 e-book sales through Leanpub), I’d have to have a list price of about $42 a book based on IngramSpark’s publisher’s compensation calculator.

2017 July 13

Analog Discovery 2 oscilloscope input impedance fixed

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 23:25
Tags: , ,

This morning in Analog Discovery 2 oscilloscope input impedance, I wrote

I cannot fit a model based on the input divider circuit to the data—I keep getting a negative capacitance for C9 or C8, so that they can cancel each other.  These models also make C1 around 50pF.

So I can reconcile the DC behavior (1.044MΩ is well within the ±2% measurement error of the nominal 1.04MΩ), but not the AC behavior of the scope inputs.

I must be missing something, but what?  Any useful suggestions (which don’t involve modifying the Analog Discovery 2) are welcome.

This evening I figured out what I was missing. The model I was trying to fit was the following one for the oscilloscope, with a 2MΩ resistor in series as the reference impedance:

There is a natural, internal split into an 820kΩ and 220kΩ resistance in the input voltage divider (component numbers here are for channel 1, but channel 2 is identically designed).

What I was missing was parasitic capacitance from the breadboard and scope wiring. If I model a capacitor (Cref) in parallel with the 2MΩ resistor and another capacitor (Cextra) in parallel with the scope, I can get a good fit.  I can leave all the internal resistors and capacitors at their nominal values, and fit for several different values for the trim capacitor C8:

I can get an excellent fit with Rref being only a little over 1% off and reasonable parasitic capacitance values.

Analog Discovery 2 oscilloscope input impedance

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 11:43
Tags: ,

I have been blindly trusting the documentation for the Analog Discovery 2 that claims that the input impedance of the differential oscilloscope channels is 1MΩ || 24pF.  Yesterday, when my son was measuring the input impedance of the reference inputs of a sigma-delta ADC, we had reason for a while to doubt that claim, so I measured the input impedance in a simple way:  I put a 2MΩ 1% resistor in series with one input channel and used the other input channel to measure the voltage across the series pair. I swept the network analyzer from 10Hz to 1MHz, and recorded the voltage gain (and the phase).  The voltage gain is not well-fit by a simple (1MΩ || 24 pF) model, as the impedance does not keep decreasing.  It seems to be well modeled by a model with Rs+(Cp||Rp), though.

The reported voltage gain for Channel 2/Channel 1 is well fit by a voltage divider.

Because the Analog Discovery 2 reports gain for Channel 2/Channel 1, I had to invert the data to get it in the form I wanted for my model (I could, alternatively, have swapped the legs of the voltage divider in the model).

The phases were also well fit by the models, though I did not use the phase information in the fitting. (I tried refitting using just the phase information, but that did not change the parameters by much, nor did it visibly improve the fit of the measured phases, so I left the parameters with just the amplitude fit.)

The DC impedances are both 1.044MΩ, very close to the specified value, but the capacitor is over twice the specified value, and not directly in parallel with the resistance.  The reference resistor I used is supposed to be a 2MΩ±1% resistor, but it was part of a cheap assortment, and we’ve found these cheap assortments to often be slightly out of spec, so I’d not trust it to be better than ±2%.

The 200kΩ/800kΩ split is not very surprising, when we look at the circuit for the input divider of the oscilloscope (from the hardware reference manual):

There is a natural, internal split into an 820kΩ and 220kΩ resistance in the input voltage divider (component numbers here are for channel 1, but channel 2 is identically designed).

The appearance of the 200kΩ/800kΩ split in the model for the input impedance suggests that the trimmer capacitor C8 is not properly adjusted.  If all capacitance and resistance values were nominal, then C8 should be set to 39.59pF, to provide a flat response from the voltage divider (at the high-gain setting), producing an input impedance of (1.04MΩ || 26pF).  But C8 only has a 5–20pF range, so perhaps there are some other, parasitic capacitances that change the desired trimming.

I cannot fit a model based on the input divider circuit to the data—I keep getting a negative capacitance for C9 or C8, so that they can cancel each other.  These models also make C1 around 50pF.

So I can reconcile the DC behavior (1.044MΩ is well within the ±2% measurement error of the nominal 1.04MΩ), but not the AC behavior of the scope inputs.

I must be missing something, but what?  Any useful suggestions (which don’t involve modifying the Analog Discovery 2) are welcome.

2017 June 28

Changing the loudspeaker lab

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 21:38
Tags: ,

I’ve started looking at how the loudspeaker lab in the applied-electronics course will change, given that we will have the Analog Discovery 2 USB oscilloscope in the labs.  There are two main changes in capabilities:

  • hundreds of measurements can be made in a couple of minutes from 10Hz to 1MHz
  • phase information is available, not just amplitude information.

The availability of phase information means that we can try fitting complex impedance, and not just the magnitude of impedance.  Unfortunately, the gnuplot curve fitting that we’ve been using is only set up for fitting real-valued functions, not complex-valued ones, and I don’t really want to switch to a more full-featured model fitting program, as they get hard to use.

Today I gathered data from two loudspeakers: the tiny 1cm one that I have posted about before (Ultrasonic rangefinder tests with tiny loudspeaker and Redoing impedance test for tiny loudspeaker) and an 8Ω oval loudspeaker that we used to use in the class until Parts Express sold out of them (Loudspeaker analysisBetter model for loudspeaker). I only collected data out to 1MHz, since my previous experience indicated that the network analyzer was not very useful past that frequency (Loudspeaker impedance with Analog Discovery 2). I put a 22Ω resistor in series with the loudspeaker and measured the voltage across it on channel 1, with the voltage across the loudspeaker on channel 2.  I recorded the “gain”, which is channel2/channel1, and the phase for channel 2 relative to channel 1.  The gain times 22Ω is the magnitude of the impedance of the loudspeaker.

The formula that I’ve been using for impedance modeling, R + ja\omega^\beta + (R_m || Z_{L_m} || Z_{C_m}), turned out not to be a good fit for the phase.  I played around for a couple of hours with different, more complicated models, before finally settling on a model that is as simple as the one I’ve been using, but that fits pretty well:

R + a (j\omega)^\beta + (R_m || Z_{L_m} || Z_{C_m})

The difference is just that I’m including the j inside the exponentiation, so that the “inductor-like” component is now in direction j^\beta instead of j—that is, the asymptotic phase angle is \sin^{-1}(\beta) instead of 90°.

To do the fitting, I alternated between fitting some of the parameters to the magnitude of the impedance and some to the phase. After I had layed around a bit and gotten ball-park estimates of the parameters, I did a more careful fitting. I started by fitting the series R to just the low-frequency end of the data, then fitting the resonance peak without the “inductor-like” component in the model with data collected in just a decade of frequency around the resonance peak (I used a separate data file that had 600 data points for just that decade).  I fit the three parallel parameters using the phase data, then refit the parallel resistance using the amplitude data.  To start in the right region, I set initial values R_m = R_{peak}-R, C_m = 0.3/\omega, and L_m = 3.3/\omega, with R_{peak} being the magnitude of the impedance at the top of the peak, located at frequency  f, with \omega = 2 \pi f.

With those parameters set, I fit \beta with phase information for the high frequencies, and a with amplitude information.

I then tweaked the fit by refitting the resonance peak, refitting \beta and a, and repeating the refits.

The 6-parameter fit for the magnitude is pretty good.

The 6-parameter fit for the oval loudspeaker is not great for phase, but is not too bad.

The 6-parameter fit for the tiny loudspeaker is pretty good, though I did not attempt to model the two higher frequency resonances that are visible, despite knowing that the resonance around 9kHz rings seriously.

The resonances are somewhat more visible in the phase plot for the tiny loudspeaker than they are in the magnitude plot.

I’m going to have to write up a tutorial for the book on using a real-valued fitting method for fitting a complex-valued function.

Next Page »

Blog at WordPress.com.

%d bloggers like this: