Esp8266 based home automation system using wifi
Esp8266 based home automation system project is designed to control home devices using Wi-Fi through a website or any android app which has internet connection. As you I have already posted a project on Bluetooth based home automation system and gsm based home automation system. Both these embedded system projects have limitation of distance and availability of network. For example in case of hc 05 based project, user should be in pre defined range of Bluetooth, otherwise they will not be able to switch on and switch off their devices and in case of gsm based project, user should have network connection as well as balance available in their sim. I have also posted a project on tv remote control home automation system which again has limitation of distance. Because IR communication range is also limited. But with this Esp8266 based home automation system, you can control your home devices from any corner of world unless your system and you have internet connectivity available.
Esp8266 based home automation system components
Followings are the components used in Esp8266 based home automation system:
- PIC18F452 microcontroller : PIC18F452 microcontroller is used in this Esp8266 based home automation system. Pic microcontroller is used to send commands to ESP8266 and it is received commands from ESP8266. Microcontroller turn on or turn off loads based on received commands from ESP8266 wifi module. pic microcontroller is interfaced with ESP8266 using serial communication. Both ESP8266 and pic microcontroller communicate with each other through serial communication.
- ESP8266 (Wi-Fi module) : This is very cheap and inexpensive wifi module. It works on UART communication and it is very easy to connect this module with internet.
- RELAY Module: Four relays are used in this project to control four loads. you can learn about relay interfacing with microcontroller and how to to use relay driver.
The following project entails the user to connect to various different devices through Wi-Fi thereby functioning them through wireless means. The Wi-Fi module receives a signal wirelessly via a cellphone and then transmits it through its transmitter to the receiver of the microcontroller which in turn interprets the signal and sends a signal to the corresponding port accordingly which are initialized as outputs. A relay is used through relay interfacing for those devices which draw a larger current.
ESP8266 configuration Esp8266 based home automation system
The basic working of the project is as follows:
A USB to serial bus was used to initialize the Wi-Fi module’s initial settings for instance the baud rate was initialized to 9600bps and the CWMODE of the module was set to mode 3.
ESP8266 was initialized via the following commands:
AT+CWMODE = 3
AT+CIPMUX = 1
ESP8266 was then connected to the mobile hotspot by the following commands:
AT+CWLAP (returns the list of the available Wi-Fi networks available)
AT+CWJAP = “SSID”, “password”
Once configured, the module was then connected to the microcontroller based on the above described
Circuitry i.e. the transmitter was connected to the receiver of the microcontroller and the receiver was connected to the transmitter of the micro controller. The module receives a signal wirelessly through a cellphone. It sends a signal in the form of a string of characters to the UART (Universal Asynchronous Receiver Transmitter) terminal of the microcontroller. The string received was then compared to check for which button was pressed through the cell phone by preloaded strings and then sends a high signal to the port bit which corresponds to the string. In this way, a device that is connected to one of the output ports of a microcontroller is turned on and off wirelessly through a Wi-Fi module that is configured at the same IP address as that of the mobile phone.
Basic Concept behind interpreting the signal received at the UART terminal and analyzing it to turn on the specific device:
Every time a signal is received at the UART terminal, it is stored in the form of a string of characters: ‘0 Connect, 0 Closed, 2:1’ for the first key which turns portb.b0 = 1 and similarly for portb.b1 = 1, the string received takes the form of ‘0 Connect, 0 Closed, 2:9’. Following this analyses, the string was compared on for every character which are the same until the third last character ‘2’ is received after which a variable state is set as 1 which in turn sets state = 2 since the next character is ‘:’.Following this the next character received at the UART is the distinguishing character which is compared in the if conditions written above and in this way the corresponding bit of the port is activated.
Circuit diagram of Esp8266 based home automation system using wifi
ESP8266 was connected to the microcontroller according to the above pin configuration. RX was attached to the TX pin of microcontroller which is D6 and the TX pin of ESP8266 was connected to D7 pin of the microcontroller which is the receiver. Ground of the microcontroller and ESP8266 was made common. Since ESP8266 operates at a VCC of 3.3V hence a potential divider was used to draw a voltage of 3.3V by using 3 resistors in series. The remaining pins were then grounded. The receiver of the module was also given a voltage of approx. 2.5-3 V using the same potential divider circuit.
Video demonstration of esp8266 based home automation using wifi
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w