AMAN LAKHANI
Published © GPL3+

Home Automation

Control all your home appliances using mobile app over Internet. The following project uses Bolt WiFi module and a relay.

IntermediateFull instructions provided1 hour1
Home Automation

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Grove - 2-Channel SPDT Relay
Seeed Grove - 2-Channel SPDT Relay
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Firebase
Google Firebase

Story

Read more

Custom parts and enclosures

Demo Video

Schematics

Circuit Connections

Connect 5V pin of Bolt module to Vcc Pin of Relay.
Connect GND of Bolt to GND of Relay.
Connect any Digital I/O of Bolt to Output Pin of Relay.

Code

Code for Controlling the relay over Cloud

Python
WARNING:- You may need to buy Bolt Cloud Pro Plan for the project as it hits Cloud number of times, or consider adding sleep function to delay cloud hits.

Also I'm using Active Low Relay, change your code according to the type of relay you have.
Set "HIGH" if result["cfl"] > "1" else "LOW"
and similarly other constraints.

Also here cfl and fan are the two constraints that I declared in my firebase database add or remove the parameters according to your requirements.
from boltiot import Bolt
from firebase import firebase

mybolt = Bolt("Your API KEY", "Your Device ID")
firebase = firebase.FirebaseApplication("https://yourdatabasename.firebaseio.com", None)

prevcfl = 0
prevfan = 0


while True:
    result = firebase.get("your bucket name", "")
    print(result["cfl"])
    if(type("") == type(prevcfl)):
        mybolt.digitalWrite(0, "HIGH" if result["cfl"] > "0" else "LOW")
        mybolt.digitalWrite(1, "HIGH" if result["fan"] > "0" else "LOW")
        prevcfl = result["cfl"]
        prevfan = result["fan"]
    if(result["cfl"] != prevcfl):
        mybolt.digitalWrite(0, "HIGH" if result["cfl"] > "0" else "LOW")
        prevcfl = result["cfl"]
    if(result["fan"] != prevfan):
        mybolt.digitalWrite(1, "HIGH" if result["fan"] > "0" else "LOW")
        prevfan = result["fan"]

Credits

AMAN LAKHANI

AMAN LAKHANI

0 projects • 0 followers

Comments

Add projectSign up / Login