# Failed to connect to ESP8266: Timed out waiting for packet header

**URL:** <https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569>\
**Category:** Uploading\
**Created:** [May 8, 2023, 3:33pm UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569 "2023-05-08T15:33:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yonghao1018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/yonghao1018/32/962258_2.png) [@yonghao1018](https://forum.arduino.cc/u/yonghao1018)\
**Post date:** [May 8, 2023, 3:33pm UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/1 "2023-05-08T15:33:32Z")

</div>

**I am facing some problem which is Failed to connect to ESP8266**

**This is the code:**

```plaintext
#include <SoftwareSerial.h>
SoftwareSerial espSerial(0, 1); // RX, TX

void setup() {
  Serial.begin(9600);
  espSerial.begin(9600);
  delay(1000);
  espSerial.println("AT+RST"); // reset the ESP8266 module
  delay(1000);
  espSerial.println("AT+CWMODE=1"); // set the module to client mode
  delay(1000);
  espSerial.println("AT+CWJAP=\"dlink-04FF\",\"gbudr79638\""); // replace with your Wi-Fi network credentials
  delay(5000);
}

void loop() {
  float temperature = 25.0; // replace with your own data to be sent to ThingSpeak
  String apiKey = "05WSZUIIGI84SCAB"; // replace with your own ThingSpeak API key
  String url = "GET /update?key=" + apiKey + "&field1=" + String(temperature);
  espSerial.println("AT+CIPMUX=0");
  delay(1000);
  espSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80");
  delay(1000);
  espSerial.print("AT+CIPSEND=");
  espSerial.println(url.length() + 2);
  delay(1000);
  espSerial.println(url);
  delay(5000); // wait for the response from ThingSpeak
}

```

**This is the error:**  
. Variables and constants in RAM (global, static), used 28740 / 80192 bytes (35%)  
║ SEGMENT BYTES DESCRIPTION  
╠══ DATA 1496 initialized variables  
╠══ RODATA 1100 constants  
╚══ BSS 26144 zeroed variables  
. Instruction RAM (IRAM\_ATTR, ICACHE\_RAM\_ATTR), used 61895 / 65536 bytes (94%)  
║ SEGMENT BYTES DESCRIPTION  
╠══ ICACHE 32768 reserved space for flash instruction cache  
╚══ IRAM 29127 code in IRAM  
. Code in flash (default, ICACHE\_FLASH\_ATTR), used 243000 / 1048576 bytes (23%)  
║ SEGMENT BYTES DESCRIPTION  
╚══ IROM 243000 code in flash  
esptool.py v3.0  
Serial port COM3  
Connecting........_ **.....** _....._ **.....** _....._ **.....** _.....\_\_\_\_\_

**A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header**

 ![WeChat Image_20230508232821](https://europe1.discourse-cdn.com/arduino/original/4X/f/9/a/f9a93ff0b0af0aac1eb9a95212fcef70eda431a2.jpeg)

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [May 9, 2023, 3:45am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/2 "2023-05-09T03:45:07Z")

</div>

I can't really help you.

1. Which exact board are you using?
2. The ESP8266 is a 3,3V device.Your feeding is 5V signals (Uno's TX) which might not be healthy for the ESP8266.
3. You're using the Uno as a TTL-to-USB adapter. Make sure that no program is running on the Uno; safest way is to jeep the Uno board in reset,

---

<div class="post-metadata">

**Author:** ![johnerrington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnerrington/32/340106_2.png) [@johnerrington](https://forum.arduino.cc/u/johnerrington)\
**Post date:** [May 9, 2023, 5:15am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/3 "2023-05-09T05:15:08Z")

</div>

Have you seen this:

> <https://arduino.stackexchange.com/questions/54348/how-to-connect-an-esp8266-using-an-esp-01-adapter-to-an-arduino-uno>

and this:

> **[Getting Started With the ESP8266 ESP-01](https://www.instructables.com/Getting-Started-With-the-ESP8266-ESP-01/)**
>
> Getting Started With the ESP8266 ESP-01: The ESP8266 ESP-01 is a Wi-Fi module that allows microcontrollers access to a Wi-Fi network. This module is a self-contained SOC (System On a Chip) that doesn’t necessarily need a microcontroller to manipulate...

what do your orange and yellow wires connect to?

and more fundamentally - if you have an application that requires wifi, why not do it all on a board that supports it? Or is it your idea that the ESP-01 will do that?

---

<div class="post-metadata">

**Author:** ![yonghao1018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/yonghao1018/32/962258_2.png) [@yonghao1018](https://forum.arduino.cc/u/yonghao1018)\
**Post date:** [May 9, 2023, 6:56am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/4 "2023-05-09T06:56:09Z")

</div>

1. Arduino uno v3
2. I confirm twice and it feeding in 3.3V correctly.
3. I think that is not working and showing same output.

---

<div class="post-metadata">

**Author:** ![yonghao1018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/yonghao1018/32/962258_2.png) [@yonghao1018](https://forum.arduino.cc/u/yonghao1018)\
**Post date:** [May 9, 2023, 7:01am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/5 "2023-05-09T07:01:39Z")

</div>

Orange and yellow wires is connect from ESP8266 to arduino uno which is  
Orange = RX (esp8266) to RX \<- 0 (arduino uno)  
Yellow = TX (esp8266) to RX -\> 1 (arduino uno)

Because I am done all of works in tinkercard and this is the last step which is connect to wifi. Now I am trying to setup correctly and facing this problem right now.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [May 9, 2023, 7:24am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/6 "2023-05-09T07:24:49Z")

</div>

> [@yonghao1018](#):
>
> Arduino uno v3

I could see that; I was asking about the other one.

> [@yonghao1018](#):
>
> I confirm twice and it feeding in 3.3V correctly

I was talking about the TX of the Arduino; that is a 5V signal and can possibly damage the ESP8266.

---

<div class="post-metadata">

**Author:** ![noobmastha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/noobmastha/32/738653_2.png) [@noobmastha](https://forum.arduino.cc/u/noobmastha)\
**Post date:** [May 9, 2023, 7:25am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/7 "2023-05-09T07:25:18Z")

</div>

USB is connected trough Rx and Tx pins on Arduino uno, so you cant use them, use Software serial with other pins.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [May 9, 2023, 7:30am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/8 "2023-05-09T07:30:21Z")

</div>

@noobmastha

You can use those pins if there is no code running on the Uno; either empty sketch or keep ino in reset.

---

<div class="post-metadata">

**Author:** ![Deva\_Rishi](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/deva_rishi/32/227254_2.png) [@Deva\_Rishi](https://forum.arduino.cc/u/Deva_Rishi)\
**Post date:** [May 9, 2023, 8:34am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/9 "2023-05-09T08:34:50Z")

</div>

> [@yonghao1018](#):
>
> **I am facing some problem which is Failed to connect to ESP8266**
> 
> **This is the code:**

Pity about the bold print, Well that code is supposed to run an the UNO i guess, but if you use swSerial, you should not use the hwSerial pins.

What it looks like to me is that you have code that will make use of the AT-firmware of the ESP and control the ESP from the UNO. You should try and upload that code onto the UNO.

I don't really support that method. It is so much more efficient to upload your own firmware onto the ESP.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 5, 2023, 8:35am UTC](https://forum.arduino.cc/t/failed-to-connect-to-esp8266-timed-out-waiting-for-packet-header/1124569/10 "2023-11-05T08:35:10Z")

</div>

Closed on November 5, 2023, 8:35am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
