Jack Richer
Created January 5, 2021

Temperature Monitoring System

We can monitor temperature of any big companies.

8
Temperature Monitoring System

Things used in this project

Story

Read more

Custom parts and enclosures

Temperature Monitoring System

Final Report of Project includes Python Code, JS code and other information about Temperature Monitoring System.

Schematics

Bolt Device

Outcome

Code

email_conf.py

Python
Code for email configuration.
MAILGUN_API_KEY = xxxxxxxxx' 
SANDBOX_URL= 'sandboxxxxxxxxxx.mailgun.org' 
SENDER_EMAIL = 'test@ sandboxxxxxxxxxx.mailgun.org'
RECIPIENT_EMAIL = jackricherr007@gmail.com
API_KEY = xxxxxxxxxx
DEVICE_ID = 'BOLTxxxxxx'

Code for polynomial regression algorithm :

JavaScript
setChartLibrary('google-chart');
setChartTitle('Polynomial Regression');
setChartType('predictionGraph');
setAxisName('time_stamp','temp');
mul(0.0977);
plotChart('time_stamp','temp');

temp_email.py

Python
Code for temp_email
import email_conf
from boltiot import Email, Bolt
import json, time

minimum_limit = 300 #the minimum threshold of light value 
maximum_limit = 600 #the maximum threshold of light value 

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)

Credits

Jack Richer
2 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.