Sketch wont flash to ESP8266-01S... Tried everything, please help!

Ok so I recently bought a ESP8266 for making a door opener with a standart relay connected with my Google Assistant via IFTTT but I cant actually get it to flash the program to the Wifi adapter…
This is my ESP8266-01S and I’m using a Arduino Micro out of the official Store.
I’ve connected the Pins like this with female to female Jumper wires:

ESP Side | Arduino Side
|
GND | GND
UTXD | RX
GPIO2 | nothing
CH_P0 | 3V (Header of secondary Arduino for testing purposes without soldering)
REST | nothing
GPIO0 | GND
VCC | 3V
URXD | TX

I’ve both tried swithing RX and TX aswell as not plugging in GPIO0 to anything to boot its preinstalled AT-Software and I’ve now looked on many websites/tutorials but neither I can get the AT Software to run nor flash my own little script. The Script does not hvae any errors and I’ve installed the latest libraries and Board manager extensions (http://arduino.esp8266.com/stable/package_esp8266com_index.json) and left everything on default.

I ALWAYS get the errors:

error: Failed to open COM5
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

and sometimes also many “failed to write this and that 0x3” lines but I got these with a different pin layout…

The Power LED is always glowing and the Module doesn’t get hot.

I’m aware that I need to ground the GPIO0 pin to flash own software but I cant even get it to work with the AT stuff…

I’d also want be able to edit the Code on both the arduino and the Module from the Internet (without USB connection) as I’m planning to install it into the wall behind my new camera door opening system.

For the programming part I’ve followed this tutorial and some parts of the comments section and my response from Google safely lands on a free webhook server of this website.

What am I doing wrong?

#include <ArduinoJson.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>


const char* ssid = "<MyWifiName>";
const char* password = "<MyWifiPassword>";
const char* httprequestserver = "<MyWebhookAppletServer>";
const char* DeviceName = "Doorlock Arduino"; //enter the Devicename shown in your router here. For best purposes set it to the projects name, you're building!
float checkspeed = 1; //in seconds!!
IPAddress ip(192, 168, 178, 456); //some random high IP-adress that I'll porbably never use in any other way

//Variables used throughout the programm
int adelay = checkspeed * 1000;

void setup() {

  Serial.begin(115200);
  // Serial.setDebugOutput(true);

  IPAddress gateway(192, 168, 178, 1);
  IPAddress subnet(255, 255, 255, 0);
  IPAddress dns(192, 168, 178, 1);

  WiFi.hostname(DeviceName);
  WiFi.config(ip, dns, gateway, subnet);
  WiFi.begin(ssid, password);

  int Signalstrength = WiFi.RSSI();
  String SigStrength = String("Wifi Strength is" + Signalstrength);
  Serial.println(SigStrength);

  while (WiFi.status() != WL_CONNECTED) {
    Serial.println("Not Connected yet...");
    delay(adelay);
  }
  if (WiFi.status() == WL_CONNECTED) {
    Serial.println("Succesfully connected!");
  }
  if (WiFi.status() == WL_CONNECT_FAILED) {
    Serial.println("Connection can not be established. Try checking the password!");
    setup();
  }


}

void loop() {
  // wait for WiFi connection
  if (WiFi.status() == WL_CONNECTED) {
    HTTPClient http;  //Object of class HTTPClient
    http.begin(httprequestserver);
    int httpCode = http.GET();
    //Check the returning code
    if (httpCode > 0) {
      // Get the request response payload
      String payload = http.getString();
      // TODO: Parsing
      Serial.println(payload);
      http.end();   //Close connection
    }
    if (WiFi.status() == WL_CONNECTION_LOST) {
      Serial.println("Connection broke up... :(");
      Serial.println("Trying to reconnect!");
      setup();
    }

    delay(adelay);
  }
  else
  {
    Serial.println("No Wifi... Weird... The Code should not even be able to land here.... Thanks for using my script! :^)");
  }
}

Have you uploaded code to the Micro to make it forward data from the serial port to the hardware serial?

Unlike the Uno/Mega/Nano/ProMini, the Micro has native USB. the USB serial port is NOT connected to TX/RX pins like it is on boards without native USB - there is no physical TX/RX pin for the USB serial port. You could write a simple sketch to copy everything from USB serial to Serial1 - but then you would need to specify the baud rate when you call esptool and have it match what the sketch used on Serial1 otherwise the data would overflow.

You would make life much easier if you used a simple serial adapter, instead of using an Arduino as a serial adapter.

HOWEVER - regardless of what you do for the serial port, you cannot power an ESP8266 with the 3.3v pin on any 5v arduino board - they all use low-spec rice-grain-sized* regulators that can't handle the max current that the ESP8266 can draw. Get an external 3.3v regulator (a 1117-series**) and power that with 5v. Remember the capacitors as specified in the datasheet (some 1117 models are picky about the kind of cap); I recommend one which works with ceramic caps. On a few occasions I've soldered the input and output caps to the legs of the TO220 package 1117-series regs (I think one of those was to power an ESP8266, as it happens), and the input and output wires to that, instead of using a circuit board.

  • With linear regulators, the size of the package is important, because the limiting factor is usually how fast it can dissipate heat, and larger packages, with exposed tabs and pads and thick pins are better able to dissipate heat than tiny packages with thin pins and no exposed tab or pad.

** Lots of manufacturers make 1117-series regulators; each uses their own prefix (TI makes the LM1117, NCP Semiconductor makes the NCP1117, Diodes Inc makes the ZLDO1117 (the part number was chosen when they were Zetex, before Diodes Inc bought them, and it's an Low Drop-Out regulator, hence ZLDO), and so on). Each of these has ever so slightly different specs - one company made it first, it became popular, then the others got into the game and made theirs "at least as good as" the original. The most relevant difference to hobbyists is probably the requirements of the external capacitors - some spec specific types of caps, often tantalum caps, which are expensive and explode if you connect them backwards or expose them to excessive voltages, while others are rated to work with ceramic caps. Always pay attention to manufacturer recommendations for external caps on regulators - with the wrong caps, the output voltage will not be stable.

DrAzzy:
Have you uploaded code to the Micro to make it forward data from the serial port to the hardware serial?

Unlike the Uno/Mega/Nano/ProMini, the Micro has native USB. the USB serial port is NOT connected to TX/RX pins like it is on boards without native USB - there is no physical TX/RX pin for the USB serial port. You could write a simple sketch to copy everything from USB serial to Serial1 - but then you would need to specify the baud rate when you call esptool and have it match what the sketch used on Serial1 otherwise the data would overflow.

You would make life much easier if you used a simple serial adapter, instead of using an Arduino as a serial adapter.

HOWEVER - regardless of what you do for the serial port, you cannot power an ESP8266 with the 3.3v pin on any 5v arduino board - they all use low-spec rice-grain-sized* regulators that can't handle the max current that the ESP8266 can draw. Get an external 3.3v regulator (a 1117-series**) and power that with 5v. Remember the capacitors as specified in the datasheet (some 1117 models are picky about the kind of cap); I recommend one which works with ceramic caps. On a few occasions I've soldered the input and output caps to the legs of the TO220 package 1117-series regs (I think one of those was to power an ESP8266, as it happens), and the input and output wires to that, instead of using a circuit board.

  • With linear regulators, the size of the package is important, because the limiting factor is usually how fast it can dissipate heat, and larger packages, with exposed tabs and pads and thick pins are better able to dissipate heat than tiny packages with thin pins and no exposed tab or pad.

** Lots of manufacturers make 1117-series regulators; each uses their own prefix (TI makes the LM1117, NCP Semiconductor makes the NCP1117, Diodes Inc makes the ZLDO1117 (the part number was chosen when they were Zetex, before Diodes Inc bought them, and it's an Low Drop-Out regulator, hence ZLDO), and so on). Each of these has ever so slightly different specs - one company made it first, it became popular, then the others got into the game and made theirs "at least as good as" the original. The most relevant difference to hobbyists is probably the requirements of the external capacitors - some spec specific types of caps, often tantalum caps, which are expensive and explode if you connect them backwards or expose them to excessive voltages, while others are rated to work with ceramic caps. Always pay attention to manufacturer recommendations for external caps on regulators - with the wrong caps, the output voltage will not be stable.

Ohh thanks, didn't know that...
I remember having a Low-Power WiFi option so I will try that first before I go out and buy an external Power source or a normal Arduino.. however I have a 12V Cable there being used by the doorbell system that I can steal a few milliamps from...

@DrAzzy can you please guide me through the progress of programming it with my Arduino Micro? Can't find any tutorials how to wire it up and set the correct bus speed as described by you... Would be great!