I am creating a web server with Arduino and a ESP-13 WiFi shield. The wiring is as following:

Arduino UNO || ESP-13 WiFi shield
5V          || .5V
GND         || GND
TX          || RX
RX          || TX
            || GPIO 0 to GND

When I run my code, I get an error. The error is

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

I have tried many videos, tests and rewiring but nothing is working. If this would help, before I upload my code, the led on the wifi shield is red. When I am uploading my code, the Arduino Uno flashes between the RX and TX leds. The code:

#include <ESP8266WiFi.h>

 * Project: ArduinoBasics WiFi Scanner
 * Author:  Scott C
 * Date created: 16 September 2018
 * Arduino IDE version: 1.8.5
 * Operating System: Windows 10 Pro
 * Description: 
 * The ESP-13 WiFi shield will create an Access Point that you can connect to 
 * using your phone/tablet/PC. Once connected via WiFi, navigate your browser 
 * to the IP address displayed in the Serial monitor to see the list of Access Points in your area.
 * Acknowledgements:
 * Some of the code used within this sketch was inspired by or adapted from other notable sources.
 *    Webserver code: adapted from https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/server-examples.html
 *    WiFi scanner code adapted from tablatronix : https://gist.github.com/tablatronix/497f3b299e0f212fc171ac5662fa7b42
 *    HTTP/1.1 protocols: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
 * -------------------------------------------------------------------------   
 * Libraries used: ESP8266WiFi.h  - installed with Boards Manager : https://github.com/esp8266/Arduino
 * More information about ESP8266WiFi.h library : 
 * https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/readme.html
 * https://arduino-esp8266.readthedocs.io/en/2.4.2/libraries.html#wifi-esp8266wifi-library
 * The SSID and Password for the Access point (AP) that will be created by the ESP-13 WiFi shield
 * The WiFi server which will listen for Clients on Port 80 (eg. Web Browsers)
 ============================================================================ */

const char* ssid = "PinkFluffyUnicorn";
const char* password = "12345678";
WiFiServer server(80);

/* ==========================================================================
 * Begin Serial Communication using a Baud Rate of 115200
 * Configure the ESP-13 WiFi shield into Access Point Mode
 * Create an Access Point for devices to connect to.
 * Display the Access Point (AP) IP address in the Serial monitor.
 * Start the server if the Access Point has been created successfully
 ============================================================================ */
void setup() {
  // put your setup code here, to run once:
  boolean r = WiFi.softAP(ssid, password);

  if (r) {
    Serial.print("Please connect to the Access Point: ");
    Serial.printf("then open %s in a web browser\n", WiFi.softAPIP().toString().c_str());
  } else {
    Serial.println("FAILED to create Access Point");

/* ==========================================================================
 * LOOP:
 * Start listening for Clients
 * Notify when a Client connects to the server using the Serial Monitor
 * Then write any request messages from the client to the Serial Monitor
 * Wait for the client to send through an empty line, then
 * Serve the constructed HTML page to the client
 * The delay gives the browser some time to receive the HTML page, before
 * the server dicsonnects from the client.
 * Notify when the client has been disconnected.
 ============================================================================ */
void loop() {
  WiFiClient client = server.available();
    Serial.println("\n A Client just connected to the server");
    while(client.connected()) {
        String clientMessage = client.readStringUntil('\r');
        if(clientMessage.length() == 1 && clientMessage[0] =='\n') {
    Serial.println("\n The server has disconnected the Client");

/* ==========================================================================
 *SCAN for available WiFi networks within range of the ESP-13 WiFi Shield
 *Construct the necessary HTTP response and HTML to 
 *  - display the SCAN results within a web browser (client).
 *  - automatically refresh the HTML page every 5 seconds.
 *The HTML page will display the following information in a table:
 *  - SSID, 
 *  - Signal Strength and 
 *  - Encryption type.
 ============================================================================ */
String constructHTMLpage(){
  int numSSID = WiFi.scanNetworks();
  String HTMLpage = String("HTTP/1.1 200 OK\r\n") +
                            "Content-Type: text/html\r\n" +
                            "Connection: close\r\n" +
                            "Refresh: 5\r\n" +
                            "\r\n" +
                            "<!DOCTYPE HTML>" +
                            "<html><body>\r\n" +
                            "<h2>WIFI NETWORKS</h2>\r\n" +
                            "<table><tr><th>SSID</th><th>Signal Strength</th><th>Encryption type</th></tr>\r\n";

  for(int i=0; i<numSSID; i++){
    HTMLpage = HTMLpage + String("<tr><td>");
    HTMLpage = HTMLpage + String(WiFi.SSID(i));
    HTMLpage = HTMLpage + String("</td><td>");
    HTMLpage = HTMLpage + String(WiFi.RSSI(i));
    HTMLpage = HTMLpage + String("</td><td>");
    HTMLpage = HTMLpage + String(encryptionTypeStr(WiFi.encryptionType(i)));
    HTMLpage = HTMLpage + String(" [");
    HTMLpage = HTMLpage + String(WiFi.encryptionType(i));
    HTMLpage = HTMLpage + String("]");
    HTMLpage = HTMLpage + String("</td></tr>");
  HTMLpage = HTMLpage + String("</table></body></html>\r\n");
  return HTMLpage;

/* ==========================================================================
 *Will accept a WiFi.encryptionType() integer and convert it into a more
 *meaningful string. 
 ============================================================================ */
String encryptionTypeStr(uint8_t authmode) {
    switch(authmode) {
        case ENC_TYPE_NONE:
            return "OPEN";
        case ENC_TYPE_WEP:
            return "WEP";
        case ENC_TYPE_TKIP:
            return "WPA_PSK";
        case ENC_TYPE_CCMP:
            return "WPA2_PSK";
        case ENC_TYPE_AUTO:
            return "WPA_WPA2_PSK";
            return "UNKOWN";

Thank you in advance.

  • Don't cross post. You already asked this on SO. – gre_gor Jan 16 '19 at 23:56
  • GPIO 0 to GND - doesn't that put the ESP into flash mode? – Jaromanda X Jan 17 '19 at 0:53
  • before you run the code you must upload it. why do you have the module wired to Uno, if you have a sketch for esp8266? I know why. You abuse the Uno as USB adapter. But then wire TX to TX, RX to RX. (and make sure the ATmega sketch doesn't have Serial.begin()) – Juraj Jan 17 '19 at 8:27
  • I deleted the Serial.begin(), but I am still getting the same error. – YYeet Jan 19 '19 at 6:41
  • Also, I've changed my wiring. I'm using a serial to usb adaptor: – YYeet Jan 19 '19 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.