UNIVERSITY OF MANITOBA DEPARTMENT OF ELECTRICAL AND C OMPUTER ENGINEERING GRAD PROJECT A SMART IOT TEMPERATURE MONITORING SYSTEM USING HUZZAH ESP8266 Report Prepared by YOUNUS DEWAN Date of Submission 2nd May 2022 Abstract The goal of the project was to design, analyze, and develop a Smart IoT Temperature Monitoring System (SITMoS). The SITMoS will collect and share data between two devices using the Internet to automatically adjust a HVAC system. The SITMoS is built using Adafruit Feather HUZZAH ESP8266 and the LM61B2M3 Si Bandgap temperature sensor on the hardware side and Arduino IDE (Integrated Development Environment) running in the backend. SITMoS is a real time system which transmits data to open IoT API service Adafruit IO where it is analyzed and stored. This paper will start by introducing the SITMoS and how it can be useful in moveable shelving storage systems. Then it will give a brief idea of the components used along with their technical specifications. Details on the data packet sent and the method to fetch data from the asset to the cloud are provided. Then the paper will show a mock-up of the dashboard that would be used to present and analyzed the data. It will be followed by a flowchart which will give a clear idea of how the system will work. The experimental results show that the SITMoS meets the requirements of practice and will be deployed in an outdoor carousel. Acknowledgement I would also like to express my gratitude towards my supervisor and the course instructor, Dr. Douglas Thomson, for giving me this great opportunity to do a project on a smart IoT temperature monitoring system. Without his support and suggestions, this project would not have been completed. 1|Page Table of Contents ABSTRACT ....................................................................................................................................... 1 ACKNOWLEDGEMENT ...................................................................................................................... 1 TABLE OF CONTENTS ....................................................................................................................... 2 INTRODUCTION ................................................................................................................................ 3 1.1 BACKGROUND ........................................................................................................................ 3 1.2 PROBLEM STATEMENT ............................................................................................................ 3 1.3 PROPOSED SOLUTION ............................................................................................................. 3 PROJECT OVERVIEW ......................................................................................................................... 4 2.1 APPLICATION OVERVIEW ........................................................................................................ 4 2.2 SITMOS CIRCUIT ................................................................................................................... 5 2.3 FINAL BUDGET ....................................................................................................................... 5 TECHNICAL SECTION........................................................................................................................ 6 3.1 QUANTITY UNDER MEASUREMENT (QUM) – TEMPERATURE ................................................. 6 3.2 HARDWARE DESCRIPTION ...................................................................................................... 7 3.2.1 TEMPERATURE SENSOR – LM61B2M3 SI BANDGAP....................................................... 7 3.2.2 WIFI DEVELOPMENT BOARD – ADAFRUIT FEATHER HUZZAH ESP8266 ...................... 7 3.2.3 BATTERY – LITHIUM ION POLYMER BATTERY (3.7V 500MAH)........................................ 8 3.2.4 BATTERY CHARGER – SOLAR LIPO BATTERY CHARGER (3.7V 500MA) .......................... 9 3.2.5 SOLAR PANEL – WAVESHARE SOLAR PANEL (6V 5W) .................................................... 9 3.3 POWER LIMITATION AND REQUIREMENT ............................................................................... 10 3.4 COMPUTATIONS .....................................................................................................................11 EDGE COMPUTATION ...............................................................................................................11 CLOUD COMPUTATION ............................................................................................................11 3.5 THE DATA PACKET................................................................................................................ 12 3.6 DATA TRANSMISSION ............................................................................................................ 12 3.7 THE DASHBOARD ................................................................................................................. 15 3.7 STATISTICAL ANALYSIS ......................................................................................................... 15 3.7.1 DATA RECEIVED BY ADAFRUIT IO UNTIL EQUILIBRIUM REACHED ................................ 16 3.7.2 DATA RECEIVED BY ADAFRUIT IO AFTER EQUILIBRIUM REACHED ............................... 17 3.7.3 THE MEAN MEASURED VALUE OF THE DATA POINTS – ACCURACY ANALYSIS ............. 18 3.7.4 THE STANDARD DEVIATION OF THE DATA POINTS – PRECISION ANALYSIS .................... 18 RECOMMENDED AND FUTURE WORK ............................................................................................. 20 CONCLUSIONS ................................................................................................................................ 20 REFERENCES .................................................................................................................................. 21 2|Page Introduction 1.1 Background Internet of Things (IoT) allow us to monitor and control our environment through the use of devices such as sensors and actuators. IoT facilitates sensing, processing, and wireless transmission of data to remote storage like cloud which stores, analyzes, and processes this data in useful form. From the cloud this information can then be accessed through various front end user interfaces for various applications. Temperature monitoring is an important IoT application which involves monitoring the surrounding temperature and reporting this data for remotely controlling the heating or cooling devices. 1.2 Problem Statement Vidir Solutions Inc. is developing an outdoor carousel to be used for storage, farming, etc. They want to develop a system that can use to monitor what is happening inside the enclosed carousel in order to automatically adjust the HVAC system. The client would like something that can be installed onto the rotating shelves and monitor what is happening inside the enclosed carousel. 1.3 Proposed Solution This paper presents the implementation details and results of a temperature monitoring system – SITMoS. The SITMoS uses a temperature sensor to monitor the temperature at each shelf location inside the Carousel and then transmits the data collected through Internet to a remote cloud storage. The data is then accessed from the cloud by a controller. The controller analyzes the data and triggers the HVAC system accordingly to maintain a suitable environment inside the enclosed Carousel. 3|Page Project Overview 2.1 Application Overview Each carousel is equipped with 12 rotating shelves. Each shelf will be used for storing different types of good. As different goods will require different weather conditions for proper storage, it is essential to monitor the temperature of each individual shelf and adjust the HVAC system. The rotational motion of the shelves makes it difficult to install wired sensors on the shelves and as a result an IoT integrated solution using Wi-Fi is chosen for this application. Figure 1: 3D Drawing of the Carousel 4|Page 2.2 SITMoS Circuit Figure 2: SITMoS Circuit Diagram 2.3 Final Budget Table 1: Budget Table Single SITMoS Adafruit Feather HUZZAH ESP8266 LM61B2M3 Temperature Sensor Lithium Ion Polymer Battery – 3.7v 500mAh 3.7V 500mA Solar LiPo Battery Charger Waveshare Solar Panel (6V 5W) Cloud Service Total Cost $ 18.95 $ 2.23 $ 7.95 $ 6.28 $ 14.09 $0 $ 49.50 5|Page Technical Section 3.1 Quantity Under Measurement (QUM) – Temperature Temperature will be measured using the LM61B2M3 Si Bandgap temperature sensor. πΏπ61 πΏπππππ πππππ πΉπππ‘ππ = 10ππ/°πΆ π΄π‘ 0°πΆ → πππ’π‘ = 600ππ π΄π‘ − 30°πΆ → πππ’π‘ = 600ππ + (−30 × 10) = 300ππ π΄π‘ 100°πΆ → πππ’π‘ = 600ππ + (100 × 10) = 1600ππ LM61B2M3 Temperature Range LM61B2M3 Voltage Range Feather HUZZAH ESP8266 ADC Input Range Feather HUZZAH ESP8266 ADC Output Range πππππ π΅ππ’ππ ππ ππππππππ‘π’ππ = Lower Bound -30°C 300mV 0mV 0 Upper Bound 100°C 1600mV 1000mV 1023 1000ππ − 600ππ = 40°πΆ 10ππ/°πΆ πΏππ€ππ π΅ππ’ππ ππ ππππππππ‘π’ππ = −30°πΆ π ππ πππ’π‘πππ = 40°πΆ − (−30°πΆ) = 0.068°πΆ/πππ‘ 1024 − 1 6|Page 3.2 Hardware Description 3.2.1 Temperature Sensor – LM61B2M3 Si Bandgap Figure 3: LM61B2M3 Si Bandgap Sensor The LM61B2M3 Si Bandgap Temperature sensor is selected for environmental monitoring as it has high reliability and excellent long-term stability. It has small dimensions, low cost, good quality, analog signal output, and precise calibration. It can be easily interfaced with Feather HUZZAH ESP8266 Wi-Fi board using the pins shown in figure 2. Figure 3 shows a picture of the LM61 sensor used in the SITMoS. It has temperature range from -30°C to 100°C. The project required temperature reading between -20°C and 30°C. This sensor is chosen because it has calibrated linear scale factor of 10mV/°C for full temperature range of -30°C to 100°C. 3.2.2 WiFi Development Board – Adafruit Feather HUZZAH ESP8266 Figure 4: Adafruit Feather HUZZAH ESP8266 Wi-Fi Development Board The central component of the SITMoS is the Feather HUZZAH development board which interfaces with other components of the system. The Feather HUZZAH development board consist 7|Page of an ESP8266 WiFi microcontroller clocked at 80 MHz and at 3.3V logic. The development board also comes with a built in ADC. The controller interfaces with the sensor chip at the ADC input for receiving temperature readings and sends the received data to the cloud over the Internet. The microcontroller polls the sensor to retrieve data and sends it over the Internet to Adafruit IO. This built in ADC has a 10-bit resolution (0.068°C/bit) and the board can be powered with a battery. This microcontroller serves the purpose well due to its low cost, simplicity, and robustness. Figure 4 shows a picture of the Adafruit Feather HUZZAH Development board used in the SITMoS system. The microcontroller is programmable with the Arduino IDE for an easy-to-run Internet of Things core via a type B USB cable. The project required reading of analog signal at a resolution of 1°C and this development board meets the requirement. Additionally, these microcontrollers contain a Tensilica chip core as well as a full WiFi stack and a USB-Serial chip that can upload code at a blistering 921600 baud for fast development time. [1] 3.2.3 Battery – Lithium Ion Polymer Battery (3.7V 500mAh) Figure 5: Lithium Ion Polymer Battery - 3.7v 500mAh The project required a system with power storage capability. Presence of artificial light inside the enclosure will allow recharging of the battery at regular intervals. The total power consumption of the system is less than 100mA (see section 3.3), therefore this battery is capable of powering the system for 5 hours each time its fully charged. 8|Page 3.2.4 Battery Charger – Solar LiPo Battery Charger (3.7V 500mA) Figure 6: 3.7V 500mA Solar LiPo Battery Charger The power from the solar panel cannot be directly used to recharge the battery and so this battery charger is used to allow intelligent charging with reverse polarity protection. With operating temperature between -40°C to 85°C and having a small size (33mm x 33mm x 12mm) it is a good fit for the solar powered charging sub-system. 3.2.5 Solar Panel – Waveshare Solar Panel (6V 5W) Figure 7: Waveshare Solar Panel (6V 5W) The project required that the SITMoS be installed on rotating shelves. As the shelves are rotating, any electronics installed on it required power storage capability – i.e. A battery. To avoid replacing batteries, a renewable energy source (light) is exploited and thus a solar panel is used in the system. This specific solar panel is selected as it meets all the operating conditions (i.e. power, voltage, current, etc.) to work with the charger and the battery chosen for this project. 9|Page 3.3 Power Limitation and Requirement Solar Panel πππ€ππ → 5.0π ± 5% ππππππ‘πππ π£πππ‘πππ → 6.0 π ± 5% ππππππ‘πππ ππ’πππππ‘ → 833 ππ΄ ± 5% (πππ₯) ππππ πππππ’ππ‘ π£πππ‘πππ → 7.2 π ± 5% πβπππ‘ πππππ’ππ‘ ππ’πππππ‘ → 916 ππ΄ ± 5% Battery Charger πΌπππ’π‘ π£πππ‘πππ → 4.4~6π πΆβππππππ ππ’πππππ‘ → 500ππ΄ (πππ₯πππ’π) πΆβππππππ ππ’π‘πππ π£πππ‘πππ → 4.2π Battery ππππ‘πππ → 3.7π πππ‘ππ π΄ππ π»ππ’π → 500ππ΄β πππ‘ππ πππ‘π‘ π»ππ’π → 1.9 πβ System Requirement πΏπ61 πΆπ’πππππ‘ π·ππππ ππ‘ 25°πΆ → 125ππ΄ πΆπ’πππππ‘ π·ππππ ππ Feather HUZZAH ESP8266 → 80mA πππ‘ππ πππ€ππ πΆπππ π’πππ‘πππ = 125π + 80π = 80.125ππ΄ πππ‘ππ ππππππ‘πππ ππππ π€ππ‘β πΉπ’πππ¦ πΆβπππππ π΅ππ‘π‘πππ¦ = ππππ π‘π π ππβππππ = 500ππ΄β = 6.24 π»ππ’ππ 80.125ππ΄ 500ππ΄β = 0.6 π»ππ’ππ 833 ππ΄ It will have less than an hour to fully recharge the battery if maximum solar power is available. 10 | P a g e 3.4 Computations Edge Computation Edge computing is computing that's done at or near the source of the data. In the SITMoS, the temperature sensor converts temperature reading to voltage reading with the conversion rate of 10 mV/°C and an offset of 600mV at 0°C. The voltage signal is then fed into the ADC port of the microcontroller. The ADC pin has a 10-bit resolution, which means it converts 0 – 1000mV analog signal to digital signal between 0 and 1023 bits. The data is sent to the cloud at 1 minute intervals. This interval is programmable depending on the application requirement. Cloud Computation Cloud computing is the delivery of computing services such as storage, databases, networking, software, analytics, etc. Arduino IDE was used to program the microcontroller for data retrieval from sensor and data transmission to the Adafruit IO (cloud). The data is compared to set conditions and action commands are sent to a Programmable Logic Controller (PLC) via the Adafruit IO HTTP API. The PLC then controls the HVAC system of the carousel accordingly. Data is also stored in the cloud for future analysis, The following is an example of the set conditions and action commands: < 400ππ (−20°πΆ): πΈπ₯π‘ππππππ¦ πΏππ€ ππππππππ‘π’ππ! π΄π‘π‘πππ πππ π πππ’ππππ 401ππ(−19.9°πΆ) < ππππππππ‘π’ππ < 599ππ(−0.1°πΆ): ππ’ππ π»ππππ‘πππ ππ 600ππ(0°πΆ) < ππππππππ‘π’ππ < 899ππ(29.9°πΆ): ππ’ππ π΄ππ πΆπππππ‘πππ ππ < 900ππ(30°πΆ): πΈπ₯π‘ππππππ¦ π»ππβ ππππππππ‘π’ππ! π΄π‘π‘πππ πππ π πππ’ππππ 11 | P a g e 3.5 The Data Packet Firstly, using Wi-Fi credentials (i.e. WIFI_SSID and WIFI_PASS), the controller connects to the local network. Secondly, connection to Adafruit IO is established by using the dafruit.io username and adafruit.io key. Once connected, the data points are transmitted as ascii encoded text by the controller to the Adafriut IO cloud service. Assuming 20% overhead, the following data packet can be taken as an example: dewanyaio_NFNKwZh4eF8IVYNtmsIq5b3NnbvqBELL777D88815A2C2F3765 This example includes the username, password, WiFi, WiFi Password and also the number sent. The example data string above contains 60 characters. π΅π¦π‘ππ π πππ’ππππ πππ π·ππ‘π ππππππ‘ = πΆβπππππ‘ππ πππ ππ‘ππππ + ππ£ππβπππ = 60 + 20% ππ60 = 60 + 12 = 72 ππ¦π‘ππ /πππ‘π ππππππ‘ ASCII is an 8-bit code. It uses eight bits to represent a letter or a punctuation mark. Eight bits are called a byte. To calculate the number of bits per data packet, multiply Bytes/Data packet by 8. π΅ππ‘π πππ π·ππ‘π ππππππ‘ = 72 × 8 = 576 πππ‘π /πππ‘π ππππππ‘ 3.6 Data Transmission Figure 8: System Architecture Block Diagram 12 | P a g e The ESP8266 WiFi controller as an integrated TCP/IP client. The controller reads the sensor and uploads the data to the Adafruit IO. The Adafruit IO uses a Key to restrict or grant access to the data. The key is unique and covers every use of the Adafruit IO API for a certain account. Data on IO is kept in time-series databases called feeds. Each feed contains time-stamped data points. The data points do not have to be numbers and can be any type of data. Figure 9: Adafruit IO Feed As can be seen on the code below, the controller will connect to the feed, initialize the sensor, and then execute a loop, sending the temperature every 1 minute. Free Adafruit IO Account is used for this project. The rate limit for the free account is 30 data points per minute. With one SITMoS system on each shelf, 12 data points will be transmitted per minute; there is no chance of loss of data. The data coming in can also be monitored using the dashboard over at the Adafruit IO website. 13 | P a g e 14 | P a g e 3.7 The Dashboard Adafruit IO uses Dashboard to aggregate, visualize and analyze live data streams. The Dashboard provides instant visualizations of the real-time data uploaded by SITMoS. Figure 10: Adafruit IO Dashboard An outdoor Carousel is not available to determine the accuracy of the SITMoS. However, an experiment under controlled conditions is conducted to verify the accuracy and precision of the system. 3.7 Statistical Analysis In order to accurately test the system, the temperature around the sensor is artificially varied by placing the sensor in an ice bath, thus a drop can be observed in figure 10 after which the temperature readings settle to average environmental temperature of approximately 0°C (figure 11). The temperature within the ice bath is within +-0.1C of the melting point for water. The data is transmitted to Adafruit IO. The data is graphed and tabulated as follows: 15 | P a g e 3.7.1 Data Received by Adafruit IO until Equilibrium Reached Table 2: Data Received by Adafruit IO until Equilibrium Reached Reading # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time(s) 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 Data 787 692 668 656 649 646 645 642 637 628 619 617 617 617 617 617 617 617 617 617 Figure 11: Data Point-Time Plot for data received until Equilibrium Reached Figure 10 shows the record of temperature monitoring over a period of time. The graph is temperature vs. time where the temperature changes are updated after an interval of 5 seconds. 16 | P a g e 3.7.2 Data Received by Adafruit IO after Equilibrium Reached Table 3: Data Received by Adafruit IO after Equilibrium Reached Reading # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time(s) Voltage (mV) 5 619 10 618 15 619 20 617 25 618 30 619 35 618 40 618 45 618 50 618 55 618 60 618 65 618 70 618 75 618 80 618 85 618 90 618 95 618 100 618 Figure 12: Data Point-Time Plot for data received after Equilibrium Reached 17 | P a g e 3.7.3 The Mean Measured Value of the Data Points – Accuracy Analysis π 20 π=1 π=1 1 1 1 Μ = ∑ π·π = ππππ ππ π‘βπ π·ππ‘π πππππ‘π , π· ∑ π·π = × 12362 = 618.1 π 20 20 ππππ ππππ‘πππ, πΜ = 618.1 − 1 × 1000 = 603.23ππ 1024 − 1 ππππ ππππππππ‘π’ππ = 603.23ππ − 600ππ = 0.323°πΆ 10ππ/°πΆ πππ’π ππππ’π @ 0°πΆ ππππ π·ππ‘ππ βπππ‘ = 600ππ π·πππππππππ = 603.23ππ − 600ππ = 3.23ππ = 0.54% 3.7.4 The Standard Deviation of the Data Points – Precision Analysis # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Sum Mean Si Bandgap Sensor Data Point (D) βD (βD)2 619 1 0.809999999999959 618 0 0.010000000000005 619 1 0.809999999999959 617 -1 1.210000000000050 618 0 0.010000000000005 619 1 0.809999999999959 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 618 0 0.010000000000005 12362 618.1 3.800000000000000 18 | P a g e 1 1 2 Μ ππ‘ππππππ π·ππ£πππ‘πππ ππ π‘βπ π·ππ‘π πππππ‘π = √π−1 ∑π π=1( π· − π·π ) = √20−1 × 3.8 = 0.447 ππ· ππ ππππππππ‘π’ππ = 0.447 × 0.068°πΆ/πππ‘ = 0.03°πΆ ππ‘ππππππ πΈππππ ππ ππππππππ‘π’ππ, ππΈ = 0.3 √20 = 0.0068°πΆ The difference between the mean (0.323°C) and the true value (0°C) is 50xSE, thus the readings are good. However, the following sources of error are considered for error analysis: • • • Calibration Accuracy of LM61B2M3 Gain Error of LM61B2M3 Line Regulation Error of LM61B2M3 Initial Calibration Accuracy [2]: πΌπππ‘πππ π΄πππ’ππππ¦ = ±3 °πΆ πΈππππ ππ πππ = ±3 °C Gain Error [2]: πΊπππ πΈππππ = 0.3 ππ/°πΆ πΈππππ ππ ππ’π‘ππ’π‘ = 0.3 ππ/°πΆ × (30 − 10) °πΆ = 6 ππ πΈππππ ππ πππ = 6 ππ = ±0.6 °πΆ 10 ππ/°πΆ Line Regulation Error [2]: πΏπππ π πππ’πππ‘πππ πΈππππ = 0.7 ππ/π × 3.7π = ±2.6 ππ πΈππππ ππ πππ = 2.6 ππ = ±0.26 °πΆ 10 ππ/°πΆ Method 1 (Maximum Error): πππ‘ππ πΈππππ = 3 + 0.6 + 0.26 = ±3.86 °πΆ Method 2 (Most Likely Error): πππ‘ππ πΈππππ = √32 + 0.62 + 0.262 = ±3.07 °πΆ The accuracy and precision of the Temperature Sensor agree with the specifications for the sensor/signal conditioning/measurement instrument. 19 | P a g e Recommended and Future Work Along with temperature, other sensors like humidity, gas, noise, light, pressure, and UV can be used based on the application requirement. However, a controller with more analog input pins is required to accommodate multiple sensors. The BeagleBone (BB) is a good option for applications involving multiple sensors. Microsoft Azure IoT hub can be used as the cloud service with the BB for a more powerful and robust application. MQTT protocol can also be used in place of HTTP to communicate with external devices due to its lower complexity and ability to send information in low bandwidth environments. Conclusions The goal of the project was to build a Smart IoT Temperature Monitoring System (SITMoS) for real-time monitoring of temperature of surrounding environment. The sensed data is sent through Wi-Fi to the cloud (Adafruit IO) where both real-time data and its graphical analyses can be viewed (dashboard). The Adafruit IO HTTP API will provide access to the Adafruit IO data from any programming language or hardware environment that can speak HTTP. This system will be integrated with a Carousel automation and HVAC system where the monitored values of temperature will be used to trigger some action and control the devices for heating or cooling as needed. IoT based temperature detecting devices provide an efficient and definitive system for monitoring environmental parameters. IoT based systems can also be extended for controlling various electronic and electric devices from remote locations. 20 | P a g e Appendix Figure 13: Control Panel of the Carousel References [1] https://learn.adafruit.com/adafruit-feather-huzzah-esp8266?view=all [2]https://www.ti.com/lit/ds/symlink/lm61.pdf?ts=1645318805504&ref_url=https%253A%252F %252Fwww.google.com%252F 21 | P a g e