Introduction: Connect ESP8266 to the WIFI Network

About: someone who likes electronics

In the previous article I discussed how to make ESP8266 an Access point.

And in this article, I will show you how to connect ESP8266 to a wifi network (making ESP8266 as a client).

Before proceeding to the tutorial, make sure you have added the ESP8266 Board to the Arduino IDE. If not, it will be useless for you to follow this tutorial. To add the ESP8266 board to the Arduino IDE see in this article "Get Started With ESP8266 (NodeMCU Lolin V3)"

Step 1: Required Components

this is the component that you need in this tutorial:

Step 2: Programming

After you add the ESP8266 board to the Arduino IDE. there will be additional sample programs specifically for ESP8266 that can be used. To connect ESP8266 to a WiFi network. That means we will change the EPS8266 mode to become a WiFi client. this is the way:

  • Open the Arduino IDE
  • Click file> Examples> ESP8266WiFi> WiFi Client
  • Adjust the following code with the data you have
#define STASSID "your-ssid"                 //the name of the wifi to be used

#define STAPSK  "your-password"        //password

After that, upload the sketch to the ESP8266 board. And wait until it's finished.

Step 3: Result

After the sketch is finished uploading. The following is a way to see the results:

  • Open the serial monitor
  • Click reset on the ESP8266 Board
  • If successfully connected, the result will look like Figure 1
  • If it is not successfully connected, the result will not be like Figure 1