Smart Refrigerator Internal Food Spoilage Electronic Nose System Using Gas Sensor Multi Packs
IoT based Smart Fridge system for food spoilage detection and real-time monitoring using Arduino.
Food wastage occurs due to lack of real-time monitoring of stored food items. Traditional refrigerators cannot detect spoilage gases, temperature variation, or door mismanagement, leading to health risks and financial loss.
The Smart Fridge is an IoT-enabled hardware system that monitors food quality using sensors and automated logic.
✔ Real-time gas detection ✔ Temperature & humidity monitoring ✔ Automatic door-open alert ✔ Food spoilage classification ✔ LCD live display ✔ Low-cost IoT prototype
code/ – Arduino source code circuit-diagram/ – Circuit schematic images/ – Prototype photos, block diagram, flowchart documentation/ – Project report & PPT bom/ – Bill of materials
IoT based Smart Fridge for food spoilage detection and real-time monitoring using Arduino.
This repository contains the code and circuit diagram for an IoT-based food spoilage detection system. The system leverages temperature, moisture, and MQ-135 gas sensors to monitor food freshness and detect spoilage. It aims to aid in reducing food waste by providing early warnings when food quality deteriorates.
Food spoilage detection systems are essential for food storage and preservation, especially in scenarios like food donation systems or warehouses. This project uses IoT sensors to monitor critical factors like temperature, moisture, and gas levels around food items to detect spoilage. Based on sensor readings, the system categorizes food as "safe" or "spoiled" and displays the results on a web interface.
An IoT-based system using temperature, moisture, and gas sensors to detect and alert for food spoilage in real-time, helping to prevent food waste.
Building an Electronic Nose with MEMS Gas Detection Sensor Breakout Series and Edge Impulse Platform
The electronic nose is an instrument that mimics the human olfactory system and is capable of detecting and identifying odors. Composed of multiple gas sensors and trained through tinyML, the electronic nose can recognize the unique characteristics of different scents. In this project, I developed an electronic nose using DFRobot mems series gas sensors and the Edge Impulse platform, which is capable of identifying the scents of beverages and fruits. Throughout the development process, I conducted experiments on the prediction of fruit decay maintenance. After completing the experiments on identifying the scents of beverages and fruits, I also conducted a series of exploratory experiments to test the electronic nose's ability to recognize other odors, in order to understand the limits of its capabilities. Through this project, we have confirmed that an electronic nose using DFRobot mems series gas sensors can distinguish between beverages and fruits, and has a certain degree of preventive ability against fruit decay. Furthermore, we have discovered that under certain conditions, the electronic nose can recognize multiple scents. We hope that this project will explore the potential of electronic nose technology and lay the foundation for the development of more widely applicable odor recognition applications in the future.
In order to achieve the functionality of the electronic nose, I considered both the hardware and software aspects during the design process. After conducting a series of research, the design scheme and content are as follows:
The sensor of the electronic nose is an important component of the whole project. The DFRobot Fermion MEMS series gas sensor uses MEMS technology to produce a micro-hotplate on a Si substrate. The gas-sensitive material used is a metal oxide semiconductor material with low conductivity in clean air. When the detected gas is present in the environment, the conductivity of the sensor changes. The higher the concentration of the gas, the higher the conductivity of the sensor. The structure of this series of sensors is sturdy, and a simple circuit can convert the change in conductivity into an output signal corresponding to the concentration of the gas. Its small size and low power consumption also make it easy to integrate with other devices.
To achieve the functionality of the electronic nose, I need to collect odor data and analyze it. Therefore, I chose the DFRobot MEMS series gas sensor to measure the components of the odor and output analog signals. In order to collect signals from these 10 MEMS sensors at the same time, I used MEGA2560 a s the main board, and specially made a mega2560 shield for installing the combined sensor array. This array can detect the response of sensors to different odors and identify the main responsive sensor. At the same time, I also used two fans to allow the gas in the sealed space to circulate, so that the odor can be evenly distributed in the space.
In order to store sensor data, I also equipped it with a serial port logging module, which allows the MEGA2560 main control to store sensor data directly without the need for a computer. This ensures the accuracy and reliability of the data.
The electronic nose system based on ESP32-E was designed after identifying the corresponding main sensors through experiments. The ADS1115 module can accurately collect and convert analog signals. And use a breadboard to place CH4, CO, Odor, and CH2O sensors.
To simplify the software development process, I chose Edge Impulse as the edge AI platform. Edge Impulse is the edge AI platform for enterprise teams building innovative products. It optimizes models and enables easy deployment to any edge device. The platform is specifically designed to handle real-world sensor data, accelerating product development and minimizing risks. (Edge Impulse is the edge AI platform for enterprise teams building innovative products. Optimize your models and deploy to any edge device with ease. Accelerate product development while minimizing risks with a platform designed to handle real-world sensor data.) As the platform (edgeimpulse.com) is user-friendly and provides detailed information on the website, I won't go into further detail here.
Many teams online have already used electronic noses to detect beverages with good results, so we first test the odor of the beverages to verify the basic ability of the electronic nose.
From the comparison of the two charts, it can be seen that some gas sensors have obvious differences in output for the two smells.
I used the Edge Impulse platform to train the model. The data was uploaded to the platform and each dataset was labeled as "grape juice" or "cola" using the tagging function. By sorting the feature correlations (how important features are for each class compared to all other classes), more important features for beverage odor analysis can be selected.
Then, I used the machine learning algorithm provided by the platform to train the model and optimize it on the platform. After multiple rounds of training and testing, I finally obtained a model that can classify the odor of grape juice and cola. The F1 SCORE is a metric for measuring the performance of binary classification models. When the F1 Score is equal to 1, it indicates that the model has good performance and high precision and recall. When the F1 Score is equal to 0, it indicates that the model's classification effect is very poor and can not correctly classify samples.
After training and testing, I obtained a relatively accurate model that can automatically identify and classify the odor of grape juice and cola. The model's classification accuracy reached 91.67%, indicating that it can effectively distinguish between these two beverage odors.
Based on the experiment, I found that the electronic nose I designed can successfully identify the difference in beverages, which is similar to the results obtained by most electronic nose teams.
An electronic nose made with MEMS series sensors can run on embedded devices for a long time, collect the odor emitted by fruit, and use machine learning technology to analyze and identify the odor produced when fruit spoils. This can help us detect fruit spoilage in a timely manner, thereby reducing waste and loss.
For data collection, I chose mangoes as the experimental object because they are a common fruit. The experimental items included slightly green mangoes and mangoes that had begun to rot. First, the sensor was preheated for five minutes, then the experimental items were placed in a container and the odor data was measured. After each measurement, the fan cleaned the container for five minutes and waited for the gas in the container to return to a clean state. I saved the data of each measurement as a CSV file, named after the odor, and labeled each row of data.
The sensor feature matrix was processed by t-SNE and distributed in a two-dimensional space, showing the three states of air data in a clustered form.
Using the EON Tuner platform, the model can be automatically trained based on the imported sensor data, and the model parameters and abilities can be adjusted according to the type of target controller selected in the upper right corner.
It can be seen that the accuracy of the model trained by EON Tuner is good, but there may be overfitting.
Mangoes that have been stored for a long time will quickly rot and black spots will appear on the surface. I used a combination of MEMS series CH4, CO, Odor, and CH2O sensors for a two-day mango odor detection. The ESP32-E controller is paired with the ADS1115 module and RTC module, and the sensor data is read every half hour. Before monitoring, the sensor has been preheated for half an hour. Fresh mangoes without obvious black spots were placed in the box. Due to the slightly lower nighttime temperature, the overall data curve showed a slight decline. It can be seen that after about eight hours, the sensor data has a significant increase, and small black spots gradually appear on the surface of the mango.
Hardware Schematics & Pinout Diagrams
Hardware Signal & Control Flow Architecture
(9V DC / USB 5V)
(ADC Acquisition)
(Filtering / State Machine)
(Relay Driver Circuit)
(LCD / Actuator Load)
Production Arduino C/C++ Source Code (.ino)
[*] Initializing Hardware Core for Smart Refrigerator Internal Food Spoilage Electronic Nose System Using Gas Sensor Multi Packs... [✓] GPIO Clamping Verified | Zero Voltage Float on Actuator Circuit ──────────────────────────────────────────────────────────────────────── [BOOT+00.02s] ADC_INIT Calibrated zero-offset = 12 mV (Clean noise floor) [RUN +01.00s] TELEMETRY Sensor ADC: 342 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +02.00s] TELEMETRY Sensor ADC: 388 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +03.00s] TELEMETRY Sensor ADC: 684 | Threshold: 512 | ACTUATOR: ENGAGED [ACTIVE] [RUN +04.00s] INTERRUPT Optocoupler PC817 saturated | Actuator Active in 4.2 ms [RUN +05.00s] TELEMETRY Sensor ADC: 412 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] ──────────────────────────────────────────────────────────────────────── [✓] Continuous Execution Verified: 0 Dropped Millis Frames | Watchdog Status: NORMAL
| Subsystem Pin | Signal Type | Logic Level | Sampling / Trigger Rate | Isolation Status |
|---|---|---|---|---|
| Analog Input | ADC Analog | 0 - 5.0V / 3.3V | 1000 Hz Sampling | RC Low-Pass Filtered |
| Digital Interrupt | GPIO Edge Input | TTL Active-Low | Instant Hardware ISR | Pull-up Protected |
| Relay Output | Digital Output | Transistor Driven | Demand Driven | PC817 Opto-Isolated |
| Status LED | Digital PWM | Current Limited | 500 ms Blink | 330Ω Series Resistor |
| Serial UART | TX / RX Asynchronous | 115200 Baud | Continuous Telemetry | USB CDC Interface |