Utilizing ESP8266 wifi module with Arduino Uno

Thread Starter

Tainara

Joined Sep 10, 2014
6
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:
Code:
#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:
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 with that please?
 

Attachments

tracecom

Joined Apr 16, 2010
3,944
Hello,

I am trying to use an ESP8266 module to implement a wireless communication with Arduino Uno and a computer.

etc., etc., etc.

Someone could help with that please?
Very few members here will read that much in a single post.

There is a procedure for programming the ESP8266 with the Arduino IDE that works. It is detailed here. There are other articles by the same author dealing with the ESP8266; perhaps one of them will help.
 

GetDeviceInfo

Joined Jun 7, 2009
2,192
I will drive an esp8266 with an RS232 convertor driven off a com port. This way you can write AT commands and receive responses on a terminal program. Once your confident things are working, program your arduino accordingly.
 

GopherT

Joined Nov 23, 2012
8,009
Very few members here will read that much in a single post.

There is a procedure for programming the ESP8266 with the Arduino IDE that works. It is detailed here. There are other articles by the same author dealing with the ESP8266; perhaps one of them will help.
The IDE is not perfect for the 8266 and development seems to have stopped about a year ago - although plenty of people are begging for it.

There is a also a method with Lua.

Note, that you need to reflash your chip if you tried the Lua or Arduino and want to go back to AT commands. Also, some suppliers don't have the default AT commands when the chip is shipped.

OP should read the link you posted.
 

Thread Starter

Tainara

Joined Sep 10, 2014
6
I already read a lot about the issue before starting the practical part, just got the same problem as many people I found when putting this theory in action. Anyway a friend shared me a program and everything else worked fine after I tried it.
 
Top