Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Akash Arun
Published © GPL3+

Cold Storage Temperature Monitoring

The user is alerted through SMS alerts; LED and buzzer alarm is set off when temperature threshold is crossed

BeginnerFull instructions provided2 hours359
Cold Storage Temperature Monitoring

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Breadboard (generic)
Breadboard (generic)
×1
LED, Orange
LED, Orange
×1
Buzzer
Buzzer
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Male/Male Jumper Wires
×5
Temperature Sensor
Temperature Sensor
×1
Copper Wire
×1
Wire cutter and stripper
×1

Software apps and online services

Bolt IoT Android App
Bolt IoT Android App
Ubuntu
VMware Workstation 15 Player

Story

Read more

Schematics

Cold Storage Temperature Monitoring Breadboard Circuit

The circuit for the Cold Storage Temperature Monitoring system

Code

Temperature Alert

Python
This is the Python script you run on your PC to check the temperature against a threshold and send SMS alerts.
import boltiot from Sms, Bolt  #Import Sms and Bolt class from boltiot library
import json, time  #Import json library to handle JSON objects and import time library 

threshold = 102   #store threshold value (approximately 10 degree celcius)

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

# Credentials required to send SMS
SID = 'Your Twilio SID'
AUTH_TOKEN = 'Your Twilio auth token'
FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = 'This is your number. Make sure you are adding country code in the beginning'

mybolt = Bolt(API_KEY, DEVICE_ID) #Create object to fetch data
sms = Sms(SID, AUTH_TOKEN, TO_NUMBER, FROM_NUMBER) #Create object to send SMS

while True:   #Continuously monitor the temperature
  print("Reading sensor value")
  response = mybolt.analogRead('A0') #Read input from LM35 at A0 pin
  data = json.loads(response)        #load the JSON data sent by the cloud 
  sensor_value = int(data['value']) #store current temperature value in variable 
  temp = 100 * sensor_value / 1024    #covert into degree celcius
  print("Sensor value is: " + str(temp))  #print current temperature value
  mybolt.digitalWrite(0, 'LOW')  #Turn OFF LED connected at pin 0
  mybolt.digitalWrite(1, 'LOW') #Turn OFF buzzer at pin 1 
  try:
    sensor_value = int(data['value])
    if sensor_value > threshold: #checks if threshold has been crossed
      mybolt.digitalWrite(0, 'HIGH') #Turn ON LED at pin 0
      mybolt.digitalWrite(1, 'HIGH') #Turn ON buzzer at pin 1
      print("Making request to Twilio to send an SMS")
      response = sms.send_sms("ALERT! The temperature threshold has been exceeded! The current temperature is " + str(temp)) #Send SMS alert to operator
      print("Response received from Twilio is: " + str(response))#response from Twilio will be stored inside the `response` variable
      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)  #Wait for 10 seconds

Credits

Akash Arun
1 project • 0 followers

Comments