Localized Environmental Sensing With TinyML
How tinyML provides cost-effective, portable, and localized monitoring of air quality.
In 2018, California experienced the worst wildfires in its history—1.9 million acres were destroyed by more than 8,500 fires across the state1. The loss of life, injury, and destruction to property were devastating.
And California’s air quality suffered as well, due to the harmful ash and smoke emanating from the fires.
Not surprisingly, Sacramento city officials issued a health warning during that period, to alert residents about the deteriorating conditions—there were layers of ash on cars and the air was filled with dangerous smoke.
But Google’s air quality index reported Sacramento conditions as being “good” and “ideal” at the time2.
Apparently, Google had made a mistake.
Google’s mistake was due to the data it received from a third-party provider that used a “black box” artificial intelligence (AI) algorithm to predict weather conditions—the algorithm was faulty.
And with the algorithm being black-box in nature, the fault wasn’t picked up.
This incident is a lesson in the value of using AI systems that can actually be understood, ie. explainable AI based on sound explainable principles, but it also highlighted the limitations of using centralized systems.
Localized monitoring has its benefits
While the California wildfires are an extreme example, there are many situations where localized, rather than centralized, environmental sensing (air quality monitoring) is preferred.
Consider this scenario: You’re a keen jogger and have a preferred route through a series of neighborhoods. The air quality readings available on your phone—sourced from a centralized database—report healthy conditions along the way.
But you’re not so sure—your route passes by industrial areas where factories emanate visible smoke.
Is the air quality along your jogging route safe to breathe?
Other situations when localized air quality monitoring may be beneficial are:
- If you wish to take a particular route when walking or cycling—similar to the jogging example—and are concerned about local environmental conditions along the route
- If your daily commute to work potentially exposes you to higher concentrations of pollutants—due to excessive time spent on busy, congested expressways, for instance—and you wish to monitor your daily exposure
- Ventilation systems, air conditioners and air purifiers that can benefit from local, on-site readings of air quality
- Distributed systems where dozens of readings from localized sources can contribute to more comprehensive and granular readings—a “heat map” of accurate air quality readings—across a whole city or region
Localized systems clearly have their benefits when monitoring air quality, but testing air quality is a complex task. It requires a certain amount of sensory technology, as well as analytics capable of producing reliable results.
This is why most cities use only a handful of monitoring stations where the required technology can be implemented and fed into a large, centralized system.
But there’s an emerging area of AI—tinyML—that specializes in smart systems that are small, easy to deploy, and cost-effective. This makes it well suited for localized deployment of systems capable of complex tasks, such as reading and assessing air quality.
TinyML systems are implemented on small semiconductor devices—microcontrollers—that have been in widespread use for many years, particularly with the growth in internet-of-things (IoT) applications.
By using tinyML, these microcontrollers are becoming “smart”.
And with its emphasis on simplicity, the AI algorithms that tinyML systems use are easy to understand. This makes them less prone to the risks of using complex, black-box AI systems like the type that led to Sacramento’s incorrect readings in 2018.
Localized, tinyML environmental sensing
German semiconductor manufacturer—Infineon—has taken to the challenge of implementing smart, localized environmental sensing systems for air quality monitoring. It has developed a tinyML solution that:
- Measures temperature, humidity, and concentrations of gas pollutants and particles (eg. ozone, carbon monoxide, and nitrogen dioxide)
- Performs analysis to assess gas concentrations or detrimental changes to AQI (air quality index) measurements
- Sends real-time alerts based on the results of the analysis
Infineon implements its solution in a small package—the ARM Cortex -M0+ microcontroller. This tiny device is equipped with sensory electronics for sampling gas particles and is capable of signal processing and data analysis.
The challenges of air quality monitoring at a micro-scale
The ARM microcontroller has only 4 kB of RAM and 32 kB of flash memory—it’s very lightweight—so it has a limited computational capacity and does not have an operating system. Off-the-shelf AI coding platforms, like Tensorflow Lite Micro, cannot be used as they’re too big.
So, Infineon has developed its own operating system and proprietary Python and C libraries to code the necessary AI model.
The overall process and system design is:
- Collect data, and design and train a suitable AI model using standard techniques (ie. with Python, Tensorflow, and PyTorch)
- Once trained, deploy the AI model to the ARM microcontroller (the deployed model will only be used for inference, ie. predicting values based on the trained parameters)
- The type of AI model that Infineon settled on is a neural network (after having tried other “classical” machine learning models like decision trees and random forests) due to its efficiency (low memory usage) and accuracy (performance)
- The type of neural network architecture adopted is a gated recurrent unit (GRU), due to its ability to exploit time properties while keeping a small memory footprint—the adopted GRU has a relatively simple structure with only 2 hidden layers
A tiny solution with big potential
Infineon’s solution allows for air quality monitoring in a portable, cost-effective device that can be incorporated into everyday items—smartphones or watches, for instance—and allow air quality monitoring at an immediate, local scale.
It can also be used in industrial or civic settings—as part of a city’s environment monitoring program, for instance—to enhance current approaches by providing more granular and comprehensive environmental sensing data.
This application demonstrates the potential of tinyML in using the power of AI on a distributed, localized, and granular scale.
And as the world becomes more concerned about environmental degradation, tinyML solutions such as this can help to monitor conditions in newer, more accessible ways that can benefit both individuals and society at large.
- Environmental sensing—such as air quality monitoring—is a complex task done mostly through centralized systems, but these are sometimes prone to error and don’t capture variations at a localized level
- TinyML is an emerging area of AI that offers solutions through using small, smart, low resource-intensive devices that can perform complex tasks—like reading and analyzing air quality—by leveraging the power of machine learning
- Infineon has developed a tinyML solution for air quality monitoring that’s portable, cost-effective, and can be deployed in a distributed, localized manner
- TinyML solutions, such as the one developed by Infineon, offer the potential for improvements in a variety of applications—like air quality monitoring—by harnessing the power of AI in a distributed, accessible and low-resource intensive manner
 M. McCough, How bad is Sacramento’s air, exactly? Google results appear at odds with reality, some say, The Sacramento Bee, August 7, 2018. https://www.sacbee.com/news/california/fires/article216227775.html