# Gas station without pumps

## 2021 January 9

### One week into new quarter

We’re one week into the new quarter (10% of the way through!) and the course is going ok. Most of the students have finished the first-week lab, which consists of installing a lot of software and soldering headers onto a Teensy LC board.

The software they had to install was

Of course, each piece of software has its own installation idiosyncracies, different on Windows, macos, and Linux.  Some people even bumped into some problems because of running old versions of macos or Python (which were luckily cleared by upgrading to slightly newer versions).

The soldering was a bigger problem, because many students plugged in their cheap irons and left them on for a long time without tinning the tips.  The result was a sufficient build-up of corrosion that that they could not then tin the tips—even using a copper ChoreBoy scrubber to clean the tips didn’t help in some cases. In the in-person labs, I often spent most of the first week labs cleaning soldering iron tips that students had managed to mess up, but I can’t do that online.  This was not such a problem last quarter, as most of the students knew how to care for soldering irons from the first half of the course, but it may be a bigger problem this quarter, as most of the students have never touched a soldering iron before.  Some of the ones who are living here in town may be contacting the lab staff to see if they can get access to tip tinner or get some help cleaning their irons.  Those further away may be buying tip tinner on their own—I had not included it in kits, because I nad not expected so many to need it and it costs $8 apiece. Grading is going fairly well. My grading team and I have had two Zoom meetings so far (for Homeworks 1 and 2) and I graded Quiz 1 by myself, so we are keeping up with the grading. He have Homework 3 and Prelab 2a (there is no Prelab 1) both due Monday morning, and we’ll try getting them graded Monday night. We’re having to do most of our grading in the evening, because one of the graders is living in China, 15 time zones away, and none of us in California is an early morning person. In other news, I’ve finally finished clearing the blackberries and ivy from behind the garage (a project I started about 2 years ago). I’ll probably find some more when I cut back the kiwi vine (an annual winter project, in addition to frequent minor pruning during the summer). I think I either need to get some female kiwi vines and an arbor for them or uproot the male kiwi. There is really not much point to having just a male kiwi intent on taking over a big chunk of the yard. There are still a lot of blackberry roots out there that will sprout new vines. I’ll try uprooting them where I have access (not where they are coming through the cracks in the concrete), but I’ll probably have to do a monthly sweep of the yard to remove blackberries for the rest of my life in this house. ## 2020 October 28 ### Analog Discovery 2 power-supply noise Filed under: Circuits course — gasstationwithoutpumps @ 11:38 Tags: , , , Last night and this morning I spent some time investigating the noise on the power supplies of the Analog Discovery 2, because some students were having trouble with power-supply noise on their audio amplifiers (an inherent problem with biasing the microphone with just a bias resistor to the power supply). I looked at the positive supply set to +3.3V using oscilloscope Channel 1, and saw a fluctuation in voltage that was not too surprising for a switching power supply (though the switching frequency seemed ridiculously low). The power supply is specified to stay within 10mV of the desired voltage, and the voltage seemed to be doing that. I know that some switching power supplies shut themselves off under low-load conditions, to retain efficiency at the cost of adding low-frequency ripple to the output, so I tried running the power supply with different load resistors. I did the sampling at 400kHz and took FFTs of the signal (exponential averaging of RMS with weight 100, Blackman-Harris window). Here are the signals: The signals show quite a bit of oscillation without a load, but decreasing with increasing load. Here are the spectra from the Fourier transform (removing the DC spike): The spike around 57.2kHz is present with all loads and remains at the same frequency even if I change the sampling rate, so is probably the underlying frequency of the switching power supply. The rather large fluctuations in the audio range are probably the result of the power supply shutting itself off when there is low current draw. Drawing 10 mA is not quite enough to prevent this shutdown, but 27.5mA seems to be enough. So there seem to be at least three solutions for students having problems with power-supply noise: • Taking enough current from the power supply that the power supply doesn’t shut itself down. This is a rather fragile technique, as other sources of power-supply noise (such as noise injected by the power-amplifier stage in a later lab) will not be eliminated. • Using a transimpedance amplifier instead of a bias resistor to bias the mic. The bias-voltage input to the transimpedance amplifier can have a low-pass filter to keep it clean. • Putting a low-pass filter (with a small resistor and large capacitor) between the power supply and the bias resistor. The resistance of the filter adds to the resistance for the DC bias calculation, but not to the resistance for the i-to-v conversion. ## 2020 June 5 ### Compensation in impedance analyzer Filed under: Circuits course — gasstationwithoutpumps @ 00:18 Tags: , , The Analog Discovery 2 has an impedance analyzer that includes short-circuit and open-circuit compensation to correct for the impedances of the test fixture, and I’ve been thinking about how that might be computed internally. The open-circuit and short-circuit compensation can be applied independently or together, but each requires making and recording an impedance at each frequency for which impedance analysis is done. Since there are three impedances that are measured (open-circuit, short-circuit, and device-under-test), I came up with two circuits that could model the test setup: The measurement is made at the two ports, and Z_DUT is the device being measured—the other two impedances are parasitic ones of the test fixture that we are trying to eliminate. Let’s look at the short-circuit compensation first. For the first model, if we replace Z_DUT with a short circuit, we measure an impedance of $Z_{sc} = Z_{s1}$, while for the second circuit we measure $Z_{sc} = Z_{p2} || Z_{s2}$. In the first model, we can do short-circuit compensation as $Z_{DUT} = Z_{m} - Z_{sc}$, where $Z_{m}$ is the measured impedance with the DUT in place. For the second circuit, we would need to measure another value to determine the appropriate correction to get $Z_{DUT}$. For open-circuit compensation, in the first model we get $Z_{oc} = Z_{s1} + Z_{p1}$ and in the second model we get $Z_{oc} = Z_{p2}$. So for the first model we would need another measurement to get $Z_{DUT}$, but for the second model $Z_m=Z_{oc} || Z_{DUT}$, so $Z_{DUT} = \frac{1}{1/Z_m - 1/Z_{oc}} = \frac{Z_m Z_{oc}}{Z_{oc}-Z_m}$. If we do both compensations, we can use either model, but the corrections we end up with are slightly different. For the first model, we have $Z_m = Z_{s1} + (Z_{p1} || Z_{DUT}) = Z_{sc} + ((Z_{oc}-Z_{sc}) || Z_{DUT})$. We can rearrange this to $Z_m - Z_{sc} = (Z_{oc}-Z_{sc}) || Z_{DUT}$, or $\frac{1}{Z_m - Z_{sc}} = \frac{1}{Z_{oc}-Z_{sc}} + \frac{1}{Z_{DUT}}$. We can simplify that to $Z_{DUT}=\frac{1}{1/(Z_m-Z_{sc}) - 1/(Z_{oc}-Z_{sc})} = \frac{(Z_m-Z_{sc})(Z_{oc}-Z_{sc})}{Z_{oc}-Z_m}$. If $Z_{sc}=0$, this simplifies to our open-compensation formula, and if $Z_{oc}\rightarrow\infty$, this approaches our formula for short-circuit compensation. For the second model, the algebra is a little messier. We have $Z_m = Z_{oc} || (Z_{s2} + Z_{DUT})$, which can be rewritten as $\frac{1}{Z_m} - \frac{1}{Z_{oc}} = \frac{1}{Z_{s2} + Z_{DUT}}$, or $Z_{s2}+Z_{DUT} = \frac{1}{1/Z_m - 1/Z_{oc}} = \frac{Z_m Z_{oc}}{Z_{oc} - Z_m}$. We also have $1/Z_{sc} = 1/Z_{p2} + 1/Z_{s2}$, so $Z_{s2} = \frac{1}{1/Z_{sc} - 1/Z_{oc}}=\frac{Z_{sc}Z_{oc}}{Z_{oc} - Z_{sc}}$, and so $Z_{DUT} = \frac{Z_m Z_{oc}}{Z_{oc} - Z_m} - \frac{Z_{sc}Z_{oc}}{Z_{oc} - Z_{sc}}$ $Z_{DUT} = Z_{oc} \left( \frac{Z_m}{Z_{oc}-Z_m} - \frac{Z_{sc}}{Z_{oc}-Z_{sc}}\right)$ $Z_{DUT} = Z_{oc} \left( \frac{Z_mZ_{oc} - Z_{sc}Z_{oc}}{({Z_{oc}-Z_m})(Z_{oc}-Z_{sc})}\right)$ $Z_{DUT} = \frac{Z_{oc}^2(Z_m - Z_{sc})}{({Z_{oc}-Z_m})(Z_{oc}-Z_{sc})}$ Once again, when $Z_{sc}=0$, this formula simplifies to our formula for just open-circuit compensation, and when $Z_{oc}\rightarrow\infty$, this approaches out formula for short-circuit compensation. We can make the two formulas look more similar, by using the same denominator for both, making the formula for the first model $Z_{DUT} = \frac{(Z_{oc}-Z_{sc})^2(Z_m - Z_{sc})}{({Z_{oc}-Z_m})(Z_{oc}-Z_{sc})}$ That is, the only difference is whether we scale by $Z_{oc}^2$ or correct the open-circuit measurement to use $(Z_{oc}-Z_{sc})^2$. At low frequencies (with any decent test jig) the open-circuit impedance is several orders of magnitude larger than the short-circuit impedance, so which correction is used hardly matters, but at 10MHz, changing the compensation formula can make a big difference. For example, for the following compensation measurements using the flywires, a breadboard, and some short leads with alligator clips to make the test fixture the choice of compensation formula would make a 3% difference is the reported impedance at 10MHz. Notice that $Z_{oc}$ is approximately a small capacitor and $Z_{sc}$ is approximately a small resistor in series with a small inductor. Shorter wires and no breadboard can make these parasitic values much smaller, so that the compensation is not so crucial. For example, here are measurements of the impedance analyzer board: Because the open-circuit impedance here is much higher than the input impedance of the measuring oscilloscope channel, I believe that corrections have already been made for known characteristics of the oscilloscope channels. The exact values of the $Z_{oc}$ measurements are often limited by the noise in measuring the current through the sense resistor, at least at lower frequencies, where the impedance of the parasitic capacitance is very high. ## 2019 December 19 ### Macos 10.15 Catalina vs PteroDAQ I had a serious scare today. First, I found out that the software for my Analog Discovery 2 was crashing on the MacBook Air that I will be using for lectures and lab next quarter. It behaved normally at first and then crashed for no discernible reason after a couple of minutes. I figured that the problem was probably related to the macos “upgrades” I had done recently, so I checked the Digilent website, and they had just posted a new version of the software last week, addressing the changes that Apple had made to their USB stack (which broke almost all 3rd-party software and a fair amount of Apple’s own software). I downloaded the new version of Waveforms from the Digilent site and everything worked again. But any changes to the USB stack are likely to break the code that PteroDAQ uses for finding what devices are connected, so I checked PteroDAQ with my usual setup. The GUI for PteroDAQ did not list the Teensy board as it used to do, and PteroDAQ couldn’t run! I spent a long time with ioreg trying to figure out how to modify macgetports.py to find the device again. The Teensy board was visible as an AppleUSBDevice and AppleUSBInterface, but not as an IOSerialBSDClient as it used to be. I could not figure out how to open it as a serial port! Now my usual setup involves going through a USB 2.0 hub (in the Cerebrus cable), so I dug around in my drawer of parts until I found a plain USB-micro data cable. Hooking up the Teensy board directly with that cable did show an IOSerialBSDClient interface, and PteroDAQ worked fine. So the problem is just that connections through the USB 2.0 hub are not made the same way they used to be—the serial connection no longer is visible the way it used to be. I’ll enter an issue for this on the PteroDAQ GitHub, but I won’t try to fix it unless it turns out that modern USB C-USB 3 docks exhibit the same problem. ## 2019 August 14 ### Beginning design of a cat drinking fountain Filed under: Uncategorized — gasstationwithoutpumps @ 22:11 Tags: , , , One of our cats likes to drinking from running water (a bathroom sink on a trickle setting), so my wife challenged me to make a drinking fountain for the cat that recirculates water in a water dish. This project will be mainly physical design (3D printing, gluing things together) with a little electronics to control the pump. I started by buying a very cheap pump from American Science and Surplus: an ET 23 series pump that they are getting rid of for only$2.50.  Somewhat surprisingly, there is a data sheet available for this pump from the manufacturer: http://www.et-pump.com/brushless_23.html, but (not so surprisingly) the specs are different from what American Science and Surplus claims. The manufacturer says that the pump is submersible and can be run at 5V to 12V, while American Science and Surplus says it is not submersible and runs on 4V to 6V.  Because the pump electronics are fully potted, I tend to believe the manufacturer on this one.

