Skip to content

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

Cart

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.

  1. Connect ESP8266 GND to Arduino GND (black wire).
  2. Connect ESP8266 VCC to Arduino 3.3V with 10kΩ resistor (red wire).
  3. Connect ESP8266 CH_EN to Arduino 3.3V with 10kΩ resistor (red wire).
  4. Create voltage divider for RX: connect 1kΩ resistor from Arduino Pin 2 to ESP8266 RX, then 1kΩ from RX to GND.
  5. Connect ESP8266 TX directly to Arduino Pin 3 (green wire).
  6. 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.

  1. Download the ESP8266 WiFi sketch from project source.
  2. Open in Arduino IDE.
  3. Upload to Arduino Uno.
  4. Sketch uses SoftwareSerial to communicate with ESP8266.
cpp
#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.

  1. Open Serial Monitor (9600 baud).
  2. Watch for AT command responses.
  3. ESP8266 should connect to your WiFi.
  4. Note the IP address shown.
  5. 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.

  1. Download TCP client app on smartphone.
  2. Connect phone to same WiFi network.
  3. In app, connect to ESP8266 IP address, port 80.
  4. Send AT commands from phone.
  5. Arduino receives and can respond to messages.
  6. 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.

  1. Ideas: WiFi temperature monitor, remote LED control, data logger.
  2. Read sensor data on Arduino.
  3. Send data via ESP8266 to phone or cloud service.
  4. 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.