Nikhil Agarwal
Published

"Save Electricity" by Limiting the use of your AC

This project helps us to read the room's temperature and suggests whether to switch on or off the air conditioner to save electricity.

BeginnerFull instructions provided1 hour250
"Save Electricity" by Limiting the use of your AC

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LED (generic)
LED (generic)
×1
Temperature Sensor
Temperature Sensor
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×3

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

Power Saver

Code

Code

Python
Also make a conf.py file with the details of the SID, AUTH_TAKEN, TO_NUMBER and FROM_NUMBER from your TWILIO , API_KEY and DEVICE_ID of your bolt iot cloud
import conf
from boltiot import Sms, Bolt
import json, time

minimum_limit = 16
maximum_limit = 32 


mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SID, 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:
        response= mybolt.digitalWrite('2', 'LOW')
        sensor_value = int(data['value'])
        temperature = int((100*sensor_value)/1024)
        if temperature>=maximum_limit:
            response= mybolt.digitalWrite('1', 'LOW')
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("The room is too hot, switch on the air conditioner")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
        elif temperature<=minimum_limit:
            response= mybolt.digitalWrite('1', 'LOW')
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("The temperature is low. Please switch off your air conditioner(if it is on)")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
        else:
            response = mybolt.digitalWrite('1', 'HIGH')
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(10)

Credits

Nikhil Agarwal
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.