Arduino esp8266 wifi Home/Office Automation System

(Last Updated On: February 5, 2022)



ESP8266 Arduino- In this tutorial, you will learn how to make your own ESP8266 wifi module based Home/ Office automation Project along with a feedback system using an application on your android cell phone. This project is based on the famous ESP8266 wifi module. With the help of this project the electrical loads AC/Dc can be controlled using your android cell phone.  All the commands are processed by the Arduino Uno.

As you know any program which is written for the Arduino Uno can also Run on the Mega. So the program written for this project will also work on the Arduino Mega.  To use this project you will need to connect your ESP8266 Wifi module and cell phone with the same WIFI network. This is actually an offline automation system. This project can be used at homes, offices, colleges, universities, and so on.

For the Worldwide control system, I recommend you should use the Nodemcu ESP8266 Wifi Module because the use of the Nodemcu ESP8266 Module is very simple, you don’t have to update the firmware, the coding is very simple.

Nodemcu ESP8266 based Home/Office Automation System.

You can also use the ESP32 Module, its use is just like the Nodemcu ESP8266 Wifi Module. You can add multiple analog sensors and you can also add digital sensors. I have also developed the home automation system using the ESP32 Module, i recommend you should read this article “ESP32 Home Automation Project, ESPRESSIF Home Automation”

This Tutorial covers.

esp8266 wifi module software/firmware update

use of at commands

complete project circuit diagram

interfacing ESP8266 with Arduino

Arduino ESP8266 programming and finally

Testing the Home/Office Automation project.

For the firmware update, you can watch a video given at the end of this Article.

Without any further delay, let’s get started!!!

Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

esp8266 wifi module:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

ESP8266 with Arduino Circuit Diagram:


The ESP8266 WIFI module Tx pin is connected with the Arduino’s pin number 2. The ch_pd pin of the ESP8266 WIFI module is connected with the Arduino’s pin number 3.3 volt. The RST pin of the wifi module is left unconnected. The VCC pin of the ESP8266 WIFI module is connected with the 3.3-volt pin of the Arduino Uno. The Ground pin of the ESP8266 WIFI module is connected with the Arduino’s Ground. The Rx pin of the wifi module is connected with pin number 3 of the Arduino Uno, while the GPIO 1 and GPIO 0 are not connected.

4 relays are connected with the Arduino pins 9 to 13. If you want you can increase or decrease the number of relays. The relays used in this project are of the type SPDT “ these are 12V and 10A relays. As you can see in the circuit diagram a 10k resistor and 2n2222 NPN transistor is connected with each relay. The 10k resistor and 2n2222 makes the driver and is used to operate this relay. Due to the voltage difference, a 12v relay cannot be directly operated by the controller so that’s why we need a driver circuit to control a relay. The Selection of the Transistor entirely depends on the relay coil resistance.

To find the relay coil resistance you will need a multimeter. Set the multimeter on the resistance and connect both the test leads of the digital multimeter with the two legs of the relay which has the coil. After you find the Coil resistance, then the next step is to use ohm’s law

V = I R

Now after putting values in this formula, you can find the Current. now depending on the value of the current calculated, we select a transistor whose collector current is greater than the relay coil current. this is the current needed to energize the relay coil. Select a transistor whose collector is approximately 3 times greater than the calculated value. This way the transistor will never heat up.

I selected 2n2222 NPN transistor and if you check the datasheet of this transistor you will find that its collector current is much greater than the relay coil current, which is best. Moreover the 2n2222 transistors are really cheap and are easily available in every electronics shop.

If you want to control your home or office appliances from remote locations, then I highly recommend you should use Nodemcu ESP8266 wifi module and Blynk Application. I have so many tutorials on Blynk Application and Nodemcu esp8266 wifi module. The use of Nodemcu esp8266 wifi module is really easy as compared to the ESP8266 wifi module.

If you have any questions regarding this project, you can let me know in a comment.


Cell phone application apk file: Wifi

ESP8266 Arduino Programming:

Watch Video Tutorial:

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...


  1. Hi, so thrilled by your tutorial as it helped my understanding things better. Which platform did you use to develop the android app please?

    1. This application is designed in Android studio. I am starting a complete series on how to make android cell phone applications for Arduino Bluetooth. Click the subscribe button and you will be notified. If you want the source code then you can get this for 25 dollars.

  2. Which application you have used to control this circuit by a mobile …..I mean what is the name of the app that you have used

  3. Hello sir i am a student of Electrical technology i making this project but when i connected the CH_PD pin of ( esp 8266 module )
    on Arduino Nano 3.3V pin then my esp 8266 is not work and power led is always off.

  4. Hi, just looking through the code of this project, can you tell me how the “send command” function is working. for example “sendCommand(“AT+RST\r\n”,2000,DEBUG); // reset module”
    is this a specific function of software serial?
    if it is, where did you learn this information and could you direct me to this library commands.
    thanks in advance

  5. UPDATE, sorry, i didn’t see the “send command” function at the very end of the code, looks like clever stuff, gonna have a go this weekend. Been looking for a very long time to see how you actually use the esp as a wireless serial connection, mostly on the internet people are hosting a web page on the actual esp and just switching led on or off, your approach is just the ticket

    1. Salve mi chiamo Cosimo sto cercando di riprodurre il tuo progetto ma non riesco a farlo funzionare. Ma nel esp8266 01 devo caricarli il file flash dawloader se è si dove posso scaricarlo?

  6. Hi There, I done everything according to your instruction but have a bit of a issue. At the end when you go to serial monitor you get the ip address and port no mine does not give me all that detail it just say server ready and nothing else. Can you please help? Also myESP8266 module have no light on Please help.

    1. it may be due to
      1. if you have not installed the Nodemcu esp8266 board.
      2. maybe you are not using the latest version.
      3. or, you are using a different Nodemcu Module.

      watch my getting started tutorial which you can find on my channel Electronic Clinic.

  7. Assalamualikum
    I am a hobbist till now
    After watching your tutorial I selected the bin file and clicked download and it shows connection failed! What could be the reason.

  8. I am a hobbist till now after watching your tutorial I selected bin file and clicked download and it shows connection failed I use ESP8266

Leave a Reply

%d bloggers like this: