ESP8266 error

Hello!

I am currently working with my ESP8266 (ESP-01S) wifi module for my Arduino Uno.
I programmed it with this:

#include <ESP8266WiFi.h>        // Include the Wi-Fi library

const char* ssid     = "SSID";         // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "PASSWORD";     // The password of the Wi-Fi network

void setup() {
  Serial.begin(115200);         // Start the Serial communication to send messages to the computer
  delay(10);
  Serial.println('\n');
  
  WiFi.begin(ssid, password);             // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(++i); Serial.print(' ');
  }

  Serial.println('\n');
  Serial.println("Connection established!");  
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
}

void loop() { }

I changed the SSID & Password to my own.

But I Keep getting this error.

Arduino:1.8.13 (Mac OS X), Board:"Generic ESP8266 Module, 160 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 16MB (FS:14MB OTA:~1019KB), 1, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Executable segment sizes:
IROM   : 236960          - code in flash         (default or ICACHE_FLASH_ATTR) 
IRAM   : 26888   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 
DATA   : 1260  )         - initialized variables (global, static) in RAM/HEAP 
RODATA : 808   ) / 81920 - constants             (global, static) in RAM/HEAP 
BSS    : 24968 )         - zeroed variables      (global, static) in RAM/HEAP 
De schets gebruikt 265916 bytes (25%)  programma-opslagruimte. Maximum is 1044464 bytes.
Globale variabelen gebruiken 27036 bytes (33%) van het dynamisch geheugen. Resteren 54884 bytes voor lokale variabelen. Maximum is 81920 bytes.
esptool.py v2.8
Serial port /dev/cu.usbmodemFD121
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
  File "/Users/joepL10/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "/Users/joepL10/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool/esptool.py", line 2890, in main
    esp.connect(args.before)
  File "/Users/joepL10/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool/esptool.py", line 483, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0xF0)
_
esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0xF0)

Is there anyone who can help me with this, or give me a GOOD tutorial, not one where they use different software or hardware.
I currently wired the ESP8266 like this:

ESP8266 - Arduino
GND - GND
3v3 - 3,3V
TX - TX (1)
RX - RX (0)
EN (chip) - 3,3V

Thanks in advance!
Joep

Anyone?

How is everything connected, it looks to me as though you have a MAC -> Arduino -> ESP8266.

If so what is running on the Arduino? It sort of appears that you are building for the ESP8266 but uploading to the Arduino. Most uploads I have seen use a USB to TTL adapter (Programmer) so MAC-> USB TTL -> ESP8266.

I may be completely off the mark, please forgive me if I am. What instructions are you following - a link would be useful

ESP8266 - Arduino
GND - GND
3v3 - 3,3V
TX - TX  (1)
RX - RX (0)
EN (chip) - 3,3V

I have seen various tutorials online that connect the ESP-01 like this, but as long as

!RST - 3.3v

Isn't connected i am pretty sure the ESP won't run (constantly resetting) and for uploading pull GPIO0 LOW (GND) at power up/ reset.
This one is actually correct As a tutorial, let's hope no one removes it soon. (i bookmarked it for future reference, so many times people come to the forum with this issue.)
Keep in mind that there is still a few other possible reasons that can cause this error, being

  • a sketch on the UNO using the Serial pins
  • Insufficient power. The ESP is rather power hungry and during the WiFi connecting it can run up to 280mA, though i power them through the UNO's 3.3v and that does work for me. On a Nano this issue may arise.

Also, and i do want to stress this a bit, The ESP-01 is fairly fragile, being that it is not 5v tolerant I connect the RX pin through a voltage divider (3x 1K does it really well) and that has not caused me any issues, but i have had them frying on me quite a few times in other circumstances. The only ESP8266 that i know for sure is 5v tolerant is the RX pin on a nodeMCU, (though there are so many varieties of that board as well, some may not have the protection)

joepl10:
Anyone?

Dude.. 4hrs is to soon for a bump, we are not all in the same timezone

"I am currently working with my ESP8266 (ESP-01S) wifi module for my Arduino Uno"

This never ends well. I have yet to see anyone pleased with using an ESP8266-01 as a WiFi "shield" for the Uno. If you want WiFi, then start with a board that has WiFi.

If you want guidance then meet us halfway and answer the questions. What is the Uno doing?

This never ends well.

Ah that is not completely true, besides the OP is trying to flash the ESP, which is a board.

Deva_Rishi:
Ah that is not completely true, besides the OP is trying to flash the ESP, which is a board.

  1. I have stated several times that using the ESP as a WiFi shield is never a satisfactory solution. No one has ever said that they have done this and are happy with the performance.
  2. The OP said: "I am currently working with my ESP8266 (ESP-01S) wifi module for my Arduino Uno.", which tells me that he wants to use the ESP as a WiFi shield. Nowhere did he say that he was trying to program the ESP from an Arduino. (Which is an overkill method).

So far the OP has attempted to flash the ESP-01 using the Uno as a programmer. What his future plans are is unknown.

give me a GOOD tutorial, not one where they use different software or hardware.

That is the request. Our discussion is pointless, though if you need to have a proof that a path that programs an Arduino and an ESP-01 to communicate and have a satisfactory result, i do know such a path, therefore you stating that it does not exist is simply not true. Any result where one achieves the goal that one set out to achieve is probably quite satisfying anyway, and as long as the goal is not to program the ESP-01 from an Arduino using AT-commands i am willing to support that. We are here to help people.

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