SENSIPLUS-LM: A Low-Cost EIS-Enabled Microchip Enhanced with an Open-Source Tiny Machine Learning Toolchain
Abstract
:1. Introduction
2. Related Works
- The SPC is unique among its kind due to being highly configurable and able to control internal and external sensors both through electrical impedance spectroscopy (EIS) and voltammetry;
- The SPC can be used to exploit any transducer that generates variations in electrical impedance;
- The C code produced by the toolchain is customized for deployment with SPC and can work on any Arduino-compatible MCU;
- The toolchain is open source and available for download on GitLab [30].
3. The SENSIPLUS MicroChip and the Toolchain Architecture
Listing 1: Extract of a C source. |
Listing 2: Extract of a makefile. |
3.1. Module for Code Generation
3.1.1. The “Sensor” Class
- OffChipORP: this class is the C code generator for the oxidation–reduction potential (ORP), which evaluates the tendency of the electrolyte to lose or acquire electrons when the solution changes by injecting a new substance;
- OffChipSpecificConductivity: this class is the C code generator for the conductivity measurement expressed in mode = text /, which is a measure of the ability of water to conduct electricity;
- OffChipPracticalSalinity: this class is the C code generator for the direct measurement of salinity, which is usually referred to as “practical salinity” and is typically derived from conductivity measurement (not measured directly).
3.1.2. The “Classifier” Class
3.1.3. The “CodeGenerator” Class
- A code that is independent of the classification problem at hand; this code initializes the SPC and appropriately manages the resources of the MCU;
- A code that implements the inferential engine of the classifier;
- A code with calls to sensor control C functions, integrated with code generated by the Sensor’s derived classes.
3.2. Module to Create “Builder”
- OS-dependent executables that allow compiling, linking, and debugging;
- Scripts for communicating with cards hosting a specific MCU, such as the components for loading the firmware in the persistent memory of the devices;
- Other executables that perform additional tasks but are not strictly necessary for compilation, including, for example, executables to partition the device memory and load data into it; the specific cases in which they were used are described below.
3.2.1. The Class “MakeConfigGenerator”
3.2.2. Classes for MCU Utility
3.2.3. Target Class
- The preExecution step: this step makes all the preliminary activity for the following steps;
- The targetBuildExecution step: this step generates the firmware;
- The postExecution step: this step loads the firmware on the MCU, completing all the toolchain operations.
4. Inference Performance Evaluation
4.1. Numerical Precision and Inference Time Analysis
4.2. Analysis of Inference Accuracy with a Real-Use Case
- The first 600 samples were acquired in warm-up mode; during this time, sensors were exposed to WW only;
- The next 1000 samples were acquired after analyte injection.
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
AI | Artificial Intelligence |
ML | Machine Learning |
API | Application Programming Interface |
ADC | Analog to Digital Converter |
AFE | Analog Front End |
ANN | Artificial Neural Network |
EIS | Electrical Impedance Spectroscopy |
I2C | Inter-Integrated Circuit |
IoT | Internet of Things |
MCU | Microcontroller Unit |
MLP | Multi-Layer Perceptron |
ORP | Oxidation–Reduction Potential |
RVFL | Random-Vector Functional Link |
SCW | Smart Cable Water |
SPC | SENSIPLUS Chip |
SPI | Serial Peripheral Interface |
TinyML | Tiny Machine Learning |
TDS | Total Dissolved Solids |
Appendix A. Graphical User Interface
Example of Usage
- In the first step, it is possible to select between three options: FullTestBuild to use all the toolchain components, “Update Firmware” to only upload the firmware, and “Update SPIFFS” to make only the upload of the configuration files (Figure A1a);
- In the second step, it is possible to select the target. By choosing the “generic_classifier” item, the generation of a complete ANN classifier is completed (Figure A1b);
- The “Preset NN” button generates the machine learning model taking a CSV file containing the necessary information as input;
- The last step consists of selecting the serial port on which the MCU is connected, allowing the whole process to start (Figure A1c).
References
- Datta, P.; Sharma, B. A survey on IoT architectures, protocols, security and smart city based applications. In Proceedings of the 2017 8th International Conference on Computing, Communication and Networking Technologies (ICCCNT), Delhi, India, 3–5 July 2017; pp. 1–5. [Google Scholar] [CrossRef]
- Cennamo, N.; Arcadio, F.; Perri, C.; Zeni, L.; Sequeira, F.; Bilro, L.; Nogueira, R.; D’Agostino, G.; Porto, G.; Biasiolo, A. Water monitoring in smart cities exploiting plastic optical fibers and molecularly imprinted polymers. The case of PFBS detection. In Proceedings of the 2019 IEEE International Symposium on Measurements & Networking (M&N), Catania, Italy, 8–10 July 2019; pp. 1–6. [Google Scholar] [CrossRef]
- Hancke, G.P.; Silva, B.D.C.e.; Hancke, G.P., Jr. The Role of Advanced Sensing in Smart Cities. Sensors 2013, 13, 393–425. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Carminati, M.; Sinha, G.R.; Mohdiwale, S.; Ullo, S.L. Miniaturized Pervasive Sensors for Indoor Health Monitoring in Smart Cities. Smart Cities 2021, 4, 146–155. [Google Scholar] [CrossRef]
- Yu, W.; Liang, F.; He, X.; Hatcher, W.G.; Lu, C.; Lin, J.; Yang, X. A Survey on the Edge Computing for the Internet of Things. IEEE Access 2018, 6, 6900–6919. [Google Scholar] [CrossRef]
- Zhou, Z.; Chen, X.; Li, E.; Zeng, L.; Luo, K.; Zhang, J. Edge Intelligence: Paving the Last Mile of Artificial Intelligence With Edge Computing. Proc. IEEE 2019, 107, 1738–1762. [Google Scholar] [CrossRef] [Green Version]
- Kaur, K.; Garg, S.; Aujla, G.S.; Kumar, N.; Rodrigues, J.J.P.C.; Guizani, M. Edge Computing in the Industrial Internet of Things Environment: Software-Defined-Networks-Based Edge-Cloud Interplay. IEEE Commun. Mag. 2018, 56, 44–51. [Google Scholar] [CrossRef]
- Molinara, M.; Ferdinandi, M.; Cerro, G.; Ferrigno, L.; Massera, E. An End to End Indoor Air Monitoring System Based on Machine Learning and SENSIPLUS Platform. IEEE Access 2020, 8, 72204–72215. [Google Scholar] [CrossRef]
- Betta, G.; Cerro, G.; Ferdinandi, M.; Ferrigno, L.; Molinara, M. Contaminants detection and classification through a customized IoT-based platform: A case study. IEEE Instrum. Meas. Mag. 2019, 22, 35–44. [Google Scholar] [CrossRef]
- Gerevini, L.; Cerro, G.; Bria, A.; Marrocco, C.; Ferrigno, L.; Vitelli, M.; Ria, A.; Molinara, M. An end-to-end real-time pollutants spilling recognition in wastewater based on the IoT-ready SENSIPLUS platform. J. King Saud Univ.-Comput. Inf. Sci. 2023, 35, 505–519. [Google Scholar] [CrossRef]
- Deng, S.; Zhao, H.; Fang, W.; Yin, J.; Dustdar, S.; Zomaya, A.Y. Edge Intelligence: The Confluence of Edge Computing and Artificial Intelligence. IEEE Internet Things J. 2020, 7, 7457–7469. [Google Scholar] [CrossRef] [Green Version]
- Ray, P.P. A review on TinyML: State-of-the-art and prospects. J. King Saud Univ.-Comput. Inf. Sci. 2022, 34, 1595–1623. [Google Scholar] [CrossRef]
- Dutta, D.L.; Bharali, S. TinyML Meets IoT: A Comprehensive Survey. Internet Things 2021, 16, 100461. [Google Scholar] [CrossRef]
- Saha, S.S.; Sandha, S.S.; Srivastava, M. Machine Learning for Microcontroller-Class Hardware: A Review. IEEE Sens. J. 2022, 22, 21362–21390. [Google Scholar] [CrossRef] [PubMed]
- TensorFlow Lite for Microcontrollers—Tensorflow.org. Available online: https://www.tensorflow.org/lite/microcontrollers (accessed on 15 September 2022).
- Soro, S. TinyML for Ubiquitous Edge AI. arXiv 2021, arXiv:2102.01255. [Google Scholar]
- Karimipour, H.; Derakhshan, F. (Eds.) Artificial Intelligence for Threat Detection and Analysis in Industrial IoT: Applications and Challenges. In AI-Enabled Threat Detection and Security Analysis for Industrial IoT; Springer International Publishing: Cham, Switzerland, 2021; pp. 1–6. [Google Scholar] [CrossRef]
- Bilal, M.; Usmani, R.S.A.; Tayyab, M.; Mahmoud, A.A.; Abdalla, R.M.; Marjani, M.; Pillai, T.R.; Targio Hashem, I.A. Smart Cities Data: Framework, Applications, and Challenges. In Handbook of Smart Cities; Augusto, J.C., Ed.; Springer International Publishing: Cham, Switzerland, 2020; pp. 1–29. [Google Scholar] [CrossRef]
- uTensor. Available online: http://utensor.ai (accessed on 15 September 2022).
- NanoEdge AI Studio. Available online: https://cartesiam-neai-docs.readthedocs-hosted.com/ (accessed on 15 September 2022).
- Edge Impulse. Available online: https://www.edgeimpulse.com/ (accessed on 15 September 2022).
- STM32Cube.AI. Available online: https://www.st.com/content/st_com/en/ecosystems/stm32-ann.html (accessed on 15 September 2022).
- Wang, X.; Magno, M.; Cavigelli, L.; Benini, L. FANN-on-MCU: An Open-Source Toolkit for Energy-Efficient Neural Network Inference at the Edge of the Internet of Things. IEEE Internet Things J. 2020, 7, 4403–4417. [Google Scholar] [CrossRef]
- Sliwa, B.; Piatkowski, N.; Wietfeld, C. LIMITS: Lightweight Machine Learning for IoT Systems with Resource Limitations. In Proceedings of the ICC 2020-2020 IEEE International Conference on Communications (ICC), Online, 7–11 June 2020; pp. 1–7. [Google Scholar] [CrossRef]
- SPC5-STUDIO-STMicroelectronics—st.com. Available online: https://www.st.com/en/development-tools/spc5-studio.html (accessed on 15 September 2022).
- BME688 Software—Bosch-Sensortec.com. Available online: https://www.bosch-sensortec.com/software-tools/software/bme688-software (accessed on 15 September 2022).
- Bria, A.; Cerro, G.; Ferdinandi, M.; Marrocco, C.; Molinara, M. An IoT-ready solution for automated recognition of water contaminants. Pattern Recognit. Lett. 2020, 135, 188–195. [Google Scholar] [CrossRef]
- Ferdinandi, M.; Molinara, M.; Cerro, G.; Ferrigno, L.; Marrocco, C.; Bria, A.; Di Meo, P.; Bourelly, C.; Simmarano, R. A Novel Smart System for Contaminants Detection and Recognition in Water. In Proceedings of the 2019 IEEE International Conference on Smart Computing (SMARTCOMP), Washington, DC, USA, 12–15 June 2019; pp. 186–191. [Google Scholar] [CrossRef]
- Cerro, G.; Ferdinandi, M.; Ferrigno, L.; Molinara, M. Preliminary realization of a monitoring system of activated carbon filter RLI based on the SENSIPLUS® microsensor platform. In Proceedings of the 2017 IEEE International Workshop on Measurement and Networking (M&N), Naples, Italy, 27–29 September 2017; pp. 1–5. [Google Scholar] [CrossRef]
- SENSIPLUSToolchain · GitLab—gitlab.com. Available online: https://gitlab.com/t8664 (accessed on 15 September 2022).
- Ria, A.; Cicalini, M.; Manfredini, G.; Catania, A.; Piotto, M.; Bruschi, P. The SENSIPLUS: A Single-Chip Fully Programmable Sensor Interface. In Proceedings of the International Conference on Applications in Electronics Pervading Industry, Environment and Society, Genova, Italy, 26-27 September 2022; Saponara, S., De Gloria, A., Eds.; Springer International Publishing: Cham, Switzerland, 2022; pp. 256–261. [Google Scholar]
- Frank, E.; Hall, M.A.; Holmes, G.; Kirkby, R.; Pfahringer, B.; Witten, I.H. Weka: A machine learning workbench for data mining. In Data Mining and Knowledge Discovery Handbook: A Complete Guide for Practitioners and Researchers; Maimon, O., Rokach, L., Eds.; Springer: Berlin/Heidelberg, Germany, 2005; pp. 1305–1314. [Google Scholar]
- Hastie, T.; Tibshirani, R.; Friedman, J. The Elements of Statistical Learning: Data Mining, Inference and Prediction, 2nd ed.; Springer: Berlin/Heidelberg, Germany, 2009. [Google Scholar]
- Rosato, A.; Altilio, R.; Panella, M. On-line Learning of RVFL Neural Networks on Finite Precision Hardware. In Proceedings of the 2018 IEEE International Symposium on Circuits and Systems (ISCAS), Florence, Italy, 27–30 May 2018; pp. 1–5. [Google Scholar] [CrossRef]
- Quinlan, J.R. C4.5: Programs for Machine Learning; Elsevier: Amsterdam, The Netherlands, 2014. [Google Scholar]
- Sudharsan, B.; Salerno, S.; Nguyen, D.D.; Yahya, M.; Wahid, A.; Yadav, P.; Breslin, J.G.; Ali, M.I. TinyML Benchmark: Executing Fully Connected Neural Networks on Commodity Microcontrollers. In Proceedings of the 2021 IEEE 7th World Forum on Internet of Things (WF-IoT), New Orleans, LA, USA, 14 June–31 July 2021; pp. 883–884. [Google Scholar] [CrossRef]
- D32 Pro; WEMOS Documentation—docs.wemos.cc. Available online: https://docs.wemos.cc/en/latest/d32/d32_pro.html (accessed on 15 September 2022).
- Public Link for Downloading the Acquired Dataset. 2022. Available online: https://aida.unicas.it/data/JKSU_2022.zip (accessed on 11 November 2022).
# of Neurons | # of Neurons | # of Neurons |
---|---|---|
Input Layer | Single Hidden Layer | Output Layer |
3 | 16 | 6 |
3 | 32 | 6 |
3 | 64 | 6 |
8 | 16 | 6 |
8 | 32 | 6 |
8 | 64 | 6 |
IDE | Frequency of Acquisition | Physical Values | |
---|---|---|---|
1 | PLATINUM | 78 | RESISTANCE |
2 | GOLD | 78 | RESISTANCE |
3 | PLATINUM | 200 | RESISTANCE |
4 | PLATINUM | 200 | CAPACITANCE |
5 | GOLD | 200 | RESISTANCE |
6 | GOLD | 200 | CAPACITANCE |
7 | SILVER | 200 | RESISTANCE |
8 | SILVER | 200 | CAPACITANCE |
9 | f NICKEL | 200 | RESISTANCE |
10 | NICKEL | 200 | CAPACITANCE |
Substances | Brief Description | Analyte Composition | Concentration in 100 mL | |
---|---|---|---|---|
1 | ACETONE | 10 mL | 71,727.27 mg/L | |
2 | INT_NELSEN | Off-The-Shelf product | 9.2 mL + 0.8 mL Dish Detergent | 7476.36 mg/L |
3 | SODIUM_CHLORIDE | 9.98 mL + 0.02 g Sodium Chloride | 181.81 mg/L | |
4 | WM_DETERGENT | Off-The-Shelf product | 9.2 mL + 0.8 mL Washing Machine Detergent | 7476.36 mg/L |
5 | SULPHURICACID | 9.9 mL + 0.1 mL Sulphuric Acid | 1798.20 mg/L | |
6 | AMMONIA | 9.7 mL + 0.3 mL Ammonia 30/33% | 2454.54 mg/L | |
7 | WASTEWATER | Real domestic sewage , conductivity = 1.341 mS | ||
8 | ETHANOL | 10 mL | 71,727.27 mg/L | |
9 | HYDROGENPEROXIDE | 8 mL 35% | 83,703.70 mg/L | |
10 | PHOSPHORICACID | 9.8 mL + 0.2 mL Phosphoric Acid 75% | 2327.27 mg/L | |
11 | ACETICACID | 9.5 mL + 0.5 mL Acetic Acid 80% | 4772.72 mg/L | |
12 | DW_DETERGENT | Off-The-Shelf product | 9.2 mL + 0.8 mL Dishwasher Detergent | 7476.36 mg/L |
13 | FORMICACID | 9.8 ml + 0.2 mL Formic Acid 85% | 2181.81 mg/L |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Vitelli, M.; Cerro, G.; Gerevini, L.; Miele, G.; Ria, A.; Molinara, M. SENSIPLUS-LM: A Low-Cost EIS-Enabled Microchip Enhanced with an Open-Source Tiny Machine Learning Toolchain. Computers 2023, 12, 23. https://doi.org/10.3390/computers12020023
Vitelli M, Cerro G, Gerevini L, Miele G, Ria A, Molinara M. SENSIPLUS-LM: A Low-Cost EIS-Enabled Microchip Enhanced with an Open-Source Tiny Machine Learning Toolchain. Computers. 2023; 12(2):23. https://doi.org/10.3390/computers12020023
Chicago/Turabian StyleVitelli, Michele, Gianni Cerro, Luca Gerevini, Gianfranco Miele, Andrea Ria, and Mario Molinara. 2023. "SENSIPLUS-LM: A Low-Cost EIS-Enabled Microchip Enhanced with an Open-Source Tiny Machine Learning Toolchain" Computers 12, no. 2: 23. https://doi.org/10.3390/computers12020023
APA StyleVitelli, M., Cerro, G., Gerevini, L., Miele, G., Ria, A., & Molinara, M. (2023). SENSIPLUS-LM: A Low-Cost EIS-Enabled Microchip Enhanced with an Open-Source Tiny Machine Learning Toolchain. Computers, 12(2), 23. https://doi.org/10.3390/computers12020023