ESP8266 with Arduino Uno - Empty Serial Monitor

Hi

I just received an ESP8266 which I ordered from SparkFun (https://www.sparkfun.com/products/13678), and I'm having a hard time verifying whether it is functioning properly. I've looked at several tutorials, and videos that go over how to connect the module to an Uno, but nothing shows up in the serial monitor for me and I'm stuck at this point.

I'm using an external power supply of 4x AA batteries, with a voltage regulator to give me 3.3 V. I have Vcc(aka 3V3), CH_PD (aka EN), and RST connected to 3.3 V. I have the module connected to ground, and GPIO0 connected to 3.3 V. I have the RX and TX pins from the Uno connected to a level shifter, and then connect the RX and TX pins from the module to the respective pins to the level shifter. I've also tried swapping RX and TX around in case I had them mixed up.

When I supply power to the module the blue LED will do a quick blink, and then proceed to stay lit. When I connect GPIO0 to ground, and power the module, the LED goes straight to being solid without the initial blink. The LED leads me to think it has sufficient current, and then I haven't damaged it. There seems to be only 1 LED opposed to the additional red LED that every example seems to show.

When I open the serial monitor and power the module, I don't see the boot information. I've tried changing the baud rate in case that was an issue but regardless of which baud rate I select from the serial monitor nothing shows up. Trying to enter "AT" yields nothing in the serial monitor either.

Does anyone have any idea what I could be doing wrong?

Thanks

So you have the ESP connected to the Uno hardware serial and trying to use the same port to talk to serial monitor? If so, that will not work. You cannot have 2 devices connected to the same port. One solution is to use on of the software serial libraries and connect the ESP through that port. That will require changing the ESP's baud rate to a slower rate that software serial can handle (9600 for reliable comms). And the connection must be RX to TX, not RX to RX.

Lots of great info on the ESP.

I've connected them as shown in many examples such as these. https://forum.arduino.cc/index.php?topic=283043.0 http://www.teomaragakis.com/hardware/electronics/how-to-connect-an-esp8266-to-an-arduino-uno/

The only difference is that I'm not leaving RST, or GPIO0 unconnected, and I'm using a level shifter for both RX and TX opposed to directly connecting the ESP and Uno RX/TX pins.

The suggested procedure is to connect the ESP8266 and Uno as shown above, upload a blank sketch to the Uno, then go to Tools -> Boards -> Generic ESP8266 Module. The guides suggest that not only can you view the boot up information, but can also send AT-commands through the serial monitor.

I tried what you are suggesting with the software serial library. This sketch seems to be what you are describing. https://arduino.stackexchange.com/questions/17666/esp-8266-does-not-respond-at-all I tried to modify the baud rate in the sketch. The serial monitor shows that it is attempting to send the AT command (TX is blinking), but there is no response.

I visited the hyperlink you posted, and modified my connections based on what it suggested. I now have RST, CH_PD, and GPIO0 connected to 3.3 V through 10 K resistors. I'll upload a visual representation of the connections.

|500x322

You dont need a levels shifter from the Esp TX to Arduino RX. Try without.

You only need level shifter from Arduino TX to ESP RX

I was aware that it wasn't necessary, however I thought there would be no harm in connecting those to the level shifter as well. I now realize that connecting ESP TX and Arduino RX to the level shifter was a problem due to the fact that I had the shifter operating from A->B, so connecting ESP TX and Uno RX to the shifter was trying to go B->A but could not do so.

Thanks for pointing that out Lennyz1988, your post lead me to realize the mistake instantly. With the code taken from the stackexchange thread, I modified the baud rates to 9600 for both the serial and software serial.

Oddly enough, as soon as I read Lennyz1988 post, I connected TX from the ESP directly to RX on the Uno and saw "Got response from ESP8266: " along with some jibberish characters. However it seems to have been a one-off event as I can't replicate it again even though the connections have not changed. Very strange.

The jibberish characters are probably from the bootloader talking. It’s at baudrate 57600 and only appears upon booting of the esp. But software serial is unreliable at those baudrates. That’s probably why you cannot replicate it.

If you saw the characters, then you connection is fine. Try sending commands. Try different baudrates, but i’m guessing you should use 57600.

Sorry Lenny, I think I was just losing my marbles over all the failed attempts.
I’m able to get a consistent response from the ESP now. The one-response was due to reflashing the Arduino hastily out of joy/excitement and I failed to remember to change the pin declarations from the original sketch… whoops.

Anyway now that I have that all sorted out.
This page
describes possible baud rates to use, however I haven’t had any success.

First, your board might talk at any of several baud rates. The ones to try first are 9600 and 115200. Then 57600 and/or 76800 (38400 * 2). Note the noise when you reset the device (pull the RST pin to ground) is typically some bootup messages at 76800. But there should be a ”ready“ message at the selected baud rate if your UART Rx is wired correctly.

I’ve tried using a different combination of baud rates for serial and software serial, but I can’t seem to get an unscrambled response, and cannot see any “ready” responses. Since the sketch is sending “AT” the response I should be seeing is “OK.”
Edit: For the most part I’ve had the software serial baud set at 9600 as per groundFungus’ recommendation, but have tried it at other possible bauds such as 38400, 57600, 115200.

Here’s the sketch I have uploaded to the Uno.

#include <SoftwareSerial.h>

const byte rxPin = 0; // Wire this to Tx Pin of ESP8266
const byte txPin = 1; // Wire this to Rx Pin of ESP8266

SoftwareSerial ESP8266 (rxPin, txPin);

void setup() 
{
  Serial.begin(115200);
  ESP8266.begin(9600);  
  delay(1000);         
}

void loop() 
{
  delay(1000);
  Serial.println("Sending an AT command...");
  ESP8266.println("AT");
  delay(30);
  while (ESP8266.available())
  {
     Serial.println("...");
     String inData = ESP8266.readStringUntil('\n');
     Serial.println("Got response from ESP8266: " + inData);
  }  
}

The response output looks like this.

Sending an AT command…
Sending an AT command…

Got response from ESP8266: ‚’ò�¡!R–¶

The responses should be able to be viewed in a readable form with the way I have the module connected, shouldn’t they?

did you set the uart baudrate in the esp?

I have not, but I am a little confused as to which command to send.

http://www.esp8266.com/viewtopic.php?f=6&t=643&p=3773#p3773 says to use AT_IPR so that's what I tried. However I'm now seeing the opposite http://www.esp8266.com/viewtopic.php?f=6&t=1997

Can anyone confirm whether AT_IPR will harm the module? My module still seems to be responding, but I still have no idea what's being returned since it's not readable.

Also am I supposed to be setting the uart baud rate to be the same as the serial, or software serial baud?

...
void setup() {
  Serial.begin(115200);
  ESP8266.begin(9600);  
  delay(1000);      
}

void loop() {
  delay(1000);
  ESP8266.println("AT+UART_DEF=115200,8,1,0,0");    
  delay(30);
  if (ESP8266.available()) {
     String inData = ESP8266.readStringUntil('\n');
     Serial.println(inData);
  }  
}

If you have successfully loaded a program onto the 8266 , then following that the AT commands do not work - that's what I've found, I guess the program for that has been overwritten.

I don't believe I've loaded anything to the ESP8266 itself yet. I'm still at the point where I'm sending AT commands through serial to the module, which are working; however I am not able to see the responses from the module in a form other than strings of odd scrambled characters.

I acquired another ESP8266 module made by Seeed, which is also giving me the same results. On a side note this module happens to a have a separate LED for power and comms which is nice.

AT+UART_DEF

The software serial baud rate and the baud rate setting of the ESP must match. The Uno (hardware) serial baud rate must match the baud rate of the serial monitor.

ESP8266.println("AT+UART_DEF=115200,8,1,0,0");

Software serial will not work at 115200 baud. You set the baud rate of software serial to 9600 (ESP.begin(9600)), why set the ESP to 115200?

Juraj: AT+UART_DEF

Okay thanks I will continue trying with that command.

groundFungus: Software serial will not work at 115200 baud. You set the baud rate of software serial to 9600 (ESP.begin(9600)), why set the ESP to 115200?

That's just how the sketch was from playing around with different baud rates at the time of posting. With the software serial, and AT command using the same baud rate there is no distinguishable different when viewing the serial monitor. I will keep those two lines with the same baud rate proceeding forward though.

This is your problem

const byte rxPin = 0; // Wire this to Tx Pin of ESP8266
const byte txPin = 1; // Wire this to Rx Pin of ESP8266

You are using software serial on the hardware serial pins. Do not do that. Software serial is designed to be used with other pins than hardware serial pins.

Take any pin but 0 and/or 1.

The original sketch from stackexchange had those two lines as follows.

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

It wasn't until I changed them to 0 and 1 that I started getting "something" in the serial monitor. I tried to change them back to 2, 3 and other combinations but that just puts me back to the original issue of not seeing any responses in the serial monitor.

const byte rxPin = 4; // Wire this to Tx Pin of ESP8266
const byte txPin = 5; // Wire this to Rx Pin of ESP8266

Results in

Sending AT+UART_DEF... Sending AT+UART_DEF... Sending AT+UART_DEF... Sending AT+UART_DEF... Sending AT+UART_DEF... Sending AT+UART_DEF...

NOTE: although there is no response in the monitor, the blue LED on the module for communication is still blinking each attempt.

Whereas

const byte rxPin = 0; // Wire this to Tx Pin of ESP8266
const byte txPin = 1; // Wire this to Rx Pin of ESP8266

Results in

Sending AT+UART_DEF... Got response from ESP8266: ‚’ò�¡)R–¶ Sending AT+UART_DEF... Got response from ESP8266: ðš‡Ëšöðš‡Ëšö†‹NÖ—†2a%CÒ—ÒI– þ‹€Åú–,×ÃsëæBÿ Sending AT+UART_DEF... Got response from ESP8266: s᢮=îÖÿÿbþ Sending AT+UART_DEF... Got response from ESP8266: sá¢yÿ Sending AT+UART_DEF... Got response from ESP8266: sé²ñ Sending AT+UART_DEF... Got response from ESP8266: së–ù Sending AT+UART_DEF...

