-->
Page 1 of 3

AT commands via SoftwareSerial?

PostPosted: Wed Jul 06, 2016 3:27 pm
by nikko4913
Hello.

I'm in a bit of a struggle. I'm trying to upload a piece of arduino code to my ESP8266-01, that will make the ESP8266 send AT commands to itself. That should be pretty simple right? Though i'm not very used to working with the SoftwareSerial.h library, i understand that it is able to do this. This is my code so far:

Code: Select all#include <SoftwareSerial.h>
 
SoftwareSerial esp8266(1, 5);

void setup()
{
  Serial.begin(115200);
  esp8266.begin(115200);
}
 
void loop()
{

  delay(2000);

  esp8266.println("AT");

  if(esp8266.find("OK")){
    Serial.println("Response: OK");
  }
}


But this doesn't work. I'm using a FT232RL FTDI USB 3.3V 5.5V to TTL Serial Adapter Module, and as far as i understand, pin 1 and 5 is TX/RX on that one. Or am i wrong?

Anyway, uploading this to the ESP8266, gives me nothing, except for a little piece of random symbols and numbers in the first few milliseconds.... What is wrong?
Is it firmware related? Is it because when flashing/uploading arduino code, you overwrite the already installed firmware? Because installing AT firmware and running commands through a serial window works fine until i upload my sketch...

Maybe some of you can clarify what is happening here, and how i could fix it.

Thanks :)

Re: AT commands via SoftwareSerial?

PostPosted: Thu Jul 07, 2016 4:19 am
by AcmeUK
gives me nothing, except for a little piece of random symbols and numbers in the first few milliseconds....
That will be messages from the boot rom at 74880 baud.

If I recall correctly software serial will not operate at such a high rate (115200). Also the recent builds of esp8266-01 the AT commands run at 9600 baud.

Have you tried tried to talk to the esp directly via the FTDI module?

Remember dont rush, take one step at a time!

Re: AT commands via SoftwareSerial?

PostPosted: Thu Jul 07, 2016 5:20 am
by nikko4913
I already tried setting the baud rate at 9600, but with no luck.

Yes, i tried to talk to the ESP8266-01 through serial with a fresh install of this firmware: http://www.electrodragon.com/w/File:V1. ... re.bin.zip

And that works. I am able to send AT commands manually at 115200 baud in a serial window. That works as intended, but as soon as i upload an Arduino sketch, doesn't matter what it cointains, the AT commands are no longer available. I tried every baudrate available in the Arduino Serial window...

Re: AT commands via SoftwareSerial?

PostPosted: Thu Jul 07, 2016 8:56 am
by martinayotte
nikko4913 wrote:that will make the ESP8266 send AT commands to itself.

Are you uploading a Arduino sketch and expect that AT firmware will still be present into the ESP ?
As soon as you upload any other firmware, it is overwriting the AT firmware, therefore AT commands never works anymore.