Gas station without pumps

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.

Advertisements

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.

2017 December 18

EKG without amplifier

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 18:24
Tags: , , , ,

I have done a lot of EKG projects on this blog, mostly for the Applied Electronics course, where an EKG amplifier is Lab 12, but some just for fun. Today I decided to see whether one could do an EKG with just the Teensy LC board or just an Analog Discovery 2 USB oscilloscope.

The project was partly inspired by the Digilent post DIY ECG using a Analog Discovery 2 and LabVIEW, which I saw the title for and assumed that they were using just the USB oscilloscope.  It turns out that wasn’t what they meant—it is just a simple 6-op-amp EKG amplifier looked at with the USB oscilloscope.

The setup I tried was about as simple as you can get—I put on three electrodes wired up as Lead I (see earlier post for this configuration), connected the body electrode to ground, and the other two electrodes to the plus and minus leads of channel 1 of the Analog Discovery 2.

The signal I got was quite small (about 1mV) and buried in 60Hz noise:

The raw signal from the oscilloscope, sampling at 1200 Hz, shows some spiking from the pulse, but a lot of noise. The big R spike is only about 3 LSB, so quantization noise is a problem.

I ran the recording through a digital filter to bandpass filter it to 0.1Hz–100Hz and put in a notch from 58Hz to 62Hz. The 100Hz low-pass had the effect of averaging out the noise, producing a signal with much finer resolution than the raw ADC values:

After filtering, the EKG signal is fairly clear. I don’t recommend trying to use only a couple of the lower-order bits of an ADC, but it is surprising how much information can be recovered by the filter.

I also tried using a Teensy LC board running PteroDAQ, using the A10–A11 differential channel. I had to bias my body between 0V and 3.3V, so I used a pair of 120kΩ resistors (one to GND, one to 3.3V) to connect to the body electrode.

Once again the raw signal was not great:

The signal had less noise than the signal to the Analog Discovery 2, but the signal was smaller also, negating the value of the finer steps of the ADC on the Teensy LC.

Once again, digital filtering restored the signal:

The signal-to-noise ratio here looks a little worse than for the Analog Discovery 2, despite the raw signal looking cleaner.

I managed to get a cleaner signal for the Analog Discovery 2 by turning off the surge protector, so that there was no 60Hz current anywhere nearby. The results after filtering were no better (and possibly worse) than from the signal with the 60Hz interference, so I did not bother plotting them for this post.

My conclusion is that it is possible to get EKG signals without adding an amplifier, but you can only see the signal clearly if you do some filtering.  I’ll have to decide whether to recommend to students that they record signals directly from the EKG electrodes to get an idea what their amplifiers have to work with.

2017 December 17

Book released for Winter 2018 course

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

I’ve released a new version of the textbook Applied Electronics for Bioengineers, on the LeanPub website: https://leanpub.com/applied_electronics_for_bioengineers and sent the students registered for the course a coupon to get their free copy.  People who have previously bought the book (even if for $0 with a coupon) were also informed of the release, so that they could pick up a new copy.

This version is 481 pages including 38 chapters, preface, appendices, and index.  There are 10 tables and 199 figures (239 distinct images, since some figures have multiple subfigures).  I added a lot of new tutorial material, fixed some errors (including some serious ones), added more exercises, and modified the labs to use the Analog Discovery 2 USB oscilloscopes rather than the expensive bench equipment we used to use.  The book is not “done”—I still have over 50 to-do notes in the margins, but I believe it is significantly improved over last year.  Improvements would be faster if students would tell me when they find errors or confusing writing, but they rarely do, and I have to guess what needs fixing from mistakes they make weeks later.

The use of the Analog Discovery 2 enabled me to offer a larger course this year—I managed to equip a 25-station lab for 50 students for under $10,000—less than the cost of a single station in the old lab. Because the space I’m using for the two 50-student sections is used as a classroom by other courses, I need to wheel everything in on a cart 20 minutes before labs start and clean it up and pack it away after the labs.

