Temperature monitoring is an important part in various industries such as Food, pharmaceutical, etc for manufacturing, storing and many other aspects.
With the use of Internet of Things, temperature monitoring can be really simplified in a way that is convenient and reliable.
Keeping the temperature under control inside your fridge can give you the best results with your ice-cream or fresh pizza dough and you can keep your medicines in the refrigerator at proper temperatures.
This is a Bolt IoT integrated temperature monitoring device that not only can show you the temperature inside the fridge, but also can predict the future temperature inside the Fridge. It even can notify you with a SMS or Email if someone opens the door of the fridge.
So, this project has some objectives to complete.
A. Reading the temperature inside the Fridge and predicting future temperature.
B. Sending an email if someone opens the door.
The circuit connection is very basic and easy. The Vcc, Output and Ground pins of the LM35 module are connected to the 5v, A0 and Gnd pins of Bolt IoT module with female-to-male jumper wires. The Bolt IoT module is powered with a normal powerbank or any 5V power supply.
A Bolt Cloud product has to be created. The product should be a input device with GPIO communication interface.
After creating the product, it needs to be linked with the temperature monitoring module. The hardware needs to be configured through the product on Bolt Cloud.Step Three (Writing a code for polynomial regression):
The Bolt product needs to run a code to measure the temperature and also predict the future temperature.
The code for polynomial regression is :
The polynomial regression graph while the module was kept inside the fridge:
The predicted points, no. ploynomial coefficients and frame size has to be decided and set based on circumstantial factors to get the best results.
This data can be further used for creating thresholds such that the temperature never goes beyond the desired upper and lower limits.Step Four (Email alert if temperature is out of Threshold)
Using the prediction graph, we can set threshold values for the temperature.
Now, using a python code, we can fetch the temperature value from the module every 10 seconds and send an email alert if the temperature rises or falls below the threshold values.
The python code is written in a Linux based Digital Ocean Droplet and Mailgun services are used to send the email through API. email_conf.py is a python file that contains Mailgun credentials and Bolt device credentials.
The python code is:
Now, we want to do a Z-score analysis on the data to find out any anomaly in the temperature. Any sudden changes in temperature will result in an anomaly and will send an alert.
For the scenario of the fridge, the device will detect any sudden changes in temperature when the fridge door will be opened and will send an alert, mentioning "Someone opened the fridge door" and will also mention the current temperature value.
The python code for Z-score analysis and sending out alert on email is:
This code takes the value of temperature from the device and sends an email alert to the desired email address whenever someone opens the fridge.
The threshold is being set after studying the data from polynomial regression graph.Result:
The python code collects the temperature value from the temperature monitoring module every 10 seconds and computes a Z-score so that an anomaly can be detected whenever there is an abrupt change in temperature.
When the door of the fridge is opened, an anomaly is detected and an email alert is sent to the desired email address.
Thus, both of the objectives for this particular project are fulfilled.