Khudabaksh•yk _6
Published © MIT

Smart Light City & UG Cable Temperature Monitoring System

This Project can Control the City Light System and Monitor the UG Cable Temperature Smartly Over the Internet using Bolt IoT.

IntermediateFull instructions provided2 hours208
Smart Light City & UG Cable Temperature Monitoring System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LED (generic)
LED (generic)
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Gravity: Analog LM35 Temperature Sensor For Arduino
DFRobot Gravity: Analog LM35 Temperature Sensor For Arduino
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor, 300 ohm
Resistor, 300 ohm
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT Android App
Bolt IoT Android App
Linux Oracle Virtual Box Software
Snappy Ubuntu Core
Snappy Ubuntu Core

Story

Read more

Schematics

BLOCK DIAGRAM OF PROJECT

Block Diagram of the Project

PIN Diagram for Light Controlling

Pin Diagram for Light Controlling Project

PIN Diagram for Temperature Monitoring

Pin Diagram For Temperature Monitoring

Code

Conf_light

Python
Configuration file for Light Controlling
SID = "ACbd37ff2f1db29bc0c08faff2383666b5"
AUTH_TOKEN = "f15ee60f368502b2b82ce0e776f21bec"
FROM_NUMBER = "+19048440611"
TO_NUMBER = "+917829136202"
API_KEY = "c31407d6-51db-4435-ba78-8e8ac9eda511"
DEVICE_ID = "BOLT13167236"

Light_sms.py

Python
Program for light controlling Working
import conf, json, time, math, statistics
from boltiot import Sms, Bolt
def compute_bounds(history_data,frame_size,factor):
     if len(history_data)<frame_size:
         return None
     if len(history_data)>frame_size:
         del history_data[0:len(history_data)-frame_size]
     Mn=statistics.mean(history_data)
     Variance=0
     for data in history_data :
         Variance += math.pow((data-Mn),2)
     Zn = factor*math.sqrt(Variance/frame_size)
     High_bound=history_data[frame_size-1]+Zn
     Low_bound=history_data[frame_size-1]-Zn
     return[High_bound, Low_bound]

mybolt = Bolt(conf.API_KEY,conf.DEVICE_ID)
sms=Sms(conf.SSID, conf.AUTH_TOKEN, conf.TO_WHATSAPP, conf.FROM_WHATSAPP)
history_data=[]

while True:
     response =mybolt.analogRead('A0')
     response1 =mubolt.analogRead('A0')
     data= json.loads(response)
     if data['success']!=1
         print("There was an Error while retriving the data.")
         print("This is the Error:"+data['value'])
         time.sleep(10)
         contiue

     print("This is the value"+data['value']
     sensor_value=0
     try:
         sensor_value = int(data['value'])
     except e:
         print("There was an error while parsing the response:",e)
         continue

     bond = compute_bounds(history_data, conf.FRAME_SIZE, conf.MUL_FACTOR)
     if not bound:
         required_data_count = conf.FRAME_SIZE-len(history_data)
         print("Not enough data to compute Z-core. Need", required_data_count,"more data points")
         history_data.append(int(data['value']))
         time.sleep(10)
         continue

     try:
         if sensor_value > bound[0]:
              print("The light level increased suddenly. Sending an SMS.")
              response = sms.send_sms("The lights are turned ON")
              response1 = sms_whatsapp.send_sms("The Lights are Turned ON")
              print("This is the response for sms", response)
              print("This is the response for whatsapp", response1)
         elif sensor_value<bound[1]:
              print("The light level decreased suddenly. Sending an SMS.")
              response = sms.send_sms("The lights are turned OFF")
              response1 = sms_whatsapp.send_sms("The Lights are Turned OFF")
              print("This is the response for sms", response)
              print("This is the response for whatsapp", response1)
         history_data.append(sensor_value);
     except Ecxeption as e:
         print("Error",e)
     time.sleep(10)

Conf_temp

Python
Configuration file for Temperature Monitoring
SID = "ACbd37ff2f1db29bc0c08faff2383666b5"
AUTH_TOKEN = "f15ee60f368502b2b82ce0e776f21bec"
FROM_NUMBER = "+19048440611"
TO_NUMBER = "+917829136202"
FROM_WHATSAPP = "whatsapp: +14155238886"
TO-WHATSAPP = "whatsapp: +917829136202"
API_KEY = "c31407d6-51db-4435-ba78-8e8ac9eda511"
DEVICE_ID = "BOLT13167236"
FRAME_SIZE= 3
MUL_FACTOR = 10

Temperature_Sms

Python
Program for Working of Temperature Monitoring
import conf
from boltiot import Sms, Bolt
import json, time

minimum_limit = 32
maximum_limit = 37

mybot = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SSID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)

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'])
         Temprature = (100*sensor_value)/1024
         print("The Current Temprature is : ",Temprature)
         if Temprature > maximum_limit of Temprature < minimum_limit:
              print(" Making Request to Twilio to send a SMS")
              response = sms.send_sms("ALERT: Your underground cable tempratre is not in expected limit, The current temprature sensor value is" +str(Temprature))
              print("Response recieved from Twilio is: " +str(response))
              print("Status of the SMS at Twilio is:" +str(response.status))
     except Exception as e:
         print("Error occured : Below are thw details")
         print(e)
     time.sleep(10)

Credits

Khudabaksh•yk _6

Khudabaksh•yk _6

2 projects • 3 followers

Comments