Introduction: How to Make WiFi Switch Using ESP8266

About: someone who likes electronics

In this tutorial I will show you how to make a wirelles switch using ESP8266. the communication media that I will use is a WiFi network.

In the previous tutorial I discussed about using ESP8266 to communicate using a WiFi network. You can read this article first to add insight into the working modes of ESP8266 for communicating via WiFi networks.

Step 1: Required Component

The components you need for this tutorial:

Step 2: Assemble All Components

The picture above is the circuit scheme that will be used.

In this tutorial I used Pin D0 as Output.

Step 3: Programming

For this tutorial I will use Wifi Station Mode on ESP8266. With this mode, we can make Wirelless Switch without using internet networks. But the switch can only be used on the local network between Mobile and ESP8266.

I have provided a Sketch that you can download below.

Before uploading a sketch to NodeMCU. Make sure the NodeMCU board has been added in the Arduino IDE. If you haven't already you can see the way in this atikel "Get Started With ESP8266 (NodeMCU Lolin V3)"

Step 4: Access Webpage

Here is how to operate this wireless switch:

After Sketch uploaded successfully

  • Open the Wifi menu on the android phone
  • Connect an android phone to SSID "NodeMCU"
  • Open Serial Monitor on Arduino
  • See the IP address displayed
  • Open the browser on an android phone
  • Enter the IP address on the monitor serial (192.168.4.1)

  • Then a web page will appear to control the LED

Step 5: Result

To turn on the LED, press the "on" button

To turn off the LED, press the "off" button