In case of specific products like some medicines or vaccines or even ice cream that is kept in a freezer, the refrigerator door must not be opened frequently. This normally drops the temperature in the refrigerator and this, in turn, consumes more power and time to bring back the temperature to normal. Sometimes we accidentally keep the door open and forget about it or even the door might have some obstruction that is not letting the door close. In order to avoid this, we can use this system where we get a notification when the door is kept open for more than the normal time or even if the door is opened. I have made use of Z score analysis to make note of any anomalies in the temperate and send an email to the user saying that the door is left open.
Make all the hardware connections as in the circuit diagram. LM35 IC is a temperature sensor that returns analog data. This returned value is used in computing the temperature. We use these temperature values in the Z Score analysis to fix an upper bound and a lower bound. These values are the threshold values. When the threshold values are crossed it will be taken as an anomaly and that value will be sent as an SMS and an email to the user. We have used Twilio to send the SMS and mailgun to send the email. The user hence will get to know if the door is open and can take suitable actions to close the door.
First, create an account on Twilio and register for SMS service. Also, register for email service on mailgun. You will get a phone number, a SID and an AUTH_TOKEN which you need to note down for using it in the project. On Mailgun, you will be getting an email id along with an API_KEY and a URL that you need to note down.
Enter the details in the conf.py file. Find the code for Z score analysis in the temp_sensor.py file attached below.