ESP8266-01 troubleshooting

Hello!

I am having trouble with the ESP8266 ESP-01 Wi-Fi module (bought it from Anodas.lt if that helps).
The problem is uploading sketches to the module. I can't upload anything for the life of me. I'm using an Arduino to connect to the module. I don't have any fancy USB converters or anything and I can't order one because it will take too long. I need this thing working ASAP, it's for a qualification paper.

I've tried a bunch of things and none of them seem to have a stable upload result.

Currently my aim is to upload the standard Blink example for the ESP8266.

With the 2.5.0 board drivers I always get:

Arduino: 1.8.13 (Linux), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled, nodemcu, 26 MHz, 40MHz, DOUT (compatible), 1M (64K SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Sketch uses 264164 bytes (27%) of program storage space. Maximum is 958448 bytes.
Global variables use 27296 bytes (33%) of dynamic memory, leaving 54624 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

With the 2.7.4 (newest) drivers it's:

Arduino: 1.8.13 (Linux), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled (new can abort), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Executable segment sizes:
IROM   : 233748          - code in flash         (default or ICACHE_FLASH_ATTR) 
IRAM   : 26888   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 
DATA   : 1248  )         - initialized variables (global, static) in RAM/HEAP 
RODATA : 1028  ) / 81920 - constants             (global, static) in RAM/HEAP 
BSS    : 25112 )         - zeroed variables      (global, static) in RAM/HEAP 
Sketch uses 262912 bytes (27%) of program storage space. Maximum is 958448 bytes.
Global variables use 27388 bytes (33%) of dynamic memory, leaving 54532 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port /dev/ttyACM0
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
  File "/home/ansis/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "/home/ansis/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool/esptool.py", line 2890, in main
    esp.connect(args.before)
  File "/home/ansis/.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: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

My setup is as follows:

RXD ---> Arduino RX (digital 0)
TXD ---> Arduino TX (digital 1)
CH_PD ---> 2AA batteries + end
VCC ---> 2 AA batteries + end
GND ---> 2 AA batteries - end (I think most people call it GND)
GPIO0 ---> 2 AA batteries - end
RST ---> button ---> 2AA batteries - end
GPIO2 ---> None

My upload/program/flash procedure is as follows:

  • Open Arduino IDE
  • Plug in Arduino
  • Plug in ESP power.
  • ESP blue light flashes
  • Press RST button to reset ESP into flash mode (with GPIO0 plugged into GND/-).
  • The blue light flashes upon button release.
  • Pull out GPIO0 or not, both methods return the same error.
  • Hit "Upload" in the example sketch.
  • The blue ESP light keeps blinking while uploading:
  • Arduino IDE returns the errors seen above.

I've tried quite a few different setups. The interesting thing is that the upload does not fail if I connect VCC, CH_PD to the Arduino 3.3V pin and GND, GPIO0, RST (button) to the Arduino GND. It fully uploads the sketch. The thing is that even after a successful upload it does not work correctly.

For example, the standard Blink (1000ms on, 2000ms off) sketch:
On Arduino 3.3V power it just weakly flashes constantly (I mean mayybe 100ms on and 100ms off).
On AA battery power it is dimly lit, even though I know it can supply enough power to be fully lit (the blue light flashes in full brightness if I press RST).

What do I do? I just want to be able to upload programs to the module. :frowning:

P.S. I also noticed that I can never get the AT commands to work. I'm not sure why.
P.P.S. I know I have to put GPIO0 to GND for it to go into Flash mode. As I mentioned, I power it up with GPIO0 grounded and also RST it with GPIO0 connected. That seems to be the most common suggestion in forums.

My method for uploading code is

GPIO0 - LOW/GND
RST - LOW/GND
CH_PD - HIGH

Start the upload. When you see the ............ release RST (so it becomes HIGH). The the upload begins at that point. I've done this close to 20 times so I'm confident it will work.

hzrnbgy:
My method for uploading code is

GPIO0 - LOW/GND
RST - LOW/GND
CH_PD - HIGH

Start the upload. When you see the ............ release RST (so it becomes HIGH). The the upload begins at that point. I've done this close to 20 times so I'm confident it will work.

Unfortunately, your confidence did not pay off. :frowning:
I just tried your technique on the latest ESP drivers.

  • Connected Arduino via USB
  • Powered on ESP with RST grounded
  • Started upload
  • At "Connecting..." disconnected RST from GND (also tried connecting it to 3.3V)

Nothing changed. Still the same error.
Here is my setup IRL, if it helps:

ansis100:
I don't have any fancy USB converters or anything and I can't order one because it will take too long. I need this thing working ASAP, it's for a qualification paper.

Too bad, these work great: USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi : ID 954 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
It pays to plan ahead.

Where's your ground connection between the Arduino and the ESP8266?

Flashing the ESP8266 with an Arduino UNO

Pieter

PieterP:
Where's your ground connection between the Arduino and the ESP8266?

Flashing the ESP8266 with an Arduino UNO

Pieter

You mean the one from RX to GND via a 2K resistor? I did try adding a connection from the ESP GND to the Arduino GND which didn't change much.
Should I add a GND connection to the RST line? Which GND should I connect it to - Arduino or the batteries?
I forgot to add that I did try another setup with all the same stuff except a voltage divider on the TX line.

TX ---> 1K Ohm ---> ESP TXD
         |--------> 2.2K Ohm ---> Arduino GND

But that just messed things up even more.

I might have forgotten to add that I'm a completely beginner at wiring. I literally got an Arduino about 2 weeks ago. All my knowledge comes from high-school physics lessons, haha. If I say anything dumb, please let me know!

Common ground and why you need one
Pieter means the ground between the Uno and the ESP, which I can't see either.

Use a pencil and paper and draw a schematic. (Please, no Fritzing pictures). Pictures don't show us how it's connected.

As Perry and Pieter said, you don't have a common ground. There may well be other errors that we can't see in your picture. Draw a schematic.

SteveMann:
Use a pencil and paper and draw a schematic. (Please, no Fritzing pictures). Pictures don't show us how it's connected.

As Perry and Pieter said, you don't have a common ground. There may well be other errors that we can't see in your picture. Draw a schematic.

I just tried connecting both GNDs together, but that did not change anything.
Per your request I drew a schematic: