gowtham1 mavuri
Published © GPL3+

Pharmaceutical temperature maintenance

Notifies when the medicine storage device temperature falls or raises than the specifies boundary limits.

BeginnerFull instructions provided3 hours257
Pharmaceutical temperature maintenance

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LM35 temperature sensor for bolt
×1

Software apps and online services

Snappy Ubuntu Core
Snappy Ubuntu Core

Story

Read more

Schematics

LM35 temperature sensor

Hold it as the letters visible to you.

bolt wifi module

connecting as mentioned in hardware connections

Code

code to notify when temperature crosses specified range

Python
import conf
from boltiot import Email, Bolt
import json, time

min_lim = 300 #the minimum threshold of light value 
max_lim = 600 #the maximum threshold of light value 


mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
mailer = Email(conf.MAILGUN_API_KEY, conf.SANDBOX_URL,conf.SENDER_EMAIL, conf.RECIPIENT_EMAIL)


while True: 
    print ("Reading sensor value")
    response = mybolt.analogRead('A0') 
    data = json.loads(response) 
    print ("Sensor value is: " + str((int(data['value'])/10.24)))
    try: 
        temp=(int(data['value'])/10.24)
        if temp > max_lim or temp < min_lim:
            print("Making request to Mailgun to send an email")
            response = mailer.send_email("Alert", "The Current temperature is " +str(temp))
            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(20)

Credits

gowtham1 mavuri
1 project • 0 followers

Comments