The food we consume plays an important role in our daily life. It provides us energy which is needed to work, grow, be active, and to learn and think. The healthy food is essential for good health and nutrition. Light, oxygen, heat, humidity, temperature and spoilage bacteria can all affect both safety and quality of perishable foods. Food kept at room temperature undergoes some chemical reactions after certain period of time, which affects the taste, texture and smell of a food. Consuming spoiled food is harmful for consumers as it can lead to foodborne diseases. This project aims at detecting spoiled food using appropriate sensors and monitoring gases released by the particular food item. Sensors will measure the different parameters of food such as pH, ammonia gas, oxygen level, moisture, etc. The microcontroller takes the readings from sensors and these readings then given as an input to a machine learning model which can decide whether the food is spoilt or not based on training data set. Also, we plan to implement a machine learning model which can calculate the lifespan of that food item.
In today’s world, food spoilage is a crucial problem as consuming spoiled food is harmful for consumers. In India, food commodities are wasted due to spoilage. Various factors cause food spoilage, making items unsuitable for consumption. Factors like humidity, moisture, temperature, light intensity, etc. causes food decay. Consuming spoiled food can cause illness commonly known as food poisoning and hence detection of freshness of food or food quality is needed. Also, preservatives used to increase lifespan of food causes people illness and reduces food quality. The freshness of food can be detected manually by smelling it, tasting it or by observing color changes or state of fruits, vegetables or food item. But manual detection is time consuming, also it may have human errors or environmental defects. Therefore, it is important to create device which can determine food spoilage without human interference. This project aims at detecting spoiled food using appropriate sensors and monitoring gases released by the food item. The parameters like pH, humidity, oxygen gas are tested, as increase or decrease in these parameters may reduce the quality of food. Biosensors play a vital role to detect the bacterial contamination in food sample. Based on the combination of the sensor outputs quality of the food should be detected. Our system proposes a device which contains gas sensors, pH sensors, moisture sensor for real time monitoring. These values are communicated to laptop and ml model using esp8366 wifi module. The values extracted are then fed as an input or test data to ml model and tested against trained model. The machine learning model tells the user, what is the current state of food, good to eat or ready for bin. Also, we plan to implement a machine learning model which can calculate the lifespan of that food item.
II. LITERATURE REVIEW
Food spoilage can be detected manually by checking color, tasting it or by smelling it. But manual checking is time consuming, less efficient and expensive due to human errors, environmental defects as checking color or taking smell sometimes gives wrong results. Various food quality monitoring systems and food spoilage detection systems are made using various technologies.
Image processing technique is used to analyze the images of food item using computer vision algorithms. The color, texture and shape are analyzed in order to sort the food, specifically vegetables and fruits, based on the color, size, maturity, defects etc. Fuzzy Logic is used to handle the fuzzy information and rule-based inference to construct decision support in real life applications. To estimate the expiration of food commodities, fuzzy set theory is used .
Machine learning uses the sample datasets (known as training datasets) to train the model in order to make decisions, in this case, to determine whether the food is spoilt or not. In , machine learning algorithms PCA and KNN are used to determine the food spoilage. The information from MQ gas sensors is fed to PCA to reduce the data and KNN is used for classification of food.
Deep learning works with artificial neural networks, which are designed to imitate how humans think and learn and make machine behave like human brain. In , the fruit type and quality is determined using convolutional neural networks.
MIT team has done research on this field by developing a sensor that detects spoilt meat items. But since it only detects a particular gas, it can have a lot of false negatives.
IoT innovation made it possible to connect everyday things to the internet using sensors, actuators and sensing technologies in order to achieve smart recognition, detection, monitoring and many other things. Sensors play an important role in creating solutions using IoT. IoT sensing principles involves features of intelligent sensors and wireless communication, hence Iot system is feasible in developing a visibility and traceability system in order to handle the perishable food.
The  paper proposes a system which uses ammonia and oxygen gas sensors to measure the ammonia and oxygen level of particular food item. NodeMcu sounds a buzzer when it encounters a spoilt food item. Then, the collected data is sent to Thingspeak for cloud analysis of data. Logistic regression is used to determine whether the food is spoilt or not based on the training data provided.
The device called eFresh is developed with biosensors that can measure pH, moisture, and ethanol level of food item. The user can input the food to be checked from Android mobile application, the selection of food item from application gives command to Arduino Uno with communicating through Bluetooth module and microcontroller takes the reading from sensor and decision is made based on predefined algorithm and output is displayed on LCD.
In , UV sensors were used to track the food quantity and a MQ4 gas sensor used to detect the methane gas in the atmosphere which shows the quality (freshness) of the food. This model detects the quality of food and when the food started degrading it alerted instantly.
The  paper proposes a quality recognizing and reviewing framework dependent on OpenCV python library. The Convolution Neural Network (CNN) is implemented to perform the tasks of fruit type recognition and its quality detection through precise, dependable, reliable and quantitative data. The proposed system comprises of microcontroller, sensors, a camera and a conveyor belt setup to segregate the fruits. To preserve the quality of fruits for longer duration the storage unit environment condition is measured using sensors and the data is sent over the cloud based on the technology of Internet of Things.
The objective of this project is to make a device integrated with sensors which can determine the food freshness and food spoilage. Different sensors are used that can measure different parameters of food such as oxygen level, ammonia gas, pH, moisture etc. The device consists of Arduino uno, wifi module esp8266, sensors like pH sensor, gas sensors, humidity/moisture sensor, etc. The parameters like moisture, temperature are monitored in real time using sensors. Gas sensor measures the oxygen and ammonia content of a particular food item. pH of dairy products are measured using pH sensor. The real time values from sensors are communicated to laptop using microcontroller. Machine learning model uses trained model to predict whether the food item is spoilt or not based on the real time data.
IV. MACHINE LEARNING MODEL
Machine learning (ML) is a new area of data mining that allows a computer program to grow increasingly accurate in predicting outcomes without explicitly programming it. With the help of Machine learning model, we can analyze whether the given food item is spoiled or not, also we can predict it’s lifespan. Machine learning model will take input from the sensors in terms of amount of different gases(e.g. Oxygen, Ammonia, etc.) present in food item also pH values of liquid products(e.g. milk, yogurt, juices, etc.) then it will process these values by applying various machine learning algorithms and predict the output in terms of it’s lifespan.
There are various application of these devices in different where food quality needs to be checked:
Industrial Application : In food processing Industries this model will work efficiently because different categories food item can be checked which will leads to less time and man power consumption
Super Malls/Markets : this model can be beneficial in super markets , it will help for staff, to remove destroyed food items from the stock and to add fresh stuff
In dairy Industries: In dairy industries, liquid products destroys on large scale, if staff will already aware of product lifespan then they will instantly make use of it, which will reduce the losses which occurs due to spoiled product.
In this paper we have provided the information about various sensors that can be used to abstract the values of PH and different gases using IOT, which will further can be used to develop a machine learning model to detect it’s lifespan and to check whether the given food item is spoiled or not. In integration, this model will be useful in various sectors to prevent food spoilage and losses which occurs due to lack of knowledge about lifespan of food items.
 Y. P. Tsang, K. L. Choy, C. H. Wu, G. T. S. Ho and H. Y. Lam, \"An Internet of Things (IoT)-Based Shelf Life Management System in Perishable Food e-Commerce Businesses,\" 2019 Portland International Conference on Management of Engineering and Technology (PICMET), 2019, pp. 1-8, doi: 10.23919/PICMET.2019.8893684.
 M. V. C. Caya, F. R. G. Cruz, C. M. N. Fernando, R. M. M. Lafuente, M. B. Malonzo and W. Chung, \"Monitoring and Detection of Fruits and Vegetables Spoilage in the Refrigerator using Electronic Nose Based on Principal Component Analysis,\" 2019 IEEE 11th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management ( HNICEM ), 2019, pp. 1-6, doi: 10.1109/HNICEM48295.2019.9072715.H. Poor, An Introduction to Signal Detection and Estimation. New York: Springer-Verlag, 1985, ch. 4.
 Keshavamurthy, & Mariyam, Steffi & Meghamala, M & Meghashree, M & Neha,. (2019). Automatized Food Quality Detection and Processing System Using Neural Networks. 1442-1446. 10.1109/RTEICT46194.2019.9016919.
 N. Hebbar, \"Freshness of Food Detection using IoT and Machine Learning,\" 2020 International Conference on Emerging Trends in Information Technology and Engineering (ic-ETITE), 2020, pp. 1-3, doi: 10.1109/ic-ETITE47903.2020.80.
 E-Fresh – A Device to Detect Food Freshness.
 Mavani, Nidhi & Mohd Ali, Jarinah & Othman, Suhaili & Hussain, M. & Hashim, Haslaniza & Abd.Rahman, Norliza. (2021). Application of Artificial Intelligence in Food Industry—a Guideline. Food Engineering Reviews. 10.1007/s12393-021-09290-z.
 B. Sarmah and G. Aruna, \"Detection Of Food Quality and Quantity at Cold Storage using IoT,\" 2020 International Conference on Wireless Communications Signal Processing and Networking (WiSPNET), 2020, pp. 200-203, doi: 10.1109/WiSPNET48689.2020.9198348.
 Freshness of Food Detection using Internet of Things and Mobile Application
 Christiena, Dhanushitha H., Arsheya, Ramya C, “Role of Artificial Intelligence and Machine Learning in food industry,” 2020 International Research Journal of Engineering and Technology (IRJET) Volume: 07, Dec 2020
 Survey on Food Quality Monitoring System