The Linux interface for data acquisition is the Control and Measurement Device Interface (comedi). It is a combination of device drivers for data acquisition hardware, and a developer interface to these drivers called comedilib. Comedi also provides calibration and configuration utilities.
The comedi interface offers a few advantages that are worth mentioning:
- No Vendor Lock In
- Uniform API to interface with multiple hardware providers
- Linux data analysis tools such as the R Project for Statistical Computing
- Higher level language bindings such as Python
- Wide variety of libraries and tools to cloud connect your data.
Vendor lock-in is something you find everywhere in technology, and data acquisition is no exception. And while many of these hardware / software packages are offer some nice tools and support, a quick spot check of a popular controller for a rack IO system lists for $7500 that is based on an Intel E3845 processor that lists for $52. Therefore, the cost disparity between a proprietary system and an open computing platform is very significant. The Linux comedi approach is very different, offering the ability to mix and match hardware based on features, pricing and availability, but it does require more knowledge and effort than a propriety closed system.
Probably the biggest benefit of using the Linux and Comedi approach to data acquisition is the wide range of data analysis, plotting, and communications tools available. For data analysis, you’d be hard pressed to find a better package than the R Project for Statistical Computing. You can interface directly to your comedi devices, or use any one of the language binding such as Python to interface between R and comedi.
Scaling Your Data Acquisition System
A benefit of a traditional PC style Linux comedi measurement system is the flexibility in scaling your system. In this context, scaling means not only the IO, but the CPU, memory and other traditional computer IO such as USB ports, Ethernet, Serial, and Video capabilities. In its simplest form, a test and measurement system might look like the following.
For a more modest system, many prefer the expansion chassis approach if they use some of the more traditional ISA, PCI, or PCIe cards. A single PCIe[x1] link to an expansion chassis can allow up 13 ISA, PCI, or PCIe cards in the chassis.
And for the larger system, expanding the PCI express bus out to individual IO racks that support up to 32 modules per rack, you can expand up to thousands of individual channels all connected back to the same Linux system over PCI Express.
An important thing to remember for these large systems is that processing limitations are virtually non-existent. With the correct chassis and motherboard selection, the IO channels can all be brought back into a dual-socket Xeon workstation with up to 2 TB of memory with on board or network-attached storage for data.
Comedi device drivers and support
In terms of comedi support, CONTEC is one such provider of data acquisition and control electronics since 1975. The company is committed to providing open-source Linux comedi drivers for its products. All drivers are GPL licensed and submitted to the Linux-next tree for inclusion in the next Linux kernel merge.
CONTEC also helps maintain precompiled binaries for many popular distributions for comedi and comedilib and they are included in the traditional package repositories. It does regression testing on each driver release and kernel update to insure API compatibility. And maintaining the packages along with the rest of the Linux distribution, allows users to focus on their application development, and eliminates the task of maintaining kernel modules and making sure they load and configure correctly.
Overview Of Comedi Devices
Comedi organizes devices following the hierarchy of:
- Channel: the lowest level hardware component, for example, a single analog input or digital output.
- Subdevice: a set of functionally identical channels, for example, a set of 16 identical analog inputs.
- Device: A set of subdevices on the same physical device – the interface cards itself. Many interface cards or modules have multiple subdevices like a combination analog IO / Digital IO card.
Data Acquisition Signal Types
Comedi supports the following signal types:
- Digital: Typically the simplest type, digital I/O typically does not require configuration, simply knowing the address of the channel, and the input or output direction is sufficient.
- Analog: Slightly more complex, typically the channel can generate or read a voltage or current between and upper and lower limit. Cards may also allow the automatic sampling or a set of channel.
- Pulse based signals: These signals tend to be slightly more complex as they require timing specifications.
The Linux Control and Measurement Device Interface provides a consistent, vendor neutral API for accessing data acquisition and control products. Maintained with the Linux kernel, it allows tremendous flexibility in hardware selection, and provides the ability to seamlessly integrate data acquisition with world-class analysis tools, security and cloud connectivity. With hardware vendor support from suppliers readily available, it’s worth considering this approach for future measurement systems.
About the author
Dan Naughton is the Director of Field Systems Engineering at DTx Inc., a division of CONTEC, which provides embedded computers and data acquisition products for a variety of applications in the medical and industrial markets. You can reach the author at firstname.lastname@example.org