Recently I made a project in which I use Bluetooth module for Home Automation that allows you to control anything from android mobile Bluetooth. In this project, we will create home automation with ESP8266 wifi module same like as in my previous project we were done, but this wifi module no need any parent board like Arduino it has its own memory and controller.
What is ESP8266 WiFi Module?
ESP 8266 is an open source wifi module made by a Chinese company called espressif. The esp8266 module has SOC with integrated TCP/IP protocol that can give access to any controller to your wifi network. Esp8255 has GPIO, I2C, ADC, SPI, PWM and some more pins on it to make IOT things more easy with it over the wifi network. There is some feature of this tiny low-cost module :
- Low power consumption
- It has SOC with integrated TCP/IP stack
- The latest version of ESP8266 has 8Mbit flash
- Can operate -40°C to +125°C
- Low power 32bit processor
- and much more…! 🙂
You can visit ESPRESSIF website for more about ESP8266.
Day by day esp8266 community size growing bigger and there are many projects of esp8266 of IOT available but in this tutorial, we will make wifi controlled relay with ESP8266.
Control anything with ESP8266 WiFi Module
In this tutorial, we will control relays with this tiny low-cost module with the android mobile. you can use it with Arduino or without. in this project, we will use only ESP8266 Module to control relays over a wifi network.
Things you will needs
- ESP8266 WiFI Module(nodeMCU)
- 4 channel relay module or DIY
- OLED display (optional).
- Breadboard with wires.
- 5v adapter
Now wiring up all things as mention in below.
GPIO-14 to Relay 1
GPIO-12 to Relay 2
GPIO-13 to Relay 3
GPIO-15 to Relay 4
GPIO-05 ( SCL ) to OLED pin SCL
GPIO-04 ( SDA ) to OLED pin SDA
why do I add OLED display ? because with OLED display you can see the status of Wifi connection is connected or not and what is the IP address of ESP8266 Module which is connected.
How to Program ESP8266 WiFi Module
For newbies, it is difficult to upload source code on esp8266 because there are some more settings in Arduino IDE to do. There is step by step guide how to upload code to esp8266 with Arduino IDE tool.
- Download latest Arduino IDE from here and install it on PC available for both mac and windows OS. after installing it open IDE tool.
Go to Preferences and add the link as below in the image.1http://arduino.esp8266.com/stable/package_esp8266com_index.json
- after adding URL of the additional board now Go to Board Manager and search esp8266 it will show in board manager and install it.
- when you click on install it starts downloading esp8266 boards it may take some time depend on your connection speed. sit back and relax or eat popcorn 😀
- Now you have ESP8266 in Arduino boards menu to configure. Just select board.
- Now the final step is select the port which you have connected with ESP8266 and you have done!!! 🙂
After adding esp8266 to your Arduino IDE, now you have to upload the source code to esp boards. The source code you can download from below and verify it with IDE .
NOTE: You may require Libraries for this project you can easily find the link to libraries from my other projects OR comment below.
When you have done with wiring and power up all things, now upload the source code to ESP8266 with Arduino IDE latest version.
Now you have to install nicely build an app for esp8266 by Digital2u. Download the app from below button and watch the video how to configure IPs on the app.
I have written many projects on Home Automation. Just search on website with keyword “Home Automation” 🙂
If you have any question regarding this project let me know below in comment box and Share on your wall 🙂