Make Any Sensor a Smart Sensor with PICMG IoT.1, Part 3: How Do I Create Smart Sensor Firmware?
February 02, 2022
PICMG IoT.1-compliant smart sensors run on a configured data model. In Part 3, we take a look at the process of configuring the smart sensor firmware using a sample configuration tool provided by PICMG.
(Editor's Note: For a specific part of the series, click below:
Now that we have a more complete understanding of the PICMG IoT.1 data model and why it’s important, it’s time to start configuring the firmware. Usually this would require some amount of programming in languages like C, but PICMG has developed an open-source reference tool for users of the IoT.1 specification that abstracts this complexity and makes the process of developing compliant firmware as simple as filling out a few text boxes.
But first, why is configuring the firmware so important if we’re running it through a data model?
Whereas the data model is a template of what data is needed and how it is represented, the firmware is the implementation of the device that is represented by the data model. In other words, the firmware implements the behaviors of the sensor and contains all of the information about the sensor that the system needs to recognize it as a smart sensor.
Without properly configured firmware, the system has no way of telling that a sensor even connected in the first place and the sensor has no way of interacting properly with the system.
Automating Firmware Build & Configuration in PICMG IoT.1
While a developer could write IoT.1-compliant firmware in C that defines all the specific behaviors required by the data model, writing firmware for multiple sensors can be tedious for engineers and impossible for non-programmers to do at all.
To make this process simpler, PICMG developed a sample tool called “The Builder” that generates C-based firmware from user-provided JSON files and installs it onto the target logic device.
[Editor’s Note: The Builder is addressed in more detail in Part 4. It is not part of the PICMG IoT.1 specification. More information is available on Github, where the Builder can also be downloaded for free: https://github.com/PICMG/iot_builder.]
The Builder makes the task of writing firmware easier, as there is no longer a need to create C code. However, the user still has to provide a JSON file, which is much more straightforward than writing C code but can still be confusing and tedious. Enter the final piece of sample software provided by PICMG: “The Configurator”.
The Configurator tool enables simple firmware configuration within a graphical user interface, which makes it easy to manipulate data even for those without any programming experience. After the necessary data is input, the Configurator exports a JSON file the Builder can use to generate firmware.
[Editor’s Note: More information is available on Github, where the Configurator can also be downloaded for free: https://github.com/PICMG/iot_configurator.]
Configuration at Scale
Besides abstracting away the more tedious technical aspects of developing smart sensor firmware, the Configurator allows professional technologists to compile large libraries of configured sensors for mass deployment. This means that a factory that manufactures or uses sensors can easily transform large numbers of them into smart sensors automatically.
The Configurator makes this level of automation possible, for example, by recognizing and presenting the user with the different sensors that support a specific channel in a given sensor library. All the user has to do is choose a logical control system (such as PID or PIV) and select one of the supported sensors.
This process is all that’s needed to create a JSON file that defines our smart sensor. From here, a closer look at the Builder that will convert that JSON into system-readable C firmware is warranted.
Click here for Part 4: What is A Builder, and How Do I Get Started?