Published

Temperature Analyzer

In this project we are measuring the temperature of the environment using temperature Sensor (LM375).

IntermediateFull instructions provided4 hours337

Things used in this project

Hardware components

 Bolt IoT Bolt WiFi Module
×1
 LM375 Sensor
×1
×1
 USB-A to Mini-USB Cable
×1

Software apps and online services

 Twilio SMS Messaging API
 Mailgun
 Bolt IoT Bolt Cloud
 Bolt IoT Android App

Code

Temperature Analyser code

Python
```from boltiot import Bolt ,Sms, Email
import json, time, math, statistics
min=200*0.0977
max=600*0.0977
apikey="49##################################7a"
deviceid="BOLT####"
mybolt=Bolt(apikey,deviceid)
def cbounds(old_data,size factor):
if len(old_data)<size:
return None
if len(old_data)>size:
del _data[0:len(old_data)-size]
mn=statistics.mean(old_data)
var=0;
for d i in old_data:
var=var+math.pow((d-mn),2)
zn=factor*math.sqrt(var/size)
hbound=old_data[size-1]+zn
lbound=old_data[size-1]-zn
return [hbound,lbound]
def message():
res1=sms.send_sms("The Temperature is"+str(sensor_value))
time.sleep(300)
return 0
old_data=[]
c=0
while True:
sensor_value=(int(data[value]))*0.0977
print("the temperature is "+str(sensor_value))
if sensor_value>25 and sensor_value<26:
c=c+1
bound=cbounds(old_data,10,3)
if not bound:
req_size=10-len(old_data)
print("not enough data")
old_data.append(sensoe_value)
time.sleep(10)
continue
try:
if sensor_value>bound[0] or sensor_value<bound[1]:
print("temp out of bound")
print("the door is open")
message()
if c>12:
print("the temperature is betwen 25 and 26 degree celcius for more than 20 minutes")
message()
c=0
except Exception as e:
print("Error",e)
time.sleep(10)

```

Credits

Gaurav Mittal

1 project • 1 follower