Gas station without pumps

2024 February 28

PteroDAQ needs new platform

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

Today I found out that the boards that I had been using for the data-acquisition system in my electronics course and textbook (the Teensy LC and the Teensy 3.2) have been discontinued, so I’ll need to port PteroDAQ to a new board. I’ve been thinking that I should port to the Seeed Studio XIAO SAMD21, which is a $5.40 board with Arduino IDE compatibility and similar speed to the Teensy LC (it is also an ARM Cortex M0+) with 11 pins that can be configured to be analog inputs. I’m also considering the Seeed Studio XIAO RP2040, which is the same price, with a much faster processor and more RAM, but only 4 analog inputs. I’ve not looked at the ADCs on these two chips, but I think that they are lower resolution than the Teensy LC. I’ve also not looked at what timer options are available for doing PteroDAQ frequency channels.

Sigh, the Teensy LC was such a good board for the course—it is sad to see it gone without a replacement that has as good an ADC at a reasonable price point.

I’m pretty busy with my Cabrillo classes (improv and theater design) and with my other acting stuff, so I probably won’t get a chance to work on PteroDAQ until this summer.

2023 July 6

Analog Discovery 2 price reduction

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 12:29
Tags: ,

Digilent has announced a price reduction on the Analog Discovery2 (back to pre-pandemic prices: $299 for anyone and $199 academic pricing).  The impetus for the price reduction is that they have brought out the Analog Discovery 3 ($379 and $249 academic), which has slightly better specs (25% higher sampling rate, 14% higher current power supply, double the buffer size).  The software and hardware interfaces are otherwise identical.

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.

Next Page »