Temperature Anomaly Detection is a project that will detect if any anomaly is present in the temperature data that is collected from the LM35 temperature sensor. If there is any anomaly detected, the user of the system will get notified instantly about the same. The notification to the user is sent via both SMS and Telegram message so that instant action can be taken immediately.
The journey during working on this project was completely amazing and a new experience in my life. This project taught me many new things not only collecting data from the sensors, but also about connecting to the users via SMS connectivity using Twilio, sending notifications via Telegram.
The project contains two files namely: conf.py and refrigerator.py. The conf.py is the configuration file that contains configuration details like Telegram channel chat id, the mobile number of sender, details about boltiot wifi module and some more details for the source code file.
The another file which is refrigerator.py contains the source code for the project. It is responsible for connecting the boltiot wifi module to boltiot cloud. Once this connection is established, the data that is collected from the LM35 sensor can be stored on the boltiot cloud for further processing. Moving forward, the refrigerator.py also contains the implementation of Polynomial Regression Algorithm and Z-score Analysis.
Polynomial Regression is responsible for building the polynomial boundaries for the data collected. These boundaries will make it easier to detect the anomalies further in our project.
Why Polynomial Regression ?
If I had used Linear Regression instead of Polynomial Regression, then it with varying temperatures, it might have not been possible to detect anomalies.
Anomalies in the data are detected using Z-score Analysis. For Z-score Analysis to function at its best, it needs certain amount of data to work upon. Hence, when we start our project, we keep sensing the data for a certain amount of time. After we have a certain number of readings to work upon, we start analyzing the coming data using the Z-score Analysis. In my code, I have a threshold for 20 values, which means that when my dataset of the temperature values will contain at least 20 values for the temperature sensed using LM35 sensor, then my Z-score Analysis code will start analyzing the next temperature values to detect if there is any anomaly.
Anomaly is said to be detected if for any particular value sensed for the temperature is very low or very high compared to the average values of last few readings. Such cases tend to arrive if there are any changes in the environment. The task of this project is to notify the user about such changes. It is so because if those changes are not desirable, then the user must fix those changes before they cause any damage.
The anomalies will be notified to the user using short message service (SMS) and Telegram message. But this can be changed as per user's convinience if he wants both or just any one of them.
The file refrigerator.py contains the code for sending notifications as well as handling the failures in case to do so. Once the user gets notified, it is his decision to keep the changes that took place or to fix them. The project will keep performing in both the cases.
Comments