Till now I have made several tutorial videos regarding controlling appliances over internet. And for that I always preferred Adafruit MQTT server as it was easy to use and user friendly also. But all that thing were based on internet. That means we can control appliances only when we have proper internet connection otherwise that wont work at all. So this time, I came up with Home automation based on Local MQTT server in which we can control appliances without any need of internet. All the appliances will be connected to single network and we can easily control them using our smart phone app.

We can also measure the data of various sensors attached on our pcb. So let’s see how it works and how to make it.

 

Components required
  1. Raspberry Pi 3B board
  2. SD card
  3. Nodemcu Board
  4. 4 x 5V Relays
  5. DHT11 sensor
  6. 4 x BC547 transistors
  7. 4 x 1n4007 diode
  8. 4 x 330 ohm resistor
  9. 7805 IC
  10. 9v Power Adapter
  11. DC power socket
  12. 2 pin Green Connectors
Circuit Diagram

Installing Mosquitto MQTT Broker on Rpi

First of all, download the latest version of raspbian jessie from raspberry pi’s official website. Before installing the image, first of all format the SD card with the app, SD card formatter.

Then load the image into the SD card with the help of the software called Etcher.

After you successfully boot the image into the card start up the device, connect it with internet through wifi. Open up the terminal and enter these commands one by one,

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install mosquitto

sudo apt-get install mosquitto-clients

After doing this, you’ll be able to use your Pi as an MQTT broker.

NodeMCU as MQTT client

In this project, I’m using NodeMCU as a controller which has MQTT client code uploaded on it. Code for this project is uploaded on my GitHub account. For using that code, you need to have the Adafruit MQTT Library and DHT11 library installed on your system.

The only change you need to do inside the code is that, first you need to enter the WiFi credentials in it. Then you need to enter the local ip address of you raspberry pi board acting as a MQTT server. To get the IP address of your Raspberry Pi board, open up the terminal and enter the command ifconfigand press enter.

The code for NodeMCU board is uploaded on my GitHub account. So you can easily download and use that code for your project.

Tutorial Video

I have made a full tutorial video in which I have cover each and every part of this project. I have also shown how to configure that MQTT dashboard android application. So kindly watch out this video.

 

 

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *