ESP8266 ESP-12E UART WIFI Wireless Shield Development Board For Arduino UNO R3

I'm trying to get the Arduino Uno to work with the ESP8266 ESP-12E UART WIFI Wireless Shield Development Board For Arduino UNO R3 connected to it.

I'm using the following:
Arduino Uno (confirmed working with simple blink test)
ESP8266 ESP-12E UART WIFI Wireless Shield Development Board For Arduino UNO R3 (image here)
USB to TTL Serial

I have researched several threads regarding this shield. Many are having issues with serial definition. I do not have alot of serial (hardware) experience but am a programmer by profession so I understand some.

I've read and tried following the suggestions mentioned in the following of threads:

https://forum.arduino.cc/index.php?topic=356174.15

This thread seemed most helpful: help with ESP-12E ESP8266 UART WIFI Wireless Shield for Arduino UNO R3 - Project Guidance - Arduino Forum

I'm using the following sketch to test with connection specific details redacted

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 *
 * This example shows how to use ESP8266 Shield (with AT commands)
 * to connect your project to Blynk.
 *
 * Note: Ensure a stable serial connection to ESP8266!
 *       Firmware version 1.0.0 (AT v0.22) is needed.
 *       You can change ESP baud rate. Connect to AT console and call:
 *           AT+UART_DEF=9600,8,1,0,0
 *       In general, Soft Serial may be unstable.
 *       It is highly recommended to switch to Hard Serial.
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 * Feel free to apply it to any other example. It's simple!
 *
 **************************************************************/

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

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "<redacted>";
char pass[] = "<redacted>";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(0, 1); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

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

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

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

I upload this code setting my Arduino IDE to use Board Arduino/Genuino Uno on COM 6 (Uno USB port).
I also have a USB to TTL Serial connected to the Wifi Shield showing up as COM 7

I have also tried disconnecting the shield and setting the Arduino IDE to use Board NodeMCU 1.0 and the USB to TTL Serial port COM 7 as specified in the first thread mentioned above but that always results in a series of espcomm open, sync, and upload fails. I've only found the upload successful when connecting the shield to the Uno and setting board type to Arduino/Genuino Uno.

I upload the code setting the first 2 dip switches down and the last 2 up.

The code successfully uploads and shows the following in the serial output with the last 3 lines repeating continuously:

[9] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.3 on Arduino Uno

  Give Blynk a Github star! => https://github.com/blynkkk/blynk-library

[523] Connecting to <redacted>
AT
[1533] ESP is not responding
AT+CIPCLOSE=1
AT+CIPCLOSE=1
AT+CIPSTART=1,"TCP","blynk-cloud.com",80
AT+CIPCLOSE=1
AT+CIPCLOSE=1

It even shows this output even when I set the first 2 dip switches back to on and reset the shield and arduino.

I'm thoroughly confused on what I need to define as the serial connections and whether I need to use a software serial or whether I need to upload 2 different sketches, one for the wifi sheild and one for the arduino. I've tried so many things at this point, I'm just overly confusing myself now and realize I need some help. Username pert seems to know alot about this particular type of shield and I have been following along in the main thread about this shield but I'm now just stuck on getting the ESP to respond (seen in serial monitor output above).

If someone would have the patience to help me through this issue or just provide a high level step-by-step on the configuration settings that need to be set or changed in order to make this work, I would be very grateful and would consider posting a comprehensive step-by-step guide to setting up one of these shields with an uno for people like me in the future.

Thank you for your time.

When you have the shield directly plugged into the Uno, Serial is used to communicate between the Uno and the ESP8266. But you're also using Serial to output debug information to the Serial Monitor. In my experience that always causes problems. Without any debug output, you're flying blind until you can connect the ESP8266 to the network, at which time you can start using WiFi for debug output.

davie_gravy:
I also have a USB to TTL Serial connected to the Wifi Shield showing up as COM 7

I have also tried disconnecting the shield and setting the Arduino IDE to use Board NodeMCU 1.0 and the USB to TTL Serial port COM 7 as specified in the first thread mentioned above but that always results in a series of espcomm open, sync, and upload fails.

You need to understand that the shield comes with the AT firmware installed on the ESP8266. That is the firmware required by the Blynk code you're trying to use. When you upload a sketch to the ESP8266 you overwrite the AT firmware (your sketch is the firmware now). Once you do that you're going to have to go through a complex process to replace the AT firmware. It's certainly doable and it's fairly well documented but if you're already confused then installing the AT firmware will be a nightmare for you. So, if you haven't already uploaded a sketch to the ESP8266, stop trying!!!

Normally I would never recommend a beginner to connect a USB to TTL serial adapter to the ESP8266 on their shield but since you already have it connected, you might try this just to see what happens:

  • Plug in the USB to TTL serial adapter to your computer.
  • Tools > Port > select the COM port of the USB to TTL serial adapter
  • Tools > Serial Monitor
  • Select 115200 from the menu at the bottom right corner of Serial Monitor.
  • Select "Both NL & CR" from the line ending menu at the bottom of Serial Monitor
  • In the input field at the top of Serial Monitor, type AT and press Enter. The ESP8266 should respond "OK" in the Serial Monitor.
  • In the input field at the top of Serial Monitor, type AT+GMR and press Enter. The ESP8266 should respond by printing the AT firmware version in the Serial Monitor.

If that all goes as planned you can be confident that the AT firmware is indeed installed, despite your earlier attempts to erase it. After that, remove the USB to TTL serial adapter from the ESP8266. The only reason you would want to upload to the ESP8266 on the shield is if you wanted to use a custom firmware. Since you are currently trying to use code that requires the AT firmware, you don't want to do that.

davie_gravy:
It even shows this output even when I set the first 2 dip switches back to on and reset the shield and arduino.

This shouldn't be an "even". When you set those switches to the off position you are cutting off communication between the Uno and the ESP8266. That's necessary during the upload because you're uploading to the UNO over the same Serial pins that are used for communication between the Uno and ESP8266 so if the ESP8266 is also connected on those pins at the same time it can interfere with the upload. But once the upload is finished you need to reconnect communication between the Uno and ESP8266, otherwise the shield is useless.

davie_gravy:
I'm thoroughly confused on what I need to define as the serial connections

Communication with the ESP8266 is Serial. Don't use Serial for anything else. Remove all debug prints to Serial and don't even have the Serial Monitor open while you're using the shield. Yes, that's a nightmare, but so is the alternative of using software serial. You can use the LED on pin 13 as a crude debug output. Different lengths of blinks on the LED can indicate different things. Some people even go so far as to blink Morse code.

I think the best option for using this shield is to put it on an Arduino Leonardo instead of Uno. The Leonardo has Serial1 on the pins 0 and 1 used by the shield instead of Serial as on the Uno and Mega. That means you can continue to use Serial for debug output and dedicate Serial1 to communication with the ESP8266. That said, it's certainly possible to use the shield with an Uno.

Thank you for your reply pert. I'm at work but will try your suggestions when I get home. I was never able to get any responses when entering AT commands into the serial monitor console on Uno COM port or USB TTL port. Yet, I have tried so many different configurations, I'm not sure if I had it right at one time and just didn't know what to expect or how to perform the test properly. I'm betting I didn't wipe out the AT firmware as I was never able to get the Arduino IDE to successfully upload to shield. It would error out with espcomm errors (setting Board Model to NodeMCU [as specified on the medium.com tutorial). I'm going to try the steps you mentioned to see if I can get the shield to respond to me. Thanks for that.

In review here:

  • I only need to upload/maintain 1 sketch, the one I upload to the Uno. The wifi shield does not need any upload assuming I didn't wipe out the AT firmware. That helps alot since I read some articles illustrating that I needed to upload a separate sketch for both the Uno (using the Software Serial) and the shield (utilizing the wifi code).

  • First 2 dip switches down when uploading, then up when running. Are the last 2 switches always up regardless or do I need to switch those down when the others are up? I'm assuming since I'm not wanting to flash the device that those 2 switches will always remain in the on position based on the manufacturer documentation?

When P3 is ON, ESP8266 normal operation mode.
When P3 is OFF, ESP8266 firmware brush to write mode (DFU),
At this point can ESP8266 firmware upgrade.
 P4 DIP is under ESP8266 DFU mode onboard LED switch
Set to ON to use.

  • Do I need to modify my sketch any? Should Serial.begin(9600); should be commented out? Just a tad bit confused here as I see Serial is defined as a ESPSerial type but then I see both a Serial.begin and a ESPSerial.begin.

  • Since I can't use the serial monitor when testing the sketch, should I just expect to see a wifi DHCP client on my network? I was using Advanced IP Scanner to see if the device was getting on the router/network.

After I posted the thread last night, I continued to mess with the shield. I did happen to notice I got a Wifi Access Point showing up AI-THINKER_XXXXX (with X's representing some alpha id string). I was never able to connect to the access point successfully as it kept prompting me for a password. I searched the web over trying to find a default password to that ID, but was unsuccessful. I'm not sure if that SSID showing up is a good thing and I'm on to something or just some confusing side effect.

I appreciate your response pert. If I can get this working, I want to write up a more comprehensive article illustrating step-by-step how to configure and test out this shield with an UNO as most of the documentation and articles online show vastly different implementation methods.

I cannot send AT commands to the shield when connected using the USB to TTL. It seems that though I may have messed up the firmware on the shield. I can't necessarily guarantee it didn't come that way too. Obviously, there's a real good chance my experimentation last night has bricked this shield.

I followed this guide to attempt to flash the firmware on the wifi shield.

I either get just a fail on connecting to the COM port or I get an invalid head of packet when attempting to flash using the esp8266 flasher.

I tried flashing using USB to TTL port exclusively and using the method depicted in the guide. I notice the guide method where I have RX and TX of the UNO going to RX and TX on the shield attempts to write the binary file as I see the LEDS flash up and the 8266 chip blink blue, but it then just fails out no error message, no esp8266 flasher log file. I even tried resetting the shield to verify a clean connection and running the flasher as administrator.

Any information you could provide on how to flash this shield would be greatly appreciated.

davie_gravy:
Any information you could provide on how to flash this shield would be greatly appreciated.

Here's everything I know about flashing AT firmware to the ESP8266:
https://forum.arduino.cc/index.php?topic=466167.msg3208886#msg3208886
Those instructions are specific to a different ESP8266 shield but they should also work for your shield with slight adaptations.