Problems to communicate ESP8266 wifi module with Arduino Uno

Hello,

I am trying to use an ESP8266 module to implement a wireless communication with Arduino Uno and a computer. Though I am having initial problems to make the ESP8266 works fine.

At first I only tried a simple program to test the module with AT commands.
The code is:

#include <SoftwareSerial.h>
SoftwareSerial ESP8266(2, 3); // RX, TX
void setup()
{
Serial.begin(9600);
Serial.println("Begin"); //print on screen
ESP8266.begin(9600);
}
void loop()
{
//Communication (writing and reading data) with ESP8266 through Arduino IDE Serial Monitor
if (ESP8266.available())
Serial.write(ESP8266.read());
if (Serial.available()){
ESP8266.write(Serial.read());
}
}

But I only got the “Begin” returned when opening the Arduino IDE serial monitor and sometimes " trash" (random non-sense and non-stop characters). By sending the AT commands I don’t receive nothing back despite the indication of communication LEDs from both Arduino and ESP8266 show its on.
I tried to set other baud rates on the above program but nothing worked.

I read something about the ESP8266 padron baud rate normally being 115200 (tried that but also no results) and this high baud rate for communicating in Arduino UNO could not work that well so I got an example program to change the baud rate as by AT commands it’s not working.
The code:

// adapted by FILIPEFLOP
#include <SoftwareSerial.h>
//RX pin 2, TX pin 3
SoftwareSerial esp8266(2, 3);
#define DEBUG true
void setup()
{
  Serial.begin(9600);
  // Configure the initial speed of ESP8266
  esp8266.begin(115200);
  sendData("AT+RST\r\n", 2000, DEBUG); //Reset the module
  delay(1000);
  Serial.println("Firmware version"); //print on serial monitor
  delay(3000);
  sendData("AT+GMR\r\n", 2000, DEBUG); // requires the //firmware version
  // Configure the wanted speed for ESP8266 communication
  sendData("AT+CIOBAUD=19200\r\n", 2000, DEBUG); // (also //tried other than 19200 but no results)
  Serial.println("** End**"); //print on screen
}
void loop() {}
String sendData(String command, const int timeout, boolean debug)
{
  // Send AT commands to ESP8266
  String response = "";
  esp8266.print(command);
  long int time = millis();
  while ( (time + timeout) > millis())
  {
    while (esp8266.available())
    {
      // The esp has data so display its output to the serial window
      char c = esp8266.read(); // read the next character.
      response += c;
    }
  }
  if (debug)
  {
    Serial.print(response);
  }
  return response;
}

This also shows me on Serial Monitor only what I print “Firmware version” and “End”, nothing more, and actually it should shows something like this:

(photo from FILIPEFLOP, the site from where I got the code and this is what showed in their experience)

Some adds:
ESP8226 pin scheme

Physical connection scheme:

Also read about the ESP8266 possibly consuming more current than Arduino Uno can stand so also tried this not connecting the Vcc of ESP8226 to 3V3 Arduino pin but to the supply of an external stable source (and yes, connected the GND of the source with the Arduino, the ESP8226 and the divider GNDs) but again it didn’t work.

*Attached the ESP8266 datasheet

Someone could help me with that please?

ESP8266_Specifications_English.pdf (847 KB)

Hey,

You can try using the library we created that should solve these kinds of issues (we dealt with the baudrate issue as well). Check it out on Github - https://github.com/Circuito-io/ESP8266_SoftwareSerial or Instructables - http://www.instructables.com/id/Simple-ESP8266-Arduino-Uno-Software-Serial-Integra/ Good luck!

hi,
I am trying to communicate arduino mega with esp01 wifi module but failed. i have attached the code and the pictures of wifi module
connnects are

3.3v - vcc (arduino mega)
gnd - gnd
TX - pin 2 (according to the code)
RX - pin 3
EN - vcc

Moreover, when i connect IO2 to gnd , the module’s led goes high else if i supply just vcc and gnd, it blinks for while.
I have connect IO0 to gnd and reset to gnd, but it does not give any output.

Remember that, i am trying to test AT command,

code.txt (1.19 KB)

baahmad: connnects are

3.3v - vcc (arduino mega)

That's a problem right there, VCC on the Arduino Mega is 5V.

means should i need to use 5V vcc??? RIGHT?

You need to use 3.3v