Gas station without pumps

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 January 6

OpenScope MZ review: Bode plot

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 14:47
Tags: , , ,

Continuing the review in OpenScope MZ review, I investigated using the OpenScope MZ for impedance analysis (used in both the loudspeaker lab and the electrode lab).

Waveforms Live does not have the nice Impedance Analyzer instrument that Waveforms 3 has, so impedance analysis is more complicated on the OpenScope MZ than on the Analog Discovery 2.  It can be done well enough for the labs of my course, but only with a fair amount of extra trouble.

There is a “Bode Plot” button in Waveforms Live, which performs something similar to the “Network Analyzer” in Waveforms, but it uses only a single oscilloscope channel, so the setup is a little different. I think I know why the Bode plot option uses only one channel, rather than two channels—the microcontroller gets 6.25Msamples/s total throughput, which would only be 3.125Msamples/s per channel if two channels were used. In contrast, the AD2 gets a full 100Msamples/s on each channel, whether one or two is used, so is effectively 32 times faster than the OpenScope MZ.

We still make a voltage divider with the device under test (DUT) and a known reference resistor, and connect the waveform generator across the whole series chain.  Because there is only one oscilloscope channel, we have to do two sweeps: first one with the oscilloscope measuring the input to the series chain (using the “calibrate” button on the Bode panel), then another sweep measuring just across the DUT.  The sweeps are rather slow, taking about a second per data point, so one would probably want to collect fewer data points than with the AD2.  Also there is no short or open compensation for the test fixture, and the frequency range is more limited (max 625kHz).

The resulting data only contains magnitude information, not phase, and can only be downloaded in CSV format with a dB scale.  It is possible to fit a model of the voltage divider to the data, but the gnuplot script is more awkward than fitting the data from the impedance analyzer:

load '../definitions.gnuplot'
set datafile separator comma

Rref=1e3

undb(db) = 10**(db*0.05)
model(f,R,C) = Zpar(R, Zc(f,C))
div(f,R,C) = divider(Rref, model(f,R,C))

R= 1e3
C= 1e-9
fit log(abs(div(x,R,C))) '1kohm-Ax-Bode.csv' skip 1 u 1:(log(undb($2))) via R,C

set xrange [100:1e6]
set ylabel 'Voltage divider ratio'
plot '1kohm-Ax-Bode.csv' skip 1 u 1:(undb($2)) title 'data', \
      abs(div(x,R,C)) title sprintf("R=%.2fkohm, C=%.2fnF", R*1e-3, C*1e9)

The fitting here results in essentially the same results as the fitting done with the Analog Discovery 2.

Although the Bode plot option makes the OpenScope MZ usable for the course, it is rather awkward and limited—the Analog Discovery 2 is still a much better deal.

2019 January 5

OpenScope MZ review

During the CyberWeek sales I bought myself an OpenScope MZ USB scope from Digilent, to see how it compared with the Analog Discovery 2, which I use frequently.  I particularly wanted to see whether I could recommend it as a low-cost alternative ($89 list) for the AD2 ($279 list, but $179 with academic discount).

I’ve not had a chance to do much testing yet, but the short answer is that I would recommend saving up for the Analog Discovery 2—the OpenScope MZ is nowhere near being a professional instrument, but the AD2 is close.

The first thing I tested was the function generator.  The OpenScope MZ does not have a real DAC, but uses digital output pins and a resistor ladder to generate analog voltages.  The result is a “DAC” that is non-monotonic.  The non-monotonicity can be observed by generating a sawtooth waveform and observing the result with an Analog Discovery 2.

The non-monotonicity is worst when the DAC switches from 0x1ff to 0x200 (from 511 to 512 out of 1024 steps). This was a 3Vpp sawtooth at 10Hz. The OpenScope MZ also has a much larger offset than the AD2.

To get clean measurements, I set the AD2 to average 100 traces.  I also did 16-fold oversampling, so that I could get good time resolution while recording the whole period.

The steps are not of uniform duration, but don’t seem to be a simple pattern of single or double clock pulses:

The step durations vary here from 64µs to 136µs in this small sample, but with 1024 steps in 0.1s, I would expect 97.66µs.

The step heights are not completely consistent either, but seem to average to roughly the right value:

The step size should be 3V/1024=2.93mV, but in this range the average step size is a little high. (but the first step at the bottom left is too small).  The variable duration of the steps is also very visible here.

The speed limitations of the amplifier for the OpenScope’s function generator are also quite clear:

There seems to be a 12V/µs slew rate limitation, and the large step at the end of the sawtooth has a 258ns fall time. By way of contrast, the AD2 has about a 40ns fall time for the same 10Hz ramp up and a slew rate of about 120V/µs.

I found the Analog Discovery 2 falling edge rather interesting—the stepwise descent may be an artifact of recording the waveform with the same instrument used for generating it (so that the oversampling does not work correctly), but it might also indicate that the ramp edge is digitally pre-filtered to keep it from overshooting.

2018 July 9

Analog Discovery breadboard adapter

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

As I mentioned in Analog Discovery Impedance Analyzer, I recently bought two new attachments for my Analog Discovery 2.  I reviewed the Impedance Analyzer in the earlier post, so in this one I’ll review the breadboard breakout.

The breadboard breakout provides a simple way to attach the Analog Discovery 2 to a breadboard, without using the female headers that come with the device.

Here is the breadboard adapter, plugged into the end of a breadboard.

The Analog Discovery 2 can plug into the breadboard vertically, which is compact, but requires disassembly to put the test setup back in its box for carrying.  Here it is shown plugged into the last 15 rows of the breadboard, but I had to move it in two rows to keep the weight of the AD2 from tipping the breadboard.

I tried doing a little work with the breadboard adapter and found it to be a mixed blessing. I used it for testing a circuit where I needed both oscilloscope channels, one power supply, and one waveform generator, which would normally use 7 of the 30 wires on the AD2.  Some of the wires (the power, ground, and oscilloscope 1- and 2- wires) could be quite short, as they connected to the power busses on the breadboard, but the other wires had to be fairly long, as they had to skip past all the trigger and logic-analyzer inputs that I wasn’t using.  I could have plugged the adapter into the breadboard the other way around, but then the AD2 itself would interfere with convenient wiring.  It would have been nice to have the most frequently used connections at the tip of the adapter, instead of the base of the adapter.

For a fixed setup, where the oscilloscope channels are always looking at the same signals, the breadboard adapter is more convenient that the standard flywire connections, which have a tendency to slip off the double-ended male headers that I use for connecting them to the breadboard.  The female headers of the flywires are not designed for many cycles of attaching and detaching, and end up getting too loose after a while.

But for debugging, when the oscilloscope channels have to be moved rapidly from node to node, the breadboard adapter is less convenient than having the separate flywires—unless much longer wires are used (with the attendant problems of extra inductance and capacitive pickup of 60Hz interference). Losing 17 rows of the breadboard to the adapter is also a problem, as it leaves only 47 rows of a standard 64-row breadboard, or 15 rows of half-length breadboard for building the test circuit.

I think that I will use the adapter for lecture demos, where I have fixed wiring to carry around, as I can spend less time setting up the demo just before class, at the cost of slightly more time the night before. My standard lecture setup will use a full-length breadboard with the adapter in one end and a Teensy LC in the other end (for PteroDAQ demos) using up 31 of the 64 rows, leaving me with the equivalent of about a half-length breadboard in the center for the circuitry being demonstrated.

I don’t know yet whether I’ll find the adapter useful for regular debugging—probably not much.

2018 July 1

Analog Discovery Impedance Analyzer

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 17:54
Tags: ,

One of the new toys I got this week was the Impedance Analyzer board for my Analog Discovery 2 (I also got a Breadboard Breakout, but I won’t discuss that in this post).

Here they are in the bags they shipped in.

And here they are unwrapped.

I tried testing out the impedance analyzer board today, to see how well it worked, and to try to determine the precision of the reference resistors they used, since Digilent does not seem to have provided that information on their datasheets.

The impedance analyzer board is used just like any other setup for using the Analog Discovery impedance meter: you select the reference resistor and the range of frequencies, run open-circuit and short-circuit compensation, then insert the impedance to measure and do a sweep. The only difference is that the board uses latching relays to select the reference resistor, rather than having to wire it yourself. The board has 6 resistors: 10Ω, 100Ω, 1kΩ, 10kΩ, 100kΩ, and 1MΩ.

I did several tests, many of which seemed rather inconclusive. One fairly consistent result was that the open compensation saw the open circuit as essentially a 1.63pF capacitance. One exception was the 10Ω resistor, which reported 5.4pF, but I suspect that is due to measurement error from quantization—as 1.6pF at 1MHz is still about -j 100kΩ and the 10Ω resistor would have only 0.001 times the voltage across the open circuit. These capacitance measurements were only consistent above about 3kHz—at lower frequencies I had rather noisy results, probably again because of quantization problems measuring small voltages across the reference resistor.

The short-circuit compensation reported values roughly proportional to the size of the reference resistor, with a maximum around 24mΩ for the 10Ω reference to 148Ω for the 1MΩ reference. The impedance changed a lot with frequency, with a maximum around 18kHz. The phase change varied a lot with frequency also.

I used the impedance meter to measure some 0.1% resistors that I had purchased previously to use as reference resistors in my own impedance setups. The impedance measured was not constant with frequency (generally fairly flat at low frequency, then peaking a little around 70kHz, then dropping off with higher frequency). The variation with frequency was as much as 2–3%. Incidentally, the latest version of Waveforms (3.8.2) still has the bug where the impedance meter sometimes exports the frequencies as if they had been stepped linearly, instead of logarithmically. [Update 2018 July 2: Digilent says that the bug will be fixed in the next release.  Based on their rate of updates lately, that should be soon.]

The impedance of the 10kΩ±0.1% resistor is not constant with frequency. This plot has a linear y axis, to accentuate the fairly small change that is measured.

I decided to measure each of the precision resistors using each of the reference resistors at 100Hz, with settling time set to 2ms and 32 cycles. (I probably should use a longer settling time for more accuracy at low frequencies and average 10 or more measurements.) I’ve marked in red those measurements that are off by more than 1%:

Reference 100Ω ±0.1% 1kΩ ±0.1% 10kΩ ±0.1% 100kΩ ±0.1%
10Ω 98.81Ω 986.3 9955 77.97k
100Ω 99.83Ω 998.8 9936 98.91k
1kΩ 99.88Ω 998.6 9980 99.69k
10kΩ 100.4Ω 998.5 9971 99.88k
100kΩ 106.1Ω 1005 9987 99.97k
1MΩ 118.3Ω 1042 10000 99.97k

The results are best when using a reference resistor within a factor of 10 of the resistor being measured, and those results seem to be within about 0.2% of the correct value, which suggests that Digilent is using 0.2% resistors (or that they got very lucky with standard 1% resistors).  The one set of bad values is from the 10Ω reference—the resistance of the relay contacts may be big enough to throw off that measurement, though I would have expected measurements to be too big, if that were the source of the error.

(Update 2018 Oct 17: I heard today from Digilent that the resistors on the board are 0.1% resistors, so the larger fluctuations I’m seeing are likely to be from other sources, such as the contact resistance of the relays.)

Next Page »

%d bloggers like this: