LibIIO – Library for interfacing Linux industrial I/O devices

For more than 6 years, the LibIIO library has existed to ease the development of software interfacing Linux Industrial I/O (IIO) devices. It is part of the Linux Kernel and a subsystem that provides support for devices like analog to digital or digital to analog converters (ADCs, DACs). This subsystem includes ADCs, accelerometers, pressure sensors, color, light and proximity sensors, temperature sensors, RF transceivers, and many more.

You can use LibIIO natively on an embedded Linux target. It is cross-platform, supporting Linux, Windows, and Mac OS. Analog Devices Inc. was the main company behind LibIIO development, which is currently an active open-source library, which many people have contributed to.

What is LibIIO?

What does LibIIO do?

LibIIO will identify the channels that belong to each device. It will assign specific attributes, one for the channels and one for the devices. Then, it will also create a context that is a place where all the devices exist, and you can browse through the channels, devices, and attributes.

What does LibIIO do?

Library Structure

The library composed of a single cross-platform API and several backends:

  1. Local backend, which interfaces the Linux kernel through the sysfs virtual filesystem. This is when LibIIO runs locally on target.
  2. Network backend, which interfaces the iiod server through a network link.
  3. USB backend, which interfaces the iiod server through a USB link. 
  4. The XML backend, which parses the XML file.
  5. The serial backend, which interfaces tiny-iiod through a serial link. The serial backend can be used with tiny-iiod, which will run on an embedded system with a non-Linux framework.

The network, USB, and serial backend falls under the remote backend. The iiod and tiny-iiod are part of the LibIIO. This iiod server can run on a Linux host, this would then communicate to a LibIIO client over a network or USB. The server can also run on a deeply embedded, resource-constrained system (like Arduino) managed separately as tiny-iiod, this would typically communicate to a LibIIO client over a network or serial.

LibIIO IIO devices structure

The IIO Daemon (IIOD) server is an example of an application that uses LibIIO. This software stack shows a client-server relation. Let us assume that the client application runs on Windows, then calls the high-level API (of LibIIO), and through the network backend sends a command to the IIOD server. This then recognizes the command, and through LibIIO’s high-level API and local backend interacts with the IIO devices. The IIOD server shares the local backend through the network with the clients.

How to get started?

If you are already using Linux, your distribution already includes LibIIO, so you just need to reference the iio.h header in your source code. But for other platforms, you should check the release builds.

If you prefer, you can also access the source code from GitHub. Once you have secured your access to the library and its header, please check the LibIIO API or the LibIIO examples.

Source: All the images were taken from Analog Devices’ Software Development Engineer, Dan Nechita’s presentation slides from the Open Source Summit 2020 and the Wiki.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
1 Comment
oldest
newest
khancyr
khancyr
4 years ago

If you want to see some real products using Libiio and be able to hack them, look at Parrot Drones ! They are using Libiio and you are able to modify them !

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...