Skip to main content

NodeMCU WiFi Switch

 Wi-Fi Switch


        In this Tutorial , I will Show you How to Control your Home Appliances by Using Smartphone Over WiFi Connection with NodeMCU ESP8266 Board and Relay(Electric Switch). You can watch this Video or read the following Blog for more Details...


Required Components :

  • After Building the Circuit , Connect USB Cable into NodeMCU ESP8266 Board.
  • Open Fauceter_WiFi_Switch.ino file with Your Arduino IDE.
  • Then Select Board and Port to Upload the Code.
  • After Dumping the code into NodeMCU Board, You can use 5V Charger to Power the Board.
  • Next download and install Fauceter WiFi Switch Controller Application on your Android to Control it. 
  • That's Solve !

Controller Application : 

    Download and Install this App for Controll the Appliances.

Arduino Code :

//21 AUGUST 2020
//WIFI SWITCH WITH NODEMCU
//BY PRADEEP RAJ (M.P.R)
//OPE SOURCE CODE FOR 'THE FAUCETER' SUBSCRIBERS



#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

IPAddress ip(192,143,4,3);
IPAddress netmask(255,255,255,0);
ESP8266WebServer server (8080);

const char* ssid = "Fauceter WiFi Controller";

int S1 = 16; //D0
int S2 = 5 ; //D1
int S3 = 4 ; //D2
int S4 = 14; //D5
int S5 = 12; //D6

void setup() {
  pinMode(S1,OUTPUT);
  pinMode(S2,OUTPUT);

  WiFi.mode(WIFI_AP);
  WiFi.softAPConfig(ip,ip,netmask);
  WiFi.softAP(ssid);

  server.on("/switch",HTTP_GET,Switch);
  server.onNotFound(NotConnected);
  Serial.begin(115200);
  server.begin();
}

void loop() {
  server.handleClient();
  Serial.println("-----------");
  Serial.println("WiFi Connected");
  Serial.println("NODE MCU Local IP Address ");
  Serial.print(WiFi.localIP());
  
}

void Switch()  {
  if (!server.hasArg("con"))  {
    server.send(404,"text / plain","ERROR !");
    return;
  }
  
  String condition = server.arg("con");

  if (condition.equals("S1ON")) {
    digitalWrite(S1 , HIGH);
    server.send(500,"text / plain","Condition : Switch1ON //D0");
  }
  else if (condition.equals("S1OFF"))  {
    digitalWrite(S1 , LOW);
    server.send(500,"text / plain","Condition : Switch1OFF //D0");
  }
  else if (condition.equals("S2ON"))  {
    digitalWrite(S2 , HIGH);
    server.send(500,"text / plain","Condition : Switch2ON //D1");
  }
  else if (condition.equals("S2OFF")) {
    digitalWrite(S2 , LOW);
    server.send(500,"text / plain","Condition : Switch2OFF //D1");
  }
  else if (condition.equals("S3ON"))  {
    digitalWrite(S3 , HIGH);
    server.send(500,"text / plain","Condition : Switch3ON //D2");
  }
  else if (condition.equals("S3OFF")) {
    digitalWrite(S3 , LOW);
    server.send(500,"text / plain","Condition : Switch3OFF //D2");
  }
  else if (condition.equals("S4ON"))  {
    digitalWrite(S4 , HIGH);
    server.send(500,"text / plain","Condition : Switch4ON //D5");
  }
  else if (condition.equals("S4OFF")) {
    digitalWrite(S4 , LOW);
    server.send(500,"text / plain","Condition : Switch4OFF //D5");
  }
  else if (condition.equals("S5ON"))  {
    digitalWrite(S5 , HIGH);
    server.send(500,"text / plain","Condition : Switch5ON //D6");
  }
  else if (condition.equals("S5OFF")) {
    digitalWrite(S5 , LOW);
    server.send(500,"text / plain","Condition : Switch5OFF //D6");
  }
}

void NotConnected() {
  server.send(404,"text / plain","Device Not Connected");

Click Here to Download

GITHUB Repository

Comments

Popular posts from this blog

Arduino Line Following Car

Line Follower      In this Arduino Tutorial I will Show you How to Make a Line Following Car Using Arduino Uno Board and Some Electronic Components . You can Watch this Video or Read the following blog for more details.. Working Principle :          Line Follower has a basic and necessary Component   IR Sensor which act as Vision. It works on the principle of Black Surface Absorbs all  Wavelengths of Light Rays. Then the IR Sensors mounted infront of the car detects black line and makes a movement based on your code.

Arduino Smart Car

Smart Car          In this Arduino Tutorial I will show You How to make a Smart Car using Arduino Uno Board and other some Electronic Components. You can Watch this Video or Read the Following Blog for more details.

Measuring Distance Using UltraSonic Sensor with Arduino

Measuring Distance     Using Arduino, UltraSonic Sensor & OLED Display                In this Arduino Tutorial , I will show you How to Measure a Distance of an Object Using Arduino , UltraSonic Sensor & OLED Display . You can watch this Video or Read the following Blogs for More Details.

NodeMCU WiFi Car

 WiFi Car    In this Tutorial I will Show you How to Make a WiFi Car Using NodeMCU ESP8266 Board and Some Electronic Components . You can Watch this Video or Read the following blog for more details..

N95 Respirator Mask

N95

Arduino Object Following Robot

Object Following Robot     Watch the entire DIY Video of making (J.A.O.F) Arduino Object Following Robot...