ESP8266-Arduino Getting Started

Hi there,

I am new to arduino and recently I have bought a ESP8266 wifi Schield. I uploaded the following program to the arduino

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266.h>
#include <BlynkSimpleShieldEsp8266.h>

// Set ESP8266 Serial object
//#define EspSerial Serial1

// This can be a SoftwareSerial object
// (remember to also edit ESP8266.h):
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(0,1); // RX, TX
#define EspSerial SwSerial

ESP8266 wifi(EspSerial);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "39d2704e6d824930a5e348ecfd953e55";

void setup()
{
  Serial.begin(115200);   // Set console baud rate
  while (!Serial) {}

 EspSerial.begin(115200);  // Set ESP8266 baud rate
 while (!EspSerial) {}

  Blynk.begin(auth, wifi, "HITRON-8090", "81KLKP7154XB");
}

void loop()
{
  Blynk.run();
}

But receives the following Error on Serial monitor

[0] Blynk v0.2.2-beta
[0] Connecting to HITRON-8090
[1026] Failed to disable Echo

I would really love to see the communication going on through blynk. Could anyone help in resolving this problem. Thanks in advance.

[UPD: “Failed to disable echo” will most probably be reported as “ESP is not responding” now]

Hi,

i have the same problem. One think you can do is change pins of soft serial (0, 1) because you use the same pins as for hardware serial

1 Like

Ya I have tried it too… No success…

I had the same problem. The Arduino TX must connect to the ESP8266 RX and vice versa. I had TX to TX and RX to RX and I received the dreaded “Failed to disable echo” (happened when I switched from breadboard to shield).

How I corectly conect esp8266 do arduino? How pins numbers?

If you use SOftSeria, anything which is NOT 0 and 1, and with Hardware serial you use 1 and 0, but your console wont be usable (unless you use a arduino Mega with more than hardware serial port)

I am working on a tutorial for connecting to Blynk using ESP8266 as an Arduino wifi shield. I should be done with it by tomorrow or the day after

5 Likes

really !!! , i will keep watching i waste more than 30 hour without any hope.
Bookmarked your Post.

hi man how i can modify the librery because i can`t understand how can you help me?

I try the basic code for esp shield but i can`t make to work.
Arduino: 1.6.3 (Windows 7), “Arduino Uno”
^
ESP8266_Shield.ino: At global scope:
ESP8266_Shield.ino:46:19: error: ‘Serial1’ was not declared in this scope
ESP8266_Shield.ino:51:14: note: in expansion of macro ‘EspSerial’
ESP8266_Shield.ino: In function ‘void setup()’:
ESP8266_Shield.ino:46:19: error: ‘Serial1’ was not declared in this scope
ESP8266_Shield.ino:61:3: note: in expansion of macro ‘EspSerial’
and i cant understand where i change the version for my esp (at+gmr = 0018000902-AI03 and at+rst=Version:0.9.2.4).
Can someone help me ?im new with arduino.(sorry for my English)

1 Like

