Data AQ project software release, latest

Software related topics

Data AQ project software release, latest

Postby Doug Coulter » Sat Aug 18, 2012 5:10 pm

This doesn't really fit in any of the subcategories here, since it's a dump of both uP embedded and PC code for (I hope) more than one opsys.
This is the current release of the open source (GPL-V2) standard data acquisition project here. I will add replies to this thread with a new zip of the suite anytime anything significant changes.
You may use this any way you want, but it is GPL-V2 so those standards apply, and if you improve something, I'd hope you'd send me a copy or post it up here so everyone can benefit.

The hardware is basically that of the standard counter (and this code would work if burned into that hardware and you hooked up the extra wires - because that's exactly what I did for the hardware product), so that's your open source hardware design, already up here someplace. It's the same as the CCS USB dev board with input protection and pullups on the counter inputs, and RS low pass filters on the a/d inputs, at any rate.

Additions are that we use more of the I/O pins of the PIC 18f4550 for this to get more inputs. We use two counter inputs, and the first 8 a/d inputs. The last input (ad7) is supposed to be connected to a reference voltage we can use for software calibration of the fullscale a/d range, since that's determined by the 5v output on your USB jack and it DOES vary from machine to machine, and within the same machine when other loads change, not to mention what cable resistance and contact resistance exists.

The a/d outputs are 16 bit numbers, but don't add up quite to 65535. This is because we really only have a 10 bit a/d, and if you work out 1023*64, you only get 65472 for a full scale value. This would also be true if you added 2048 samples and then right shifted to get the result fitting into a 16 bit number, which is what we actually do.

As it turns out, this gives us much better than 10 bit accuracy and resolution. System noise acts as a dithering signal for inputs that are "right on the edge" of an a/d transition, so we really do get a better number.
Further, the pic a/d thresholds are actually much more accurate than 10 bits anyway. The technique is similar to that used in a sigma-delta converter to get 16 or more bits of goodness out of a 1 or 4 bit actual a/d converter by oversampling and filtering the resulting output. In this case, we take 2048 samples in each second-frame, add them all up, then divide by 32 to get the result to fit into 16 bits.

On most of my machines, this results in 12 or 13 bit accuracy even without doing a calibration against the reference diode on ad7. If you do that, and the plotdat software has this feature if you use it, it gets better yet, since all the power supply variations (which determine the actual a/d full scale voltage too) are calibrated out. Kind of a neat trick, and it actually does work. This is most valuable for logged input signals, like from a PKR-251 pressure gage, where exponentiating it to get millibars makes a tiny error into a huge one - that thing covers 9 decades!

Expect to see the availability of this hardware soon on the DJ's forum. We're just figuring out how to package it up now. If you can't wait and want to build your own - this is what you need to do that.
You could, in theory, go to CCS and buy their compiler, and their USB dev board and just use that - adding your own input protection and pullups for the counter inputs, and RC filters (we'll be using 47k/2.7uf) for the a/d inputs. The first version of this in fact did that. It ain't purty (you might have to unwire a led or two that's on a signal pin we want), but it does work.

I included some of the dependencies for this - it needs a few extra perl modules for all opsys, some things special are needed for windows as well. I couldn't fit a perl distribution on here, linux people won't want it, and already have one, and windows people can go to activestate (link in the readme file) and get it free. My sense is that you're going to have to be a fairly advanced power user to make this run in windows, other people have done so, but didn't write down all the steps for me, sadly. You'll need to install the GTK runtime (included here), perl, and those perl modules, so be sure if you get activestate perl to get their module manager/getter/installer too, so you get everything that works together right.

This includes the plotdat software as well, the stuff I used to make those pretty plots I show under fusor runs here and posted on youtube and fusor.net. Have fun!

Don't even try to read the perl without something that does syntax highlighting for perl, you'll go blind - lab rats get eating disorders when they do that. I use gedit on linux, there are geany and padre as well that seem to work fine for this.

Just in case someone really does want a windows version - all this code should (and has) work in windows, but you can't read the readme file, since windows needs \r\n at the end of every line, while
linux just uses \n (and so does the hardware). I included a linux version of lin2win to convert files that only have \n to \r\n, and converted the readme file and put it in the windows directory of this zip for you.
The lin2win probably won't work in windows due to perl's line terminator magic adjusting (in this one case, the wrong way) to the opsys it runs under, see the notes in that perl script. However, there's a workaround for simple logging - just use any windows terminal program, and set it to convert \n to \r\n (auto line terminator) and then use it to save your log file. For all I know, sdaq will work right in windows, but I'm not completely sure, it's not been tested in its latest incarnation.

SdaqSuite.zip
Zip of all the sdaq software, and some dependencies
(1.48 MiB) Downloaded 256 times
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 2964
Joined: Wed Jul 14, 2010 8:05 pm
Location: Floyd county, VA, USA

Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest