Ritwik Deo
Published

Temperature monitoring system (for cold storage)

A system that informs you when the temperature of the cold storage crosses a certain threshold using SMS, LED, and a buzzer

BeginnerFull instructions provided2 hours418
Temperature monitoring system (for cold storage)

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Breadboard (generic)
Breadboard (generic)
×1
Male/Male Jumper Wires
×5
LED (generic)
LED (generic)
×1
Temperature Sensor
Temperature Sensor
×1
Buzzer
Buzzer
×1
Resistor 330 ohm
Resistor 330 ohm
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
SMS Messaging API
Twilio SMS Messaging API
ubuntu
puTTY

Story

Read more

Code

code for temperature alert system

Python
this python code compares the current temperature against the threshold value set
from boltiot import Sms, Bolt  
import json, time

threshold = 150  

API_KEY = 'Bolt Cloud API key'
DEVICE_ID = 'Your device ID'

SID = 'Twilio SID'
AUTH_TOKEN = 'Twilio auth token'
FROM_NUMBER = 'number generated by Twilio on your Twilio Dashboard'
TO_NUMBER = 'your mobile number (including country code)'

mybolt = Bolt(API_KEY, DEVICE_ID) 
sms = Sms(SID, AUTH_TOKEN, TO_NUMBER, FROM_NUMBER) 

while True:   
  print("Reading sensor value")
  response = mybolt.analogRead('A0') 
  data = json.loads(response)         
  sensor_value = int(data['value']) 
  temp = 100 * sensor_value / 1024    
  print(" The sensor value is: " + str(temp))  
  mybolt.digitalWrite(0, 'LOW')  
  mybolt.digitalWrite(1, 'LOW') 
  try:
    sensor_value = int(data['value'])
    if sensor_value > threshold:
      mybolt.digitalWrite(0, 'HIGH')
      mybolt.digitalWrite(1, 'HIGH') 
      print("Making request to Twilio to send an SMS")
      response = sms.send_sms("the temperature value has exceeded the threshold. The current temperature is " + str(temp)) 
      print("Response received from Twilio is: " + str(response))
      print("Status of SMS at Twilio is: " + str(response.status))
  except Exception as e:
    print("Error occured: Below are the details")
    print(e)
  time.sleep(10)  

Credits

Ritwik Deo

Ritwik Deo

1 project • 0 followers

Comments