@Robots can you please post your code too? Serial1 not declared means you don’t have initialized your serial object, but that’s logical because you use an Arduino Uno, It has only one serial port, the hardware one (via either the USB and/or the pins on the board (pins 0 and 1).

So I’m guessing you made some errors in your code.

1 Like

i use the basic code but i dont make the chages for my esp .i dont know how to do that.

/#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266.h>
#include <BlynkSimpleShieldEsp8266.h>

// Set ESP8266 Serial object
#define EspSerial Serial1
// This can be a SoftwareSerial object (remember to also edit ESP8266.h):
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

ESP8266 wifi(EspSerial);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

void setup()
{
  Serial.begin(9600);     // Set console baud rate
  delay(10);
  EspSerial.begin(9600);  // Set ESP8266 baud rate
  delay(10);

  Blynk.begin(auth, wifi, "ssid", "pass");
}

void loop()
{
  Blynk.run();
}
and down say:
Arduino: 1.6.3 (Windows 7), Placă"Arduino Uno"

In file included from C:\Users\Dominic\Documents\Arduino\libraries\blynk-library-0.3.0/BlynkSimpleShieldEsp8266.h:18:0,

                 from ESP8266_Shield.ino:43:

C:\Users\Dominic\Documents\Arduino\libraries\blynk-library-0.3.0/BlynkApiArduino.h: In member function 'void BlynkApi<Proto>::processCmd(const void*, size_t)':

C:\Users\Dominic\Documents\Arduino\libraries\blynk-library-0.3.0/BlynkApiArduino.h:94:82: note: #pragma message: Good! Analog pins can be referenced on this device by name.

     #pragma message("Good! Analog pins can be referenced on this device by name.")

                                                                              ^

ESP8266_Shield.ino: At global scope:

ESP8266_Shield.ino:46:19: error: ‘Serial1’ was not declared in this scope

ESP8266_Shield.ino:51:14: note: in expansion of macro ‘EspSerial’

ESP8266_Shield.ino: In function ‘void setup()’:

ESP8266_Shield.ino:46:19: error: ‘Serial1’ was not declared in this scope

ESP8266_Shield.ino:61:3: note: in expansion of macro ‘EspSerial’

Eroare de compilare

Acest raport ar avea mai multe informații cu
“Detaliază informaţiile de ieşire a compilatorului:”
Activat în Fişier > Preferinţe.
can you help me please? i`m new with arduino
thx.

So you got an ESP attached with the TX and RX pins to your Arduino Uno pins 2 and 3? If so, you have to use the SoftwareSerial and set your ESP to a much lower baudrate.

Comment out the #define EspSerial1 Serial1 and uncomment the two SoftwareSerial lines below it (and change accordingly in the .h file given in the description).

Also don’t forget to get the changed library from the comments instead of the regular ESP library.

Change the ESP baudrate with the ESP attached to a serial port (with 3.3v logic on TX and R port, NOT 5v which is what a normal serial port does!) with the command AT+CIOBAUD=9600

2 Likes

i cant undestand ..... sorry (rx and tx is 0 1 default ) and how i change the library (i dont know how to do that ) can you give me a library ?thx for help

In ESP8266.h uncomment this line:

//#define ESP8266_USE_SOFTWARE_SERIAL

When you compile/upload it, the library will use the SoftwareSerial function and you can attach the ESP to any tx/rx pins other than 0 or 1 (note to set slow speed, like 9600 baudrate for stability).

1 Like

i make the changes in his lybrary and now he give me :
Arduino: 1.6.3 (Windows 7), Placă"Arduino Uno"

In file included from ESP8266_Shield.ino:42:0:

C:\Users\Dominic\Documents\Arduino\libraries\ITEADLIB_Arduino_WeeESP8266-master/ESP8266.h:29:28: fatal error: SoftwareSerial.h: No such file or directory

#include “SoftwareSerial.h”

                        ^

whith //#include <SoftwareSerial.h>
and with #include <SoftwareSerial.h>:
ESP8266_Shield.ino: At global scope:

ESP8266_Shield.ino:46:19: error: ‘Serial1’ was not declared in this scope

ESP8266_Shield.ino:51:14: note: in expansion of macro ‘EspSerial’

ESP8266_Shield.ino: In function ‘void setup()’:

ESP8266_Shield.ino:46:19: error: ‘Serial1’ was not declared in this scope

ESP8266_Shield.ino:61:3: note: in expansion of macro ‘EspSerial’
Thank you for the time spend with me. :smile:

Change this part:

// Set ESP8266 Serial object
#define EspSerial Serial1
// This can be a SoftwareSerial object (remember to also edit ESP8266.h):
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

To:

// Set ESP8266 Serial object
//#define EspSerial Serial1
// This can be a SoftwareSerial object (remember to also edit ESP8266.h):
#include "SoftwareSerial.h" 
SoftwareSerial EspSerial(2, 3); // RX, TX

And attach rx/tx to pin 2 and 3 (rx to tx and tx to rx)

Please note the changed quotes on the library include. Somehow that works in weird way with Arduino compiler. It may have trouble finding the library.

1 Like

i upload the code and its ok but i cant connect with the app from the phone.

[19] Blynk v0.3.0
[20] Connecting to D-LinkDS
[1036] Failed to disable Echo

i rezolv man … thank you soooo much man for your help… you have skype if i wil need more informations??? Again thank you for help ,thank you.