Go Down

Topic: Arduino Leonardo and duinotech Wifi Shield (Read 3723 times) previous topic - next topic


Hi, just want to say thank you @pert for this post and replies, first time Arduino Uno tinkerer and went from "Blink" to "WebServerLed" in a few steps :) admittedly went to bed at 2AM but it worked! Cheers :D


Thousand thanks to Pert for your clear and useful explanations.

I start with Arduino and for a few days with Wifi. I can connect the Arduino Mega with the shield and exchange AT commands. However, I noticed that my module does not include many AT commands. So, before going further in my project, I want to go on a healthy basis with a recent firmware. But I can not change the firmware.

I have the shield XC-4614 ESP13 (Chinese) produced by Doit, with ESP8266-13 from AI-Thinker. I notice that this module can not be upgraded according to the instructions of Doit. So, I wanted to change the firmware AI-thinker by Espressif one. Espressif offers much more information. I do not have the features of the ESP-13 module. It seems close to Espressif ESP Wroom-02 derived from ESP 8266EX: 80 MHz, 16Mbits.

I followed the instructions of message # 25 and 26 from Pert. I tried several cases (40/80 MHz, QIO / DIO, 16Mbits, SpiAutoSet, COM XX, 115200 Bd)). I used the files of the version esp8266_nonos_sdk_v2.0.0_16_08_10 and the parameters of "ESP8266 AT Instruction Set" PDF (finally, I tried all the settings). The update always fail after a few seconds, with the message:

Do you have an idea ? I do not know what to do ;)


Sorry for my bad English.


You forgot this step
  • Click the first 6 checkboxes on the left side

Note that it previously said "5 checkboxes" but I'm pretty sure that was a typo I made so I've updated it to 6 since there are 6 files.

I'm not sure whether this is actually the cause of your problem but it's definitely worth a try. I believe if the checkboxes aren't checked then it won't flash the ESP8266 with those files, which it definitely needs to do.


Nov 07, 2017, 11:39 am Last Edit: Nov 07, 2017, 12:35 pm by denisio
Thank you Pert for your help.

Sorry, an error! I have tested so many protocols that I am not sure of myself anymore. I did not correctly interpret the sentence in the post # 26 "In the Download Path Config section, make sure all checkboxes on the left side are unchecked".

I just tested with the boxes checked. Unfortunately, the connection aborts after 20 seconds and I have the same error message:
"[2017-05-25 11: 16: 56,190] [ESP8266Loader_spi [1]] [espDownloader.pyo] [line: 343] [ERROR]: Chip Sync error: Failed to connect to ESP8266: Waiting for packet header
[2017-11-07 11: 16: 56,190] [ESP8266Loader_spi [1]] [espDownloader.pyo] [line: 389] [error]: ESP8266 Chip sync error esp_sync_blocking. "

This XC4614 shield is really complicated. I also wonder if I have not damaged a component with a bad connection before. I will order a new ESP / shield to be sure.
If you had to start a new project, which simple model (for novice, without need of resistance and capacitor) would you choose today? For use in a small installation (equipment of aquariums) composed of several modules communicating with a master connected to the Internet ?

Thank you.


Only today have I successfully re-flashedan ESP8266.   But today alone I've probably made 50 - 75 flash attempts.

I find that it's rare that I get through a flash without having to restart it a number of times.

There are posts that suggest capacitors in the right place help smooth out that issue.


@OfficialEnlightGames you should really take the time to understand what every line of the sketch does.

Code: [Select]
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX

This checks if the board you're using has a second hardware serial interface available (Serial1). If not it assumes you are going to be using software serial on pins 6 and 7 and names the SoftwareSerial object Serial1 (not to be confused with the hardware serial object of that same name). If a second hardware serial interface is available on the board you're using then it will be used. Since the Uno doesn't have a second hardware serial interface that code will cause the sketch to use software serial. If you have the shield plugged into your Uno then it's connected to Serial, not pin 6 and 7 so this will not work. In that case you need to delete the lines of code shown above, as you guessed, but you also need to make another change.

Code: [Select]
WiFi.init(&Serial1);    // initialize ESP module
That line passes the serial object to the WiFiEsp library so it can use it to communicate with the ESP8266. Since the ESP8266 is connected to Serial on your Uno, not Serial1 that is wrong. You need to change it to:
Code: [Select]
WiFi.init(&Serial);    // initialize ESP module

As I said in my previous reply, you also need to edit the library source code to turn off debug output as this is also sent to Serial and will interfere with communication with the ESP8266. Follow these steps:
  • File > Examples > WiFiESP > ConnectWPA
  • Sketch > Show Sketch Folder - this will open the folder {sketchbook}/libraries/WiFiEsp/examples/ConnectWPA
  • Navigate to {sketchbook}/libraries/WiFiEsp/src/utility
  • Open debug.h in a text editor
  • Change line 31 from:

Code: [Select]
#define _ESPLOGLEVEL_ 3
Code: [Select]
#define _ESPLOGLEVEL_ 0
  • Save the file

Keep in mind that you can have debug output turned on in the WiFiEsp library when you're using it with your Leonardo so you may want to revert this change if you need to do troubleshooting in that configuration but otherwise I recommend always having debug output turned off as it uses a lot of memory and slows down your Arduino.
@Pert just wanted to say thank-you reviewing your posts has got me further than weeks of misleading information on the net.

I have disabled logging and followed your instructions as above however i too am receiving the following:

[WiFiEsp] InT
[WiFiEsp] Initializing ESP module
[WiFiEsp] Initilization successful - 1.5.4
WiFi shield not present

My code is:

WiFiEsp example: WebServerLed

A simple web server that lets you turn on and of an LED via a web page.
This sketch will print the IP address of your ESP8266 module (once connected)
to the Serial monitor. From there, you can open that address in a web browser
to turn on and off the LED on pin 13.

For more details see: http://yaab-arduino.blogspot.com/p/wifiesp.html

#include "WiFiEsp.h"

char ssid[] = "xxxxxxxxxx";            // your network SSID (name)
char pass[] = "xxxxxxxxx";        // your network password
int status = WL_IDLE_STATUS;

int ledStatus = LOW;

WiFiEspServer server(80);

// use a ring buffer to increase speed and reduce memory allocation
RingBuffer buf(8);

void setup()
 Serial.begin(115200);   // initialize serial for debugging
 Serial.begin(115200);    // initialize serial for ESP module
 WiFi.init(&Serial);    // initialize ESP module

 while(!Serial){}    //wont run toll serial monitor is opened
 // check for the presence of the shield
 if (WiFi.status() == WL_NO_SHIELD) {
   Serial.println("WiFi shield not present");
   // don't continue
   while (true);

 // attempt to connect to WiFi network
 while (status != WL_CONNECTED) {
   Serial.print("Attempting to connect to WPA SSID: ");
   // Connect to WPA/WPA2 network
   status = WiFi.begin(ssid, pass);

 Serial.println("You're connected to the network");
 // start the web server on port 80

void loop()
 WiFiEspClient client = server.available();  // listen for incoming clients

 if (client) {                               // if you get a client,
   Serial.println("New client");             // print a message out the serial port
   buf.init();                               // initialize the circular buffer
   while (client.connected()) {              // loop while the client's connected
     if (client.available()) {               // if there's bytes to read from the client,
       char c = client.read();               // read a byte, then
       buf.push(c);                          // push it to the ring buffer

       // printing the stream to the serial monitor will slow down
       // the receiving of data from the ESP filling the serial buffer
       // you got two newline characters in a row
       // that's the end of the HTTP request, so send a response
       if (buf.endsWith("\r\n\r\n")) {

       // Check to see if the client request was "GET /H" or "GET /L":
       if (buf.endsWith("GET /H")) {
         Serial.println("Turn led ON");
         ledStatus = HIGH;
         digitalWrite(13, HIGH);
       else if (buf.endsWith("GET /L")) {
         Serial.println("Turn led OFF");
         ledStatus = LOW;
         digitalWrite(13, LOW);
   // close the connection
   Serial.println("Client disconnected");

void sendHttpResponse(WiFiEspClient client)
 // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
 // and a content-type so the client knows what's coming, then a blank line:
 client.println("HTTP/1.1 200 OK");
 // the content of the HTTP response follows the header:
 client.print("The LED is ");
 client.println("Click <a href=\"/H\">here</a> turn the LED on<br>");
 client.println("Click <a href=\"/L\">here</a> turn the LED off<br>");
 // The HTTP response ends with another blank line:

void printWifiStatus()
 // print the SSID of the network you're attached to
 Serial.print("SSID: ");

 // print your WiFi shield's IP address
 IPAddress ip = WiFi.localIP();
 Serial.print("IP Address: ");

 // print where to go in the browser
 Serial.print("To see this page in action, open a browser to http://");

Any help would be appreciated..


Go Up