loading

Home automation is a new buzz now a days ..there is so many open source hardware available to build your own home automation. So many tools, its easy to confuse you to decide which is best /suitable for you. Keeping cost in mind and the basic requirement in mind you can find the best and cost effective solution in this instructable to get started with your first automation project.

Introduction to tools used in this instructable:



Target:
Target of this instruct able is to control your home appliance by your android phone.

When the you pews the button in your phone light or fan in your home turns on or off.

Step 1: Tools

MQTT protocol:

in a simple language when you want to communicate to your controller through mobile or a web browser you need a communication protocol and MQTT does that magic. MQTT is a message queuing telemetry transport. It is specifically designed for automation. So where does it do magic?? its a light weight protocol, what is light weight means?? Well it's having a very low footprint to send and receive data. So it uses very less amount of data to send and receive and mobile app using MQTT also consumes less battery.
So MQTT is the best for This project.

There is a lot more info at MQTT. org for those who already familiar with MQTT can skip following peragraph, for biginers read for MQTT introduction.

MQTT works on publish subscribe events. It requires MQTT broker in between. Forgot all these thing I explains MQTT with our example.
When you press the switch in your mobile or any web device you are telling your controller that you want to turn on the switch. Now as in MQTT protocol MQTT broker seats in between your mobile device and controller. Broker take care of successfully transfer your command to the controller. this is the basic. MQTT is very vast subject. To learn more about MQTT visit MQTT.org

Step 2: Mobile App.

Download the android mobile app attached here. and install in your mobile.

Go to MQTT Setting Tab and add your broker name and Port.

It require a web socket so enter the web socket port of your broker. For test.mosquitto.org web socket enabled port is 8080.

Step 3: Mobile App Configuration

Open App in your mobile and

1. Go to device setting.

2. Select new device.(when you do configuration 1st time only new device option is available).

3. Device name: you can give any name for your device in my case its lamp.

4. Device type: switch(leave as it is).

5. Topic: give topic for MQTT.

6. On command: This payload will be send when switch turn on.

7. Off command: This pay load will be send when you toggle switch to off.

8. Pess DONE button.

9. Go to Dashboard. you can see your device is generated.

10. follow all step for FAN configuration.

Step 4: Test Configuation

For testing configuration many tools are available but i prefer MQTTlens. It a chrome addon.

Go to https://chrome.google.com/webstore/detail/mqttlens/hemojaaeigabkbcookmlgmdigohjobjm?hl=en

- launch MQTTlens.

Add connection

connection name: any

Host name:test.mosquitto.org

port:1883

save detail

Subscribe with the topic you inserted in device setting.

toggle switch in your mobile you can see response in MQTTlens.

Step 5: Hardware

So software part is over here. Hardware is the most common and so many instructables are available. If you interested in my HW than leave comment. I will explain. But trust me lot of material out there to build NodeMcu based hardware.

Hi, very nice project. <br>Where could i have access to the app code sorce? I would like to add and change commands, is it possible? <br>Thanks
<p>what changes you need to do??</p><p>have u done any work on that??</p>
<p>Hi,<br>Great post.<br>This is a request for guidance.<br>My<br> ESP8266 module connects to &ldquo;test.mosquitto.org&rdquo; and subscribes to a <br>topic say &ldquo;b1&rdquo;. What ever is published to &ldquo;b1&rdquo;, it can read it <br>immediately.<br>Problem happens when my second ESP8266 module subscribes to &ldquo;test.mosquitto.org&rdquo; to &ldquo;b1&rdquo;. It continuously returns :</p><p>WiFi connected<br>IP address:<br>192.168.0.9<br>Attempting MQTT connection&hellip;connected<br>Message arrived [b1] 0<br>Attempting MQTT connection&hellip;connected<br>Message arrived [b1] 0<br>Attempting MQTT connection&hellip;connected<br>Message arrived [b1] 0<br>Attempting MQTT connection&hellip;connected</p><p>Could you kindly suggest what might be going wrong. I look forward to your advice.</p>
<p>Sorry guys, i was not able to be in touch with this instructable. R u still facing the problem??</p><p>please let me know..</p>
<p>Hello Vorav, thank you for sharing your project. </p><p>My project is very similar, but I don't know which components use in my electronic circuit, I saw in your sketch that probably you used an opto and a TRIAC, correct? Can you share this part of your project? Many thanks!</p>
<p>Welcome to Instructables. Thanks for sharing with the community.</p>

About This Instructable

11,576views

36favorites

License:

More by vorav:Home Automation Home automation using MQTT and NodeMcu or arduino 
Add instructable to: