Yash Dadi
Published

Automated Home Appliance

Designed a system which works as a Automated Home Appliance with BOLT WIFI MODULE which is power saying and even used as Fire alarm

IntermediateFull instructions provided5 hours312
Automated Home Appliance

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Push button
×1
Temperature Sensor
Temperature Sensor
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Buzzer
Buzzer
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Vmware Ubuntu server
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Code

Automated Home Appliances

Python
import config
import json, time, math
from boltiot import Bolt, Sms

mybolt = Bolt(config.BOLT_API, config.BOLT_ID)
sms = Sms(config.SID, config.AUTH_TOKEN, config.TO_NUM, config.FROM_NUM)
on = 1
off = 0
max_temp = 200
min_temp = 100
threshold = 250
def smart_home_mode():
    while True:
        response = mybolt.digitalRead('4')
        data = json.loads(response)
        print("status is" + str(data['value']))
        try:
            status = int(data['value'])
            if status == on:
                response = sms.send_sms("Smart home mode on")
                time.sleep(5)
                print("reading lm35 sensor value")
                response1 = mybolt.analogRead('A0')
                time.sleep(10)
                data = json.loads(response1)
                print("temperature is" + str(data['value']))
                temp_value = int(data['value'])
                
                if temp_value <= max_temp and temp > min_temp:
                    print("making request to twilio to send sms")
                    response2 = sms.send_sms("Room temperature is too hot" + str(temp_value) + "switching ON AC")
                    mybolt.digitalWrite('3','HIGH')
                    print("status of sms at twilio is: " + str(response2.status))
                elif temp_value <=  min_temp:
                    print("making request to twilio to send sms")
                    response3 = sms.send_sms("Room temperature is too cool" + str(temp_value) + "switching OFF AC")
                    mybolt.digitalWrite('3','LOW')
                    print("status of sms at twilio is: " + str(response3.status))
                elif temp_value >= threshold:
                    print("making request to twilio to send sms")
                    response4 = sms.send_sms("FIRE ALERT!!!")
                    mybolt.digitalWrite('3',''LOW')
                    mybolt.digitalWrite('2','HIGH')
                    mybolt.digitalWrite('1','HIGH')
                    time.sleep(5)
                    mybolt.digitalWrite('2','LOW')
                    mybolt.digitalWrite('1','LOW')
                    print("status of sms at twilio is: " + str(response4.status))
            if status == off:
                response = sms.send_sms("Smart Home Mode OFF")
            time.sleep(10)
        except Exception as e:
            print("Error occured while enabling smart home mode")
            print(e)
            time.sleep(10)
smart_home_mode()         

Credits

Yash Dadi

Yash Dadi

1 project • 0 followers

Comments