Add WiFi to Arduino Uno
Connect your Arduino Uno to WiFi using the ESP8266 module to send and receive data over the internet.
- Arduino
- Intermediate
- 75 minutes
- 5 steps
Shop this project
CartYou'll need
Prices from vilros.com. Tax and shipping at checkout.
Before you start, you'll need
- Arduino Uno
- ESP8266 WiFi module
- 2× 10kΩ resistors
- 2× 1kΩ resistors
- Breadboard
- Jumper wires
Connect ESP8266 to Arduino
About 20 minutes
Wire the WiFi module with voltage dividers.
- Connect ESP8266 GND to Arduino GND (black wire).
- Connect ESP8266 VCC to Arduino 3.3V with 10kΩ resistor (red wire).
- Connect ESP8266 CH_EN to Arduino 3.3V with 10kΩ resistor (red wire).
- Create voltage divider for RX: connect 1kΩ resistor from Arduino Pin 2 to ESP8266 RX, then 1kΩ from RX to GND.
- Connect ESP8266 TX directly to Arduino Pin 3 (green wire).
- Important: ESP8266 is 3.3V—do NOT connect to 5V!
You should see
ESP8266 is wired with proper voltage levels.
Upload WiFi communication sketch
About 15 minutes
Program Arduino to talk to ESP8266.
- Download the ESP8266 WiFi sketch from project source.
- Open in Arduino IDE.
- Upload to Arduino Uno.
- Sketch uses SoftwareSerial to communicate with ESP8266.
#include <SoftwareSerial.h>
SoftwareSerial esp8266(3, 2);
void setup() {
Serial.begin(9600);
esp8266.begin(9600);
Serial.println("ESP8266 WiFi Test");
sendCommand("AT", 1000);
sendCommand("AT+CWMODE=1", 1000);
sendCommand("AT+CWJAP=\"YOUR_SSID\",\"YOUR_PASSWORD\"", 5000);
sendCommand("AT+CIFSR", 2000);
}
void loop() {
if (esp8266.available()) {
Serial.write(esp8266.read());
}
if (Serial.available()) {
esp8266.write(Serial.read());
}
}
void sendCommand(String cmd, int wait) {
esp8266.println(cmd);
delay(wait);
while (esp8266.available()) {
Serial.write(esp8266.read());
}
}Replace YOUR_SSID and YOUR_PASSWORD with your WiFi credentials.
You should see
Sketch uploads successfully.
Connect to your WiFi network
About 15 minutes
Join ESP8266 to WiFi.
- Open Serial Monitor (9600 baud).
- Watch for AT command responses.
- ESP8266 should connect to your WiFi.
- Note the IP address shown.
- Test with AT command: AT+PING="google.com"
You should see
ESP8266 connects to WiFi and gets an IP address.
It didn't work
No response from ESP8266.
Check baud rate (try 115200 if 9600 doesn't work). Verify wiring, especially voltage divider. Ensure ESP8266 has enough power (may need external 3.3V supply).
Send data over WiFi
About 15 minutes
Communicate with a server.
- Download TCP client app on smartphone.
- Connect phone to same WiFi network.
- In app, connect to ESP8266 IP address, port 80.
- Send AT commands from phone.
- Arduino receives and can respond to messages.
- Example: send sensor data to phone or web server.
You should see
Arduino can send and receive data via WiFi.
Create a WiFi project
About 10 minutes
Put WiFi connectivity to use.
- Ideas: WiFi temperature monitor, remote LED control, data logger.
- Read sensor data on Arduino.
- Send data via ESP8266 to phone or cloud service.
- Control Arduino outputs remotely via WiFi commands.
You should see
You have a working WiFi-enabled Arduino project.
What to do next
Stuck? Contact Vilros Support with your board model and what you see on screen.