What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To connect an ESP8266 to a Wi-Fi network in an Arduino sketch, include ESP8266WiFi.h, call WiFi.begin(ssid, password), and wait until WiFi.status() returns WL_CONNECTED. Use station mode to join an existing network, softAP mode to host a local network, or AP+STA mode when the device needs both. The ESP8266 Arduino Core’s ESP8266WiFi library provides the controls for those interfaces and their network clients and servers.
Connect an ESP8266 to an existing Wi-Fi network
In station mode, the ESP8266 joins a wireless access point, such as a home router. That connection does not by itself guarantee Internet access; Internet availability depends on the network the access point is connected to.
Install the ESP8266 Arduino Core for your board, then replace the example credentials below with the SSID and password for your network. The core installation guide is at Installing ESP8266 Arduino Core.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →#include <ESP8266WiFi.h>
const char* ssid = "network-name";
const char* password = "pass-to-network";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected; IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
}
The SSID parameter supports up to 32 characters. The documented station password length is 8 to 64 characters; see the Station Class reference for supported WiFi.begin() overloads, including options for a channel and access-point BSSID.
#1 Best Overall
- Not only it is easy to program for this controller by using the CP2102-USB interface,but also unnecessary to press the flash and reset buttons before each flash operation.
- NodeMcu is an open source Lua based firmware for the ESP8266, ultra low cost wireless modules, development boards for rapid prototyping, integrated with ESP8266 chips.
- The ESP8266 has powerful on-board processing and storage capabilities, and can be integrated with sensors and other application-specific devices through its GPIOs.
- It is compatible with Arduino IDE,works great with the latest Mongoose IoT/Micropython.
- Modern Internet development tools can use the built-in API to instantly put your idea on the fast track.
Check status and obtain an address
WiFi.status() reports the station’s connection state. After it reaches WL_CONNECTED, WiFi.localIP() returns the address assigned to the ESP8266 on that network. Connection to the access point is distinct from successful access to a remote Internet service, so applications that depend on a server should handle that service’s availability separately.
The station API also includes isConnected(), RSSI(), waitForConnectResult(), and reconnect(). By default, the core attempts to reconnect automatically after a temporary station disconnection. If you enable automatic reconnection with setAutoReconnect(true) while already disconnected, that setting does not start an immediate attempt; call reconnect() when you want to initiate one.
Rank #2
- This is D1 mini, it is a mini NodeMcu Lua WiFi board based on ESP-8266EX.
- 11 digital input / output pins, all pins with interrupt / PWM / I2C / support 1 line (except D0); 1 analog input(3.2V max input). Micro USB connection; Compatible with Arduino; 1MB Flash; 500mA resettable fuse.
- WIFI development board,4M bytes.5V 1A switching power supply (switching power supply)onboard.
- Our D1 mini development board compatible with Arduino WeMos and can be programmed in the compatible for Arduino IDE.
- ESP8266 ESP-12 ESP-12F NodeMcu Mini D1 Module WeMos Lua 4M Bytes WLAN WiFi Internet Development Board Base on ESP8266 ESP-12F
Choose station, softAP, or AP+STA mode
The Generic Class reference defines four modes: WIFI_OFF, WIFI_STA, WIFI_AP, and WIFI_AP_STA. Choose based on who needs to connect to whom and whether local access must remain available while the ESP8266 joins another network. The Generic Class reference and Soft Access Point Class reference describe these options.
| Mode | Network relationship | Typical use |
|---|---|---|
WIFI_STA |
The ESP8266 joins an existing wireless access point. | Connect a device to a router or other established WLAN. |
WIFI_AP |
The ESP8266 hosts its own local wireless network. | Provide local access or let a phone or laptop configure the device. |
WIFI_AP_STA |
The ESP8266 hosts a local network and joins an upstream access point. | Keep a local setup or access path available while using an existing WLAN. |
Use softAP for local access and onboarding
A soft access point is useful when the device should be reachable locally or when its target network credentials are not known at compile time. A typical onboarding flow is to start the ESP8266’s own network, let a user connect with a phone or computer and provide the target SSID and password, then switch the device to station operation. The ESP8266 softAP has no wired-network interface. The core documentation says its station capacity is configurable from zero to eight, with a default of four.
Rank #3
- The ESP8266 NodeMCU board has all the features of the traditional ESP8266 module,with the same exact size and peripheral ports,offers seamless integration with a 0.96-inch OLED display, eliminating the need for frustrating wires and breadboards.Display features a high-resolution 128x64 with SSD1306 driver and is compatible with I2C,SPI interfaces. Plus,It uses Micro usb cable to connect. Say goodbye to messy setups and hello to hassle-free electronics with the ESP8266 NodeMCU board
- This board uses I2C to connect to an OLED display via the SDA (D6 / GPIO12) and SCL (D5 / GPIO14) pins. With this board,it's easy to display a variety of information and data
- To install the new version driver for CH340,simply search for the keywords "CH340 Driver" on Google.com or Bing.com and follow the installation instructions provided.Recommended for Win10 Operating System
- ESP8266 NodeMCU board is equipped with ESP-12E module,which contains the Tensilica Xtensa 32-bit LX106 RISC microprocessor powering the ESP8266 chip. This microprocessor supports RTOS and operates at a clock frequency that can be adjusted between 80MHz and 160 MHz. It also boasts 128 KB of RAM and 4MB of Flash memory, providing ample storage for data and programs. With its high processing power, built-in Wi-Fi, and Deep Sleep Operating features, It's is an excellent choice for IoT projects
- This board is an outstanding option for various Internet of Things (IoT) projects. It can be used to display network connection status,monitor information, power levels, and other relevant data. Additionally, it's suitable for building Internet Weather Stations, News Stations, Clocks, and Other similar applications
For example, a sketch can start an access point with WiFi.softAP(ssid, password). The historical Core 2.2.0 library reference describes that configuration as WPA2-PSK and specifies a minimum password length of eight characters; check the API documentation for the core version you actually use rather than assuming a version-specific detail applies unchanged to every release.
Handle disconnections and restart network services
Automatic station reconnection helps restore the link, but it does not automatically rebuild every application-level service. When a Wi-Fi interface goes down, the core stops WiFiClient objects and stops WiFiServer service. Your sketch should account for that lifecycle: clean up affected clients and servers after a disconnect, then initialize the services again when the station obtains an IP address.
Rank #4
- ESP8266 has powerful on-board processing and storage capabilities that allow it to be integrated with the sensors and other application specific devices through its GPIOs with minimal development up-front and minimal loading during runtime. Its high degree of on-chip integration allows for minimal external circuitry, and the entire solution, including front-end module, is designed to occupy minimal PCB area.
- ESP8266 is a highly integrated chip designed for the needs of a new connected world.It offers a complete and self-contained Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-Fi networking functions from another application processor.
- The NodeMCU LUA board is supported by a large online community, offering extensive resources for developers. This open-source approach allows for customizing and expanding its capabilities as needed.
- This ESP8266 NodeMcu development board can be use for small temperature and humidity monitor in home automation project and works very well Compatible with Arduino development platform.
- ESP8266 CH340 chip, power your development in the fastest way combinating with NodeMcu Firmware; It's a IOT unit with all available resources on board, support smart link and smart networking.
The Generic Class reference identifies onStationModeGotIP() as the event for responding when the station receives an address. Use that point to bring back services that require an active interface. If you provide services over a softAP, start them when that interface is available as well.
Since ESP8266 Arduino Core version 3, Wi-Fi persistence is disabled by default and Wi-Fi does not start automatically at boot. Common sketches still enable Wi-Fi when they call WiFi.mode(), WiFi.begin(), or WiFi.softAP(). Repeatedly changing settings can write to flash and contribute to wear; use WiFi.persistent(false) when you want setting updates kept in memory rather than stored in flash.
Best Value
- ESP8266 has powerful on-board processing and storage capabilities
- Support 3 modes: AP, STA, AP + STA
Use TCP servers with the current API
For a basic station-mode server example, the core documentation shows an ESP8266 serving a page to a browser using its networking classes. Treat that example as a demonstration of the classes, not as a production-ready HTTP implementation: the project points readers to ESP8266WebServer for more advanced application needs. See Server Examples.
In ESP8266 Arduino Core 3.1.0 and later, WiFiServer.available() is deprecated; use accept() to retrieve a waiting client. Also, WiFiServer.write() does not broadcast to all connected clients. To send the same data to several clients, keep track of the clients and iterate over them yourself. See the Server Class reference.
Account for TLS memory limits
The library includes BearSSL::WiFiClientSecure and BearSSL::WiFiServerSecure for secure client and server connections. BearSSL supports TLS 1.2 on the ESP8266, but cryptographic processing consumes substantial memory and processing time. The project documentation says that, in general, the device can process only one secure client or server connection at a time.
Plan secure connections around that constraint rather than assuming a secure server can handle many simultaneous clients. Consult the current BearSSL-specific API documentation for certificate verification and other security settings; the general library overview does not establish the right verification configuration for every application.
Consider power-saving modes as application trade-offs
The core documents WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP, and WIFI_MODEM_SLEEP. A longer listen interval can reduce power consumption, but it can also cause the station to miss broadcast data. Choose a mode based on the application’s traffic and test it with the actual access point and workload; the documentation does not support a universal battery-life estimate.