The pump uses a brushless motor with two sets of windings (and only 2 transistors to power them) and seems to start pumping at about 4V.  To characterize the pump, I used my Analog Discovery 2 to sweep the power-supply voltage from 0V to 10V, measuring the current through a 0.5Ω resistor.  The results were interesting:

At low voltage, the current seems to be exponential with voltage, as would be expected from having a diode in the circuit—the nonideality of 5.6 is consistent with about 3 silicon diode drops. Above 4V, the motor behaves about like a 26Ω resistor, though with a lot of noise. The turn-on and turn-off behavior between 2V and 4V is interesting—the pump takes a lot of power at these voltages. All these measurements were taken with the pump running dry—it likely behaves differently when pumping water.

The “noise” in the I-vs-V curve is not random noise—it is fluctuation in the amount of current taken as the circuitry for the brushless motor switches between the two sets of coils. If we set the power supply to a constant 5V across the motor in series with the 0.5Ω resistor, we can observe the voltage and the current for the motor:

The two coils seem to take slightly different peak currents when the switch for them is turned on, but both spikes are about 2.8 times the average current. The frequency is around 643 Hz, which implies a speed of around 19300RPM.

I tried controlling the pump with one of the PWM LED controllers that I made for the desk lamps. With a 6V power supply, I need about 60% duty cycle to start the motor, but then can turn it down to about 15–20% duty cycle.  With an 8V power supply, I need about 40% to start and with a 10V supply about 30% to start. All these were crude measurements by turning a potentiometer until the motor started, but they are consistent with about a 3.3V average starting voltage and ability to keep running down to almost 1V.  If the pump stalls at low voltage, one has to bring it up to about 3.5V to turn it back on.

The motor runs even with fairly slow, low-duty cycle PWM. The current spikes at the beginning of each cycle are large.

The PWM control seems to work even with a PWM frequency as low as 270Hz, which is somewhat surprising.  There does not seem to be much in the way of voltage spiking, even with no capacitor or flyback diode added.  There is a short-lived initial current spike of about 3.5A (staying above 2A for about 4µs), which probably comes from charging capacitor C3 in the motor, which is across the power lines after the diode D1 (which seems to be there to prevent reversed power supply).  The 11µC spike is consistent with C3 being about a 1 µF capacitor (or maybe 2.2µF), which seems plausible.  I’m not sure why the current drops to 0 before the motor voltage drops more than about a volt.

I bought some cheap plastic bowls from a thrift store, and my next task is going to be to design a 3D-printed base to hold the pump and the electronics under the bowl and a clip to hold a ¼” ID vinyl tube over the bowl.  The pump is not self-priming, so I need to drill a hole in the bottom of the bowl and glue on the pump to make a gravity feed to do the priming.

Next Page »