ESP8266: receiving AT answers from Serial1

Hello,

I am fighting with ESP8266 wifi module and connecting arduino. After updating firmware to newest version i started to programm arduino to get data incoming from wifi. I saw many examples about maiking webserver via ESP8266 but none of them works for me.

ESP is connected to my Arduino Leonardo:

Arduino -> ESP power 3.3V -> vcc ground -> ground tx -> rx (via logic level converter 5->3.3) rx -> tx (via logix level converter power 3.3V ->gpio0 (without any resistors)

I made simple sketch:

void setup(void){

  Serial.begin(9600);
  Serial1.begin(115200);

}

void loop() {
  if(Serial1.available())
  {
    Serial.println("WIFI IS AVAILABLE");
    Serial1.println("AT");
    delay(1000);


  } else {
    Serial.println("WIFI not available.");
    delay(1000);
  }
}

After executing it ESP8266 is powered (red led is on) and also every second blue led (blinks). That makes me sure that in fakt "AT" command is transmited to module. But there are also two issues:

  • i want to get response from esp - in this case word "OK". I tried Serial1.read() but it only reads one byte. Serial1.readString() makes my messages "wifi not available" and sametimes "wifi is available" as if for a while the connection would be unavailable

  • ufter uploading sketch to arduino and having powered esp8266 wifi module is always unavailable - i need to power the module off and on again to have it working.

Anybody please can help me?

Solved - i needed to change speed of serial1 to 9600 instead of 115200