Arduino ESP8266 ESP-01 AT Commands (HTTP GET): Wiring, Code and Simulator
To build this Arduino ESP8266 ESP-01 AT Commands (HTTP GET) project you need an Arduino Uno and an ESP-01 ESP8266 wi-fi module. The Uno drives an ESP-01 with AT commands: join the lab Wi-Fi, open a TCP connection, send an HTTP GET and print the answer. Make the 5 connections in the wiring table, upload the Arduino C++ code, and read every AT command and reply in the Serial Monitor. Change the latitude and longitude in the request to your city.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | ESP-01 ESP8266 Wi-Fi module | ESP8266 Wi-Fi module with the AT firmware: VCC and EN to 3.3 V (never 5 V), GND, TX → the board’s RX pin, RX ← its TX pin. Starts at 115200 baud (set 9600 here to match SoftwareSerial). AT+CWJAP="BFB-Lab","" joins the lab’s Wi-Fi; AT+CIPSTART and AT+CIPSEND fetch web pages; AT+CIPSERVER serves a page you open from the Modules tab. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 3.3V | ESP-01 ESP8266 Wi-Fi module VCC |
| 2 | Arduino Uno 3.3V | ESP-01 ESP8266 Wi-Fi module EN |
| 3 | Arduino Uno GND | ESP-01 ESP8266 Wi-Fi module GND |
| 4 | Arduino Uno pin 2 | ESP-01 ESP8266 Wi-Fi module TX |
| 5 | Arduino Uno pin 3 | ESP-01 ESP8266 Wi-Fi module RX |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add an ESP-01 ESP8266 wi-fi module from the parts palette.
- Wire 1. Connect Arduino Uno 3.3V to ESP-01 ESP8266 Wi-Fi module VCC.
- Wire 2. Connect Arduino Uno 3.3V to ESP-01 ESP8266 Wi-Fi module EN.
- Wire 3. Connect Arduino Uno GND to ESP-01 ESP8266 Wi-Fi module GND.
- Wire 4. Connect Arduino Uno pin 2 to ESP-01 ESP8266 Wi-Fi module TX.
- Wire 5. Connect Arduino Uno pin 3 to ESP-01 ESP8266 Wi-Fi module RX.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Read every AT command and reply in the Serial Monitor. Change the latitude and longitude in the request to your city.
Arduino C++ code
// ESP-01 Wi-Fi with AT commands: join the lab Wi-Fi and fetch today's weather.
// ESP-01 TX -> pin 2, RX <- pin 3, VCC and EN -> 3.3V, GND. The module is set to 9600 baud.
#include <SoftwareSerial.h>
SoftwareSerial esp(2, 3); // RX, TX
// Send a command and print what comes back until `ok` (or the timeout).
bool at(const char *cmd, const char *ok, unsigned long ms) {
esp.println(cmd);
String got;
unsigned long t = millis();
while (millis() - t < ms) {
while (esp.available()) {
char c = esp.read();
got += c;
Serial.write(c);
}
if (got.indexOf(ok) >= 0) return true;
if (got.indexOf("ERROR") >= 0 || got.indexOf("FAIL") >= 0) return false;
}
return false;
}
void setup() {
Serial.begin(115200);
esp.begin(9600);
delay(500);
at("AT", "OK", 1000);
at("ATE0", "OK", 1000);
at("AT+CWMODE=1", "OK", 1000);
if (!at("AT+CWJAP=\"BFB-Lab\",\"\"", "OK", 8000)) { Serial.println(F("\nCould not join Wi-Fi")); return; }
at("AT+CIFSR", "OK", 1000);
if (!at("AT+CIPSTART=\"TCP\",\"api.open-meteo.com\",80", "OK", 5000)) return;
const char *req = "GET /v1/forecast?latitude=28.61&longitude=77.21¤t=temperature_2m HTTP/1.1\r\n"
"Host: api.open-meteo.com\r\nConnection: close\r\n\r\n";
char cmd[24];
snprintf(cmd, sizeof(cmd), "AT+CIPSEND=%d", (int)strlen(req));
if (at(cmd, ">", 2000)) {
esp.print(req);
// The answer arrives as +IPD,<length>:<data> and ends with CLOSED.
at("", "CLOSED", 10000);
}
Serial.println(F("\nDone."));
}
void loop() {}
What to try
Read every AT command and reply in the Serial Monitor. Change the latitude and longitude in the request to your city.
Frequently asked questions
How do I wire the ESP8266 ESP-01 AT Commands (HTTP GET) project on an Arduino Uno?
Make 5 connections: Arduino Uno 3.3V to ESP-01 ESP8266 Wi-Fi module VCC; Arduino Uno 3.3V to ESP-01 ESP8266 Wi-Fi module EN; Arduino Uno GND to ESP-01 ESP8266 Wi-Fi module GND; Arduino Uno pin 2 to ESP-01 ESP8266 Wi-Fi module TX; Arduino Uno pin 3 to ESP-01 ESP8266 Wi-Fi module RX.
What parts do I need for this Arduino project?
An Arduino Uno and an ESP-01 ESP8266 wi-fi module.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
The Uno drives an ESP-01 with AT commands: join the lab Wi-Fi, open a TCP connection, send an HTTP GET and print the answer.
What baud rate does the ESP-01 use?
The AT firmware starts at 115200 baud, too fast for SoftwareSerial on an Uno. Set it once with AT+UART_DEF=9600,8,1,0,0 and use 9600 from then on.
Can the ESP-01 run on 5 V?
No. The ESP8266 is a 3.3 V chip: power VCC and EN from 3.3 V (with enough current — about 300 mA peaks) and divide the Arduino’s TX down to 3.3 V.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator