Data Acquisition with Dataq Instruments DI-194, DI-194RS and DI-154RSs
This project includes code to read the
DI-194 (older), DI-194RS (current) and DI-154RS (New, 12 bit)
serial DAQ devices. These are inexpensive data acquisition devices with a
serial interface. The software will work with most Unix variants, and is
tested under Debian Linux, and Redhat Linux, v7.3, 8.0, and 9.0
As of 2/3/04, I've added support for the DI-154RS. Please try the code and
let me know if you have any problems.
Here is the main code and hardware documentation This is is Doxygen-generated documentation from the source code; if you download the code you always have the docs. This is
a snapshot from 5/01/03.
Get the code
Snapshot from Feb 3, 2004) is at this link. Tested with the DI-194, DI-194RS and DI-154RS.
This has a bugfix in the buffer
decode logic that was limiting useful precision to 7 bits on both device types. Thanks to Christian Heon for the fix!
Current code is available from the CVS archive, package name dataq-194.
The environment variable 'DI194_PORT' determines where the code will look for
the device. If not set, the code defaults to /dev/ttyS1.
Now that the code supports the DI-154 as well, perhaps I should choose a
different environment variable, though.
Driver Development Background
In theory, this should have been a very simple program to write. After all,
Dataq documented the serial protocol used.
However, they did not document all of the protocol. And what they did
document is quite iffy. For example, the parameter to start/stop is a single byte, 0/1. However, you have to use an ASCII '0'/'1', not a binary one.
Worst of all, there's an undocumented command that their software uses to initialize the device, the killer 'B'.
Methods of Learning the Protocol
I finally used PortMon to monitor the comms between the device and the supplied WinDAQ Lite software.
Here are the raw traces:
Trace from an older DI-194
Trace from a DI-194RS
Note that you need to know which variant you have, as the data decodes differently due to the different precision of the units. The code does this for you.
- You can tell a 194, as it returns a serial number on request. If you get one, you have to send the 'enable key'.
- The RS returns 10 ASCII '0's for a serial number, and does not need an enable.
- The 154RS returns '0000000001', and does not require an enable key.
Notes, Limitations, Bugs
- The streaming works quite well - open the device, and read data from it. See the 'di_simplest.c' code. Single-value is still awkward, which would be nice for aperiodic or slow updates.
- In theory, the units can run faster by using fewer channels. I've not yet tried to program this.
- Note that these have no anti-alias filter! So the usual f/2 Nyquist limit does not apply unless you lowpass filter the source.
- Still have some code printing debugging messages that need to be removed
- If you have the GTKDataBox library and headers installed, 'make all' will also build a simple oscilloscope program.
- I've not worked with the digital I/O much, that portion of the code may be broken.
- Mac OSX is now working!
NEESgrid streaming program
Built on top of the DI-194 code, this streams data out into the NEESgrid via
the standard driver. Note that this introduces dependencies - you also need
to download the 'flog' messaging library, as well as the 'dataq-194' code. This one's package name is 'nees-di'.
If you want to see the streaming data, there are a few options. Simplest is the
'NSDS Simulate and Plot' Labview program, also available in the 'lv-programs' archive. For this, you have to
Alternately, you can run the real NSDS and view data via the Chef interface.
- Run nees-di
- Run the driver, pointing it to the LV machine with --nsds_machine
- Run NSDS Simulate and plot
Doxygen-generated source code docs
The CVS archive instructions
Dataq instruments home page
Dataq data format, local mirror
People Using This Code
I've been contacted by some interesting groups now using this code.
Send me mail to add yours.
- Solar Sudden Ionospheric Disturbance Monitor
- A physics teacher in Canada, in his high school lab class
- A researcher at Woods Hole Institute, measuring sensor currents
Back to main NEESgrid page
Back to home page
This work was supported primarily by the George E. Brown,
Jr. Network for Earthquake Engineering Simulation (NEES) Program of
the National Science Foundation under Award Number CMS-0117853.