Communicating with esp8266

Hi,
I'm playing with the esp8266-01 using AT-commands on a Uno. While just transfering the commands from the Arduino terminal (Serial) to the esp using SoftwareSerial everything works just fine. see code below.

#include <SoftwareSerial.h>
SoftwareSerial terminalProg(6, 7); // RX, Tx
void setup() {
Serial.begin(9600);
terminalProg.begin(9600);
terminalProg.setTimeout(1000);
}

void loop() {
while (terminalProg.available()) Serial.write(terminalProg.read());
while (Serial.available()) terminalProg.write(Serial.read());
}

But when making a small Arduinoprogram like this:
#include <SoftwareSerial.h>
SoftwareSerial terminalProg(6, 7); // RX, Tx
void setup() {
Serial.begin(9600);
terminalProg.begin(9600);
terminalProg.setTimeout(3000);
}

void loop() {
while (!terminalProg);
while (!Serial);
Serial.println("ESP8266 Demo on Uno");
delay(1000);
//test if the module is ready
terminalProg.println("AT+RST");
delay(1000);
if (terminalProg.find("Ready") || terminalProg.find("ready")|| terminalProg.find("OK"))
{
Serial.println("Module is ready");
while(1);
}
else
{
Serial.println("Module have no response.");
while (1);
}
}

The esp-module don't answer. This is just driving me crazy. What am I doing wring? What is it I do not see. Thanks for you input.

Is it possible that your program isnt sending the correct line-ending characters? Like maybe you need CR+LF but you are only sending one of them.

Perhaps you should send your command then do "while(1) (while (terminalProg.available()) Serial.write(terminalProg.read()));" just to see if anything at all is returned.

:slight_smile: :slight_smile: Yepp. You were right. THANKS' a lot. the esp answer as expected. However, (revealing my lack of knowledge), how can I find a particular phrase, e.g. "ready" in that answer (see below). The "terminalProg.find" does obviuosly not work. Do you have any idea on how?
On the Serial terminal:
"
ESP8266 Demo on Uno
AT+RST


OK
p|ØÌüPu|þf‘pdÐÀ=)S¯È}‰NȇŒp²výV
Ai-Thinker Technology Co. Ltd.

ready
"

You could try using Serial.find()

http://forum.arduino.cc/index.php?topic=207773.0

:slight_smile: :slight_smile: Thanks. Now it's working. Have never really understood this Serial communication, but for now I can continue with my esp8266. Will just update the firmware to a more stable version before taking the next step.

Will just update the firmware to a more stable version before taking the next step.

If you do update the esp8266 firmware, post how you did the update. Seems the basic chips need to be updated to get the best results from them.

I made some notes about updating esp8266

http://www.ernstc.dk/arduino/esp8266.html

Thanks' a lot. I will do this on Tuesday next week. Have to do some family "duties" during the weekend.

Erni,
I read your link and downloaded the "ESP FLASH DOWLOAD TOOL 2.3". I'd like to use to AT command set (at least initially), but do you know where I can find the bin-files to download. I've been looking for AI-thinker firmware every where, but I cannot find any bin-files that I believe are the right ones.

Do you (or anyone else) know where I can find it/them?

I don't use AT commands myself anymore, but there is a subforum on the esp8266 forum for AT - commands.

Maybe this will help

http://www.esp8266.com/viewtopic.php?f=14&t=4341

Also I think I used this site, although I don't know how updated it is

http://www.electrodragon.com/w/ESP8266_AT-command_firmware