I appreciate your continued support lenny.

you should set the baudrate in ESP before starting the skech. can you send AT commands to ESP from Serial Monitor? with _DEF is the command version that sets it as default. you need set it only ones.

I originally was trying to do that, send AT commands myself to the ESP through the serial monitor; however at the time I had an error with the RX and TX connections which I did not realize until lenny joined the thread. I would try to send "AT" for example, and nothing would show up, not even what I had entered. I thought that was strange, and perhaps I misunderstood what groundFungus meant initially, but I thought my only other option was to integrate the software serial library since that at least was getting me somewhere it seemed.

Thank you for your post Juraj, with the connection issue resolved it just occurred to me that I have not gone back to try what I was initially going for by using the serial monitor.

I swapped the connections so RX connected to RX, and TX to TX, then connected the Uno's reset to ground. When I opened the serial monitor and powered the chip, I could instantly notice a difference - albeit still jibberish. I continued changing the baud rate in the monitor, at 74880 I saw the boot-loader and let out a sigh of relief. With the baud at 115200 I am able to send AT commands successfully!

Thank you again to everyone who participated in the thread.

On a side note, it seems that the sketch which was using software serial to talk to the ESP and send the AT commands was indeed working. Unless it's just a coincidence that the serial monitor baud needed to be at 115200, seeing as the sketch was issuing following command.

ESP8266.println("AT+UART_DEF=115200,8,1,0,0");

If I can get the software serial method working and readable I will post my findings on what was wrong.

there is a library that hides the networking AT commands behind standard Arduino networking api: WiFiEsp

Thanks for sharing, that will definitely be useful down the road as I will need to send and receive data with the ESP8266.

Currently I’m having issues uploading sketches to the ESP via Arduino IDE, which seems to be an issue several people experience from googling the topic so far. But that’s for another thread, if I end up not finding a solution on my own.