I still have a little work to do before next quarter starts:

  • recording the serial numbers and setting the names of the 25 Analog Discovery 2 units.
  • checking the 25 soldering stations and tinning the tips.
  • soldering 25 pressure sensors onto breakout boards.
  • packing everything into tubs that I can wheel to the other building on the cart.
  • cleaning up the electrode holders that did not get cut cleanly by the laser cutter.
  • getting reimbursed for over $3000 worth of parts and tools that I ordered for the students (UCSC can’t buy from AliExpress, and US vendors were over 3 times the price).

But I think that tomorrow I’ll take a break—maybe even see if I can get anything working on the robot I didn’t finish for the mechatronics course.

2017 November 16

Another day fighting SolidWorks

Filed under: Robotics — gasstationwithoutpumps @ 22:14
Tags: , ,

I spent another day working on the SolidWorks model for my robot.  I’m getting better at it, but the user interface is still a struggle to deal with.  Here is my model so far:

I’ve got the first layer mostly done, but the second layer is barely started.

On the first layer, I still have to put in small starter holes for screwing down the optical reflection sensors, which I plan to mount on pieces of perfboard. Having the sensors on perfboard will make wiring them easier (I hope), and make them easier to replace if one fails. Also, recessing them into the perfboard should improve their directionality.

I’m planning to clamp the layers of the robot together with ¼” threaded rod—the acorn nuts I’ve put on the ends are just decorative, and there isn’t room underneath for an acorn nut.  My clearance to the ground is just 8mm, which is less that the ⅜” minimum height for an acorn nut.  There is room for one 7/32″-high hex nut or two 5/32″-high thin hex nuts, but that’s it.

[Update 17 Nov 2017: I’m now going to use 8-32 threaded rod, not ¼”, so there will be room on the bottom for the acorn nuts. See Hardware obtained today.]

The view here is mostly from the back, showing the power panel (with a voltmeter/ammeter and a hole for a barrel jack) behind the LiFe battery.  I should remodel the battery to curve the wires up to the jack and to tuck the charging wires back along the battery.

I have to decide on how the AT-M6 ball launcher interacts with the rest of the components—if I use an accelerator wheel  underneath (which I was planning), then there needs to be clearance for the wheel between the first and second layers.  But the tops of the drive wheels look like they’ll interfere with such an accelerator wheel.  I could mount the accelerator wheel in front of the drive wheels, but then I’ll have the track-wire sensor further from the edge—will it be sensitive enough? I guess I’ll to make the sensor and test it. I should also prototype the accelerator-wheel design, to make sure that it will throw ping-pong balls.  I still have a few inches of uncollapsed 1-½” PVC pipe that I could use for making (or at least prototyping a launcher.

The track wires will be running a current of 180mA—the design used in the targets is a 12V power-supply with a 1.2V drop from using a darlington transistor (why not an nFET?), and two 120Ω 1W current-limiting resistors in parallel.  The typical VCE for the TIP122 darlington at 180mA is more like 0.75V, so the current is going to be more like 188mA.

To imitate that with my track-wire that has 2 47-ohm resistors in parallel, I’d need a voltage of 4.4V.  The power dissipation would be (4.4V)^2/(23.5Ω) (0.5) = 412mW, which is just below the ½W limit from using two ¼W resistors. Rather than wire up a special circuit (using an LM555, as they did), I’ll just use the Analog Discovery 2 power supply for the 4.4V and the function generator for the pulse train to the gate of an nFET.  It’ll be a little inconvenient, since the function generator, power supply, and oscilloscope leads are so short, but I can make it work with some “extension cables”.

I think that tomorrow I’ll work on sensors, both electronics and programming, and leave the mechanical design for later—I think I’ll make more progress on the more familiar tasks, and I’m so far behind most of the groups that I’m not sure I’ll ever catch up.  I don’t even have a name for my robot!

 

Next Page »

Blog at WordPress.com.

%d bloggers like this: