Project Title: A Smart Iot Food Quality Monitoring System

Transcription

MOI UNIVERSITY - SCHOOL OF ENGINEERINGDEPARTMENT OF ELECTRICAL AND COMMUNICATIONSPROJECT TITLE: A SMART IOT FOOD QUALITYMONITORING SYSTEMPRESENTED BY: OTIENO VALARY TERRY (TLE/19/16)PROJECT SUPERVISOR: MR. KENNEDY OWORIA PROJECT REPORT SUBMITTED IN PARTIAL FULFILLMENT OF THEREQUIREMENT FOR THE AWARD OF THE DEGREE OF BACHELOR OFENGINEERING IN ELECTRICAL AND TELECOMMUNICATIONS ENGINEERING, MOIUNIVERSITY

DECLARATIONI declare that this project report is my original work together with my project partner PalvinAtihto Ingosi, and it has not been presented in this or any other university for a degree award.Some of the works have been derived from published books and internet pages which we havecited in the references.OTIENO VALARY TERRYSigned .Date .CERTIFICATIONThis is to certify that the above named student has so far carried out the project work, detailed inthis report, under my supervision.MR KENNEDY OWORISigned .Date .2

DEDICATIONI dedicate this project to all the lecturers, students, staff and generally all those interested inlearning more about how food can be easily and smartly monitored from the comfort of theirhomes or offices.3

ACKNOWLEDGEMENTI would like to acknowledge the sincere efforts of my supervisor, Mr. Kennedy Owori, for hisguidance and supervision all through this project implementation process.I want to thank God for giving me the gift of life, my family for their continuous support andencouragement, my friends for always being there for me and for Moi university fraternity for allthe skills and knowledge they have impacted in me.4

ABSTRACTFood safety and hygiene are among the key concerns in order to prevent the wastage of food.However, for lack of technology and ignorance about the effects of humidity, temperature,exposure to light and alcohol content on foods, food safety is not maintained well enough inKenya. This has led to massive losses in many food stores resulting from food decay.Currently, majority of food stores and warehouses still rely on manual monitoring of theatmospheric factors related to food quality. These conventional food inspection technologies arelimited to weight, volume, color and aspect inspection and as a result do not provide a lot ofinformation needed on quality of food. The quality of the food needs to be monitored and it mustbe prevented from rotting and decaying by the atmospheric factors like temperature, humidity anddark.This project is focused on such a food monitoring system which suggests systematic use of varioussensors to perform quality monitoring and control of food materials. More precisely, this systemconsists of gas, temperature, light and humidity sensors, which provide the essential informationneeded for evaluating the quality of the packed or stored product. This information is transmittedwirelessly to a computer system providing an interface where the user can observe the evolutionof the product quality over time using the Internet of Things technology. Later, the environmentalfactors can be controlled like by refrigeration, vacuum storage and other appropriate controlmeasures.5

LIST TABLESTable 1.1 Comparison between DHT 11 and DHT 22 . 19Table 2.1 Pin Description of MQ-5 Gas Sensor Module . 23Table 3.1 MQ series gas sensors and the gases they are sensitive to. 24Table 4.1 Power supply module. 41Table 5.1 Gas sensor testing and concentrations . 41Table 6.1 LDR Testing and measurement . 426

LIST OF FIGURESFigure 1.1 Food Quality Monitoring System Block Diagram . 15Figure 2.1 Typical Light Dependent Resistor . 21Figure 3.1 MQ-5 gas sensor module . 23Figure 4.1 ESP 32 pin configuration. 25Figure 5.1 Diagram Showing the Working of a Liquid Crystal Display (LCD) . 26Figure 6.1 I2C Address . 27Figure 7.1 Food Quality Monitoring System Flowchart . 29Figure 8.1 Interfacing DHT-11 Sensor with ESP32 . 31Figure 9.1 MQ5 testing on breadboard . 33Figure 10.1 DHT-11 sensor testing on breadboard . 34Figure 11.1 ThingSpeak Website Visualization . 35Figure 12.1 Programming the Gas Sensor . 36Figure 13.1 Program for DHT 11 Sensor. 37Figure 14.1 Programming the Light Sensor . 38Figure 15.1 Programming the LCD . 40Figure 16.1 Humidity and temperature readings . 437

CONTENTSDECLARATION . 2DEDICATION . 3ACKNOWLEDGEMENT . 4ABSTRACT . 5CHAPTER ONE . 12INTRODUCTION . 121.1Background . 121.2 Problem Statement . 131.2Proposed Solution . 131.3.1 System Aim . 141.3.2 System Objectives . 141.5 Block Diagram . 151.6 System Specifications . 15Conclusion. 16CHAPTER TWO . 17LITERATURE REVIEW . 172.1 Introduction . 172.2 Existing solutions . 172.2.1 Manual monitoring of atmospheric and environmental factors. 172.2.2 Installed Measurement Devices monitoring systems . 172.2.3 Smart Food Quality Monitoring System . 182.3 Process . 182.4 Temperature and Humidity Sensors . 182.4.1 DHT Temperature and Humidity Sensors . 198

2.5 Light sensors . 202.5.1 Light Dependent Resistor (LDR) . 202.6 Gas Sensors . 222.6.1. MQ-5 Gas Sensor . 222.7 Controllers . 242.7.1. ESP32 DEVKIT . 252.8.1 Liquid Crystal Display (LCD) . 262.9 Wi-Fi Transceivers . 282.10 IOT platform/dashboard . 282.10.1 ThingSpeak. 28CHAPTER 3 . 29SYSTEM DESIGN . 293.1 Introduction . 293.2. Flowchart of Food Quality Monitoring System . 293.3. ESP32 . 303.4 Interfacing MQ-5 with ESP32 microcontroller . 303.5. Interfacing DHT-11 Sensor with ESP32 . 303.6 Interfacing LDR Light Sensor with ESP32 . 313.7 Interfacing I2C LCD 16x2 with ESP32 . 31Conclusion. 31CHAPTER FOUR . 32CONSTRUCTION AND TESTING . 324.1 Introduction . 324.2.1 Tools and Equipment Used. 324.2.2. Construction Process . 329

4.2.3 Gas Sensor Testing on breadboard . 334.2.3 DHT-11Sensor Testing on breadboard . 334.2.4 LDR Sensor Testing on breadboard . 344.2.5 LCD testing on breadboard. 344.2.6. Uploading the Data to ThingSpeak . 354.3 Programming the System . 354.3.1 Gas Sensor . 354.3.2 DHT 11 Sensor . 364.3.3 Light Sensor . 384.3.4 I2C 16*2 LCD . 384.4 Testing and Result . 404.4.1 Test Point Testing . 404.5 Discussion . 43Conclusion. 44CHAPTER FIVE . 45CONCLUSION AND RECOMMENDATION . 455.1 Introduction . 455.2 Statement of the Initial Objectives . 455.3 Summary of Achievements . 455.4 Application of the System . 465.5 Benefits of the Study . 465.6 Challenges Faced During Design and Implementation . 465.7 Recommendations . 465.8 Final Conclusion . 47REFERENCES . 4810

APPENDIX . 4911

CHAPTER ONEINTRODUCTION1.1 BackgroundFood contamination can occur in the production process, but also a large part caused by theinefficient food handling because of inappropriate ambient conditions when the food is beingtransported and stored. There are many factors leading to food poisoning, typically changes inlight intensity, temperature, alcohol content and humidity are important factors. A monitoringsystem capable of measuring temperature and humidity variability during transport and storage isof prime importance.Today almost everybody is getting affected by the food they consume, it's not only about the junkfood, but all the packed foods, vegetables, products consumed and used in daily life, as all of themdo not offer quality since their temperature, moisture, oxygen content vary from time to time.Majority of consumers only pay attention to the information provided on the packaging, i.e. theamount of ingredients used and their nutritional value but they forget that they are blindly riskingtheir health by ignoring the environmental conditions to which these packets are subjected. Everyproduct making firm just want to attract more and more costumers towards them and their mainmotive is to sell the product anyhow like by adding more flavors, coloring chemicals andpreservatives to increase the taste and appearance but they forget that these money making tacticsare actually affecting the consumers’ health.High temperature and relative humidity favor the development of post-harvest decay organisms.More acidic tissue is generally attacked by fungi, while fruits and vegetables having pH above 4.5are more commonly attacked by bacteria. A wide variety of foods can also undergo changes incolor, flavor, and nutrient composition when exposed to light. The extent of these changes dependson many factors including the composition of the food and the light source. Light exposure couldresult in color and vitamin loss. Light also may be responsible for the oxidation of fats. Some typesof yeasts can also lead to spoilage. True yeast metabolizes sugar producing alcohol and carbondioxide gas. This process is known as fermentation. Hence by checking on alcohol quantity contentone can detect the quality of food.12

The system I propose is intended for food quality monitoring. In this project, a similar food qualitymonitoring device will be designed that will keep watch of environmental factors like temperature,humidity, alcohol content and exposure to light.1.2 Problem StatementSpoiled food can be very harmful for people and should therefore not be consumed. Often, thegrowth of spoilage organisms results in the loss of whole batches of food. Food safety and qualityhas been a major challenge in the food supply chain, stores and warehouses. It is the responsibilityof all food service establishments, stores and ware houses to ensure proper safety and quality offood to ensure the health of their customers. Their primary focus should be on implementing therequired quality assurance guidelines and standards resulting in process monitoring systems andpreventive control measures. It serves the purpose of preventive consumer health protection bymaintaining the required standard ambient conditions needed to preserve the quality of food.However, existing systems have been unable to provide food safety guarantees. Currently theperformances and analysis of routine measurements, aimed at detecting changes in the nutritionalor health status of the food does not guarantee that.To ensure food safety and to prevent food wastage, it should be monitored at every stage of supplychain. Food and nutrition monitoring and surveillance involves continuous description of thecomponents of the food and nutrition system for the purposes of planning, policy analysis, programevaluation and trend forecasting. Information collected through monitoring and surveillance mustbe analyzed and transmitted to decision-makers in an appropriate format and in a timely fashion ifit is to be of real value. Dissemination of information must be an interactive process. Thus,integration of the sensors with remote web server for data logging and a software application whichallows distribution of data is the need of the hour.1.3 Proposed SolutionThis project proposes a system to analyze the ambient conditions under which the food item isbeing stored and transported. The proposed solution senses the temperature, humidity, alcoholcontent and light parameters of surrounding environment as these parameters affect nutritionalvalues of food items. This system makes use of storage units implanted with various electronicsensors which can read those parameters affecting food materials.13

These quality monitoring devices keep a watch on the environmental factor that cause or pace updecay of the food. Later, the environmental factors can be controlled like by refrigeration, vacuumstorage etc.The proposed solution is designed to use an IoT platform used for logging and monitoring of sensordata. With the power of Internet of Things, the environmental factors affecting the food storagecan be monitored from anywhere, anytime and from any device.1.4 AimsThe food quality monitoring system has the following aims and objectives. The system aimstates the main function of the whole system and the system objectives identifies the individualtasks that the parts of the system should achieve.1.4.1 System AimThe complete system should be able to analyze the ambient conditions under which the food itemis being stored make the information available to the user1.4.2 System ObjectivesThe proposed system should be able to;a) Read temperature and relative humidity in the food store.b) Sense the intensity of light in the food store.c) Detect the emission of ethanol type of gases.d) Collect data from all the sensors and pass to LCD for display.e) Monitor the sensor data visually online.14

1.5 Block DiagramTemperature andHumidity SensorLight SensorWi-Fi TransceiverMICROCONTROLLERGas SensorDisplay UnitPower SupplyFigure 1.1 Food Quality Monitoring System Block DiagramA gas sensor is a device that measures the concentration of gas in the room and converts theconcentration variable to its equivalent voltage. Temperature sensors measure air temperature,while humidity sensors measure relative humidity. Both sensors are often applied in combinationto reduce cost. The light sensor is used to sense the intensity of light. The display unit is used todisplay the data from all the sensors. In the monitoring system, the information collected by thesensors is transferred to the Internet. The relevant people can monitor the gas concentrationlevels of the food store, temperature, humidity and the light intensity through an open sourceInternet platform.1.6 System SpecificationsThe maximum gas concentration level in the study is 10,000 ppm (parts per million) and theminimum level 10 ppm. The proposed system should be able to detect concentration levels fromminimum to maximum and upload the information to an Internet platform. The temperaturerange in this study is between 0 C to 50 C while the humidity ranges between 20% to 90%. The15

light sensor operates within a range of 0 to 1023 where 1023 is the maximum value equivalent toa 5 volts supply. The circuit should operate on 5V DC.ConclusionThis chapter has defined the background of food quality monitoring system, the problemstatement, the proposed solution, the main aim of the complete system and the objectives of theindividual parts of the system. This chapter also discusses the specifications for the system whichdetermines its design quantities.16

CHAPTER TWOLITERATURE REVIEW2.1 IntroductionIn this chapter we discuss food quality monitoring systems that currently exist or have beenproposed giving both their strengths and weaknesses. A study on our proposed system is donecomparing it with these food quality monitoring systems focusing more on how our systemaddresses their weaknesses. We also do a comprehensive literature study of various componentsthat are likely to be used in the realization of our proposed solution. The study of the componentscovers areas such as their mode of operation, features, specifications, uses, applications,advantages and disadvantages.2.2 Existing solutionsThe following solutions that attempt to monitor food quality by monitoring related environmentalfactors currently exist;2.2.1 Manual monitoring of atmospheric and environmental factorsMajority of food stores and warehouses still rely on this system of manual monitoring of theatmospheric factors related to food quality. This requires some personnel to routinely visit andcheck the conditions of the store by taking note of these conditions at some selected time intervals.Increase in labor by routine checkups, risk of injury or harm to the personnel by extremeconditions, delays or even human errors in measurements are among the shortcomings of thismethod.2.2.2 Installed Measurement Devices monitoring systemsThese systems are the improved versions of the manual monitoring system. Measurement devicesfor atmospheric conditions are installed inside the food store. However, there is no automatic relayof information and one still has to go to the store in order to find information about the currentatmospheric conditions and food conditions [1]. Delays in measurement reading, failure of devices,and maintenance of devices are some of the shortcomings of the system which would costly impacton food quality.17

2.2.3 Smart Food Quality Monitoring SystemThis study suggests the systematic use of various sensors to perform quality monitoring and controlof food materials. More precisely, this system consists of gas, temperature, light and humiditysensors, which provide the essential information needed for evaluating the quality of the packedor stored product. This information is transmitted wirelessly to a computer system providing aninterface where the user can observe the evolution of the product quality over time using theInternet of Things technology. This system comes with the following key advantages [1];a) Automation of daily tasks leading to better monitoring of devices.b) The biggest advantage of employing the IoT technology in this system is saving money.c) Efficient and saves time2.3 ProcessThe process is the food store. It is the environment in which variables needs to be observed andchecked. In as much real food stores may have varied dimensions, for the sake of demonstration,the prototype food store shall be a much smaller wooden cardboard store with the followingdimensions;Length 15cmHeight 11cmWidth 5cmAll design shall be in respect to the prototype dimensions.2.4 Temperature and Humidity SensorsThese sensors are used to sense the values of temperature and humidity in the air or particularsurrounding.18

2.4.1 DHT Temperature and Humidity SensorsThese sensors are very popular for electronics hobbyists because there are very cheap but stillproviding great performance. We have two versions of the DHT sensor, they look a bit similarand have the same pinout, but have different characteristicsa) DHT 11 Sensorb) DHT 22 SensorThe DHT22 is the more expensive version which obviously has better specifications. Itstemperature measuring range is from -40 to 125 degrees Celsius with -0.5 degrees’ accuracy,while the DHT11 temperature range is from 0 to 50 degrees Celsius with -2 degrees’ accuracy.Also the DHT22 sensor has better humidity measuring range, from 0 to 100% with 2-5%accuracy, while the DHT11 humidity range is from 20 to 80% with 5% accuracy.DHT 11DHT 220-50 C 2 C accuracyTemperature Range-40 to 80 C 0.5 Caccuracy20-80% humidity readingsHumidity Rangewith 5% accuracy0-100% humidity readingswith 2-5% accuracyNo more than 1 HzSampling RateNo more than 0.5 Hzsampling rate (once everysampling rate (once everysecond)2 seconds)15.5mm x 12mm x 5.5mmBody Size15.1mm x 25mm x 7.7mm3 to 5V power and I/OOperating Voltage3 to 5V power and I/O2.5mA max current useMaximum Current2.5mA max current useduring conversion (whileduring conversion (whilerequesting data)requesting data)Table 1.1 Comparison between DHT 11 and DHT 2219

There are two specifications where the DHT11 is better than the DHT22. That’s the samplingrate which for the DHT11 is 1Hz or one reading every second, while the DHT22 sampling rate is0,5Hz or one reading every two seconds and also the DHT11 has smaller body size. Theoperating voltage of both sensors is from 3 to 5 volts, while the max current used whenmeasuring is 2.5mA.DHT11 / DHT22 Working PrincipleThey consist of a humidity sensing component, a NTC temperature sensor (or thermistor) and anIC on the back side of the sensor.For measuring humidity, they use the humidity sensing component which has two electrodeswith moisture holding substrate between them. So as the humidity changes, the conductivity ofthe substrate changes or the resistance between these electrodes changes. This change inresistance is measured and processed by the IC which makes it ready to be read by amicrocontroller.On the other hand, for measuring temperature these sensors use a NTC temperature sensor or athermistor. A thermistor is actually a variable resistor that changes its resistance with change ofthe temperature [2]. These sensors are made by sintering of semi conductive materials such asceramics or polymers in order to provide larger changes in the resistance with just small changesin temperature. The term “NTC” means “Negative Temperature Coefficient”, which means thatthe resistance decreases with increase of the temperature.2.5 Light sensorsThe light sensor is a passive device that convert this “light energy” whether visible or in the infrared parts of the spectrum into an electrical signal output. Light sensors are more commonly knownas “Photoelectric Devices” or “Photo Sensors” because the convert light energy (photons) intoelectricity (electrons).2.5.1 Light Dependent Resistor (LDR)A Light Dependent Resistor (LDR) is also called a photo resistor or a cadmium sulfide (CdS) cell.It is also called a photoconductor. It is basically a photocell that works on the principle of20

photocondu

Currently, majority of food stores and warehouses still rely on manual monitoring of the atmospheric factors related to food quality. These conventional food inspection technologies are limited to weight, volume, color and aspect inspection and as a result do not provide a lot of information needed on quality of food. The quality of the food needs to be monitored and it must be prevented from .