Integration of Sensors in a highly flexible Embedded Linux system is a common use-case. The Industrial I/O (IIO) subsystem of the Linux Kernel is intended for interacting with devices which provides an analog-to-digital conversion (ADC) and/or digital-to-analog conversion (DAC). Typical IIO devices are sensors like e.g. accelerometer or pressure sensors. They are generally connected via I2C or SPI.
The use of sensors of all types increased in a wide variety of devices.
The IIO subsystem is meant to fill the gap between hardware monitoring and input devices. Hardware monitoring devices are most often for lower sampling rates and input devices are focused on human interaction.
In embedded systems, sensor requires often higher sample rates and are of different types. The IIO Subsystem provides a unified framework for integration of ADC or DAC devices and enables to create an industrial grade Linux system.
To be able to access hardware properly, a driver (Kernel Module) is needed over which the Linux Kernel can access the hardware in a proper way. For the implementation to the IIO subsystem, Linux drivers using the IIO framework are necessary. Also a userspace interface is provided to access the data. This implementation is represented with a demonstration application using IIO devices. A Printed Circuit Board (PCB) holding a gyroscope, an accelerometer and a CAN-Bus gateway was developed.
The sensors are used to dynamically measure the 3D orientation of the PCB. The CAN-Bus gateway is used to drive brushless DC motors through additional hardware located on the extension board. In addition, the documentation includes a step-by-step implementation guide that enables someone to get started quick.
In development of Embedded Linux systems cross compilation, compilation of Linux Kernel and Bootloaders as well as root filesystem generation are a common requirement. For this purpose the Buildroot tool has been used to develop a Linux system for the Raspberry Pi 3 B+ in combination with a typical development setup for embedded systems.
The used setup offers high flexibility during development. Furthermore, it provides booting the Linux Kernel as well as mounting the root filesystem over a network connection. This enables a versatile development procedure. Last but not least , the IIO driver as well as the user interface are implemented with C programming language.