+91-7834999925       contact@tacthub.in

Home Automation Using ESP8266 Wi-Fi Module Without Internet

Wi-Fi module allows the wireless communication between arduino and our mobile which can be used to develop the home automation system to control the home appliances with a cell phone.

Hardware Required

 

  • Arduino Uno
  • ESP8266 wifi module
  • 4 channel relay
  • Jumper wire

 

Software Required

  • Arduino IDE
  • Socket Control Widget App


Connections

  • ESP Tx to Arduino Rx
  • ESP Rx to Arduino Tx
  • ESP 3.3v to Arduino 3.3v
  • ESP GND to Arduino GND
  • Relay IN1 to Arduino A0
  • Relay IN2 to Arduino A1
  • Relay IN3 to Arduino A2
  • Relay IN4 to Arduino A3

 

 

Code

  • Main loop of code

 

void loop()

{

// receive data from ESP8266 //

if(Serial.available())

{

MY_DATA1[k1] = Serial.read(); 

CC1 = MY_DATA1[k1];

if(CC1 == ':')D = k1;

k1++;

if(CC1 == ' '){k1=0;RX1 = 1;} 

}

if(RX1 == 1)

{

if(MY_DATA1[D] == ':')

{

MY_DATA1[D] = '0';

if(MY_DATA1[D+1] == 'F')

{

MY_DATA1[D+1] = '0';

 

if(MY_DATA1[D+2] == 'A')//switch 1 on

{

MY_DATA1[D+2] = '0';

 

digitalWrite(A0,LOW);

RX1 = 0;

}

else if(MY_DATA1[D+2] == 'B')//switch 1 off

{

MY_DATA1[D+2] = '0';

digitalWrite(A0,HIGH);

RX1 = 0;

}

else if(MY_DATA1[D+2] == 'C')//switch 2 on

{

MY_DATA1[D+2] = '0';

digitalWrite(A1,LOW);

RX1 = 0;

}

else if(MY_DATA1[D+2] == 'D')//switch 1 off

{

MY_DATA1[D+2] = '0';

digitalWrite(A1,HIGH);

RX1 = 0;

}

else if(MY_DATA1[D+2] == 'E')//switch 3 on

{

MY_DATA1[D+2] = '0';

digitalWrite(A2,LOW);

RX1 = 0;

          }

else if(MY_DATA1[D+2] == 'F')//switch 1 off

{

MY_DATA1[D+2] = '0';

digitalWrite(A2,HIGH);

RX1 = 0;

}

else if(MY_DATA1[D+2] == 'G')//switch 1 on

{

MY_DATA1[D+2] = '0';

digitalWrite(A3,LOW);

RX1 = 0;

}

else if(MY_DATA1[D+2] == 'H')//switch 1 off

{

MY_DATA1[D+2] = '0';

digitalWrite(A3,HIGH);

RX1 = 0;

}

     }

}

RX1 = 0;

}

}

void ESP8266_INIT()// initializing wi-fi module.

{

Serial.println("AT");// check AT mode.

delay(1000);

Serial.println("AT+RST");//RESET module.

delay(3000);

Serial.println("AT+CWSAP="Home Automation","2231anto",3,2");//set the ssid and password.

 delay(1500);

Serial.println("AT+CWMODE=3");// set ESP8266 in MODE 3 (Both mode AP+station).

delay(1400);

Serial.println("AT+CIPMUX=1");// set ESP8266 in MUX 1 (allow multiple connection).

delay(1400);

Serial.println("AT+CIPSERVER=1,80");// start communication ESP8266 on PORT80.

delay(1500);

}

Price: 7000 INR

Buy Now