Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By tainara
#43558 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: Select all#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: Select all// 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:
Image
(photo from FILIPEFLOP, the site from where I got the code and this is what showed in their experience)

Some adds:

Physical connection scheme:
Image
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.
* I didn’t use the push buttons part.

Someone could help me with that please?
User avatar
By Real_Zeus
#43590 You definitely need "5V to 3.3V DC-DC Step-Down Power Supply".
I had the same problem. Arduino cannot provide enough power on 3.3V.

Alternatively you could try (AT YOUR RISK) to power on ESP with 5V.
My ESP has survived short tests with 5V during initial development and after that I used the converter.

Besides that initialization of ESP over SoftwareSerial is not trivial.
Here is my code:
Code: Select allvoid setup() {
  wifiBegin(115200);
  wifi.println("AT+CIOBAUD=9600");
  wifiDropFully();

  wifiBegin(9600);
  wifi.println("AT+RST");
  wifiDropFully();

  do {
    wifi.println("AT+RST");
  } while(!wifiFind("ready", 10));
  ...
}

void wifiBegin(long boud) {
  wifi.begin(boud);
  while (!wifi) ;
}
void wifiDropFully() {
  int empty;
  do {
    delay(1000);
    empty = true;
    while(wifi.available() > 0) {
      empty = false;
      wifi.read();
    }
  } while(!empty);
}
User avatar
By JIKJ
#50435 HI Tainara!

Could you please help me with it, I really don't know what to do any more.

I got my ESP8266 one month ago, and I still didn't use Wi-Fi. I tried programing it with FTDI, I don't know if was that the problem.

Is that a Firmware thing or some thing else?

Thank you very much!
You do not have the required permissions to view the files attached to this post.