STORY
1. INTRODUCTIONNow a days there is many technology in the field of computer science and engineering. But I choose the Internet of Things and Machine Learning for my this project using the Bolt Wifi module. This project uses the concept of Z-score analysis of machine learning concept for anomalies detection.
This project has primarily two function :
- Measure the temperature of surroundings
- Send a message when the temperature get excessively high i.e, "WHEN SOMEONE OPENED THE DOOR OF FRIDGE".
This project is used in a place where temperature is to be maintained within a definite limit.
1. In manufacturing of medicines at Pharmaceutical companies
2. Many food factories
3. In Server Rooms.
to find the variation of temperature in the working atmosphere.
3. DEMONSTRATION4. OBJECTIVEA. Build the circuit for temperature monitoring system, using the Bolt and LM35 sensor. NOTE: You have already learned how to do this in Module 3 of the course, you can repeat the circuit connection for the system.
B. Create a product on the Bolt Cloud, to monitor the data from the LM35, and link it to your Bolt.
C. Write the product code, required to run the polynomial regression algorithm on the data sent by the Bolt.
D. Keep the temperature monitoring circuit inside your fridge with the door of the fridge closed, and let the system record the temperature readings for about 2 hours.
E. Using the reading that you received in the 2 hours, set boundaries for the temperature within the fridge.
import json
import time
from boltiot import Bolt, Email
from src.temp_alert_mail import email_conf
minimum_limit = 50 #minimum
maximum_limit = 100 #maximum
mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID)
mailer = Email(email_conf.MAILGUN_API_KEY, email_conf.SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL)
while True:
print("Reading sensor value")
response = mybolt.analogRead('A0')
data = json.loads(response)
print("Sensor value is: " + str(data['value']))
try:
sensor_value = int(data['value'])
if sensor_value > maximum_limit or sensor_value < minimum_limit:
print("Making request to Mailgun to send an email")
response = mailer.send_email("Alert", "The Current temperature sensor value is " + str(sensor_value))
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text['message']))
except Exception as e:
print("Error occured: Below are the details")
print(e)
time.sleep(10)
F. Write a python code which will fetch the temperature data, every 10 seconds, and send out an email alert, if the temperature goes beyond the temperature thresholds you decided on in objective "E".
G. Modify the python code, to also do a Z-score analysis and print the line “Someone has opened the fridge door” when an anomaly is detected.
H. Tune the Z-score analysis code, such that, it detects an anomaly when someone opens the door of the fridge.
Comments