Esp8266 with arduino not working

I plugged in Arduino and upload a blank sketch based on what I've read on the internet. When I send AT commands on the Serial Monitor. I tried all baudrate and both CR and NL and only CR. But still no response from the Serial Monitor. Help me with this problem I've also tried other coded for it but still not working. Thank you!

Uploading a blank sketch to the ESP8266 will erase the AT firmware. But you should provide more information what you did so far. Otherwise its poking in the fog...

/Joe

JoeSto: Uploading a blank sketch to the ESP8266 will erase the AT firmware. But you should provide more information what you did so far. Otherwise its poking in the fog...

/Joe

I think he downloaded a blank sketch to an Arduino Uno which is suggestion found in many tutorials.

This is so that he can use the Arduino as a USB-to-serial adapter.

donmarlon:
I plugged in Arduino and upload a blank sketch based on what I’ve read on the internet. When I send AT commands on the Serial Monitor. I tried all baudrate and both CR and NL and only CR. But still no response from the Serial Monitor.
Help me with this problem I’ve also tried other coded for it but still not working.
Thank you!

Did you install the ESP8266 software using the Arduino IDE’s Board Manager?
Instructions at https://github.com/esp8266/Arduino

Arduino Uno RX <—> ESP8266 RX
Arduino Uno TX <—> ESP8266 TX

I bought at 3.3V power supply for the ESP8266, though others report no problems using the Arduino’s 3.3V outpout.

#include <SoftwareSerial.h>

#define DEBUG true

SoftwareSerial esp8266(2,3); // make RX Arduino line is pin 2, make TX Arduino line is pin 3.
                            // This means that you need to connect the TX line from the esp to the Arduino's pin 2
                            // and the RX line from the esp to the Arduino's pin 3
void setup()
{
 Serial.begin(9600);
 esp8266.begin(115200); // your esp's baud rate might be different
 

 
 sendData("AT+RST\r\n",2000,DEBUG); // reset module
 sendData("AT+CWMODE=2\r\n",1000,DEBUG); // configure as access point
 sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address
 sendData("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections
 sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80
}

void loop()
{
 if(esp8266.available()) // check if the esp is sending a message 
 {
   /*
   while(esp8266.available())
   {
     // The esp has data so display its output to the serial window 
     char c = esp8266.read(); // read the next character.
     Serial.write(c);
   } */
   
   if(esp8266.find("+IPD,"))
   {
    delay(1000);

    int connectionId = esp8266.read()-48; // subtract 48 because the read() function returns 
                                          // the ASCII decimal value and 0 (the first decimal number) starts at 48
    
    String webpage = "<h1>Hello</h1>&lth2>World!</h2><button>LED1</button>";

    String cipSend = "AT+CIPSEND=";
    cipSend += connectionId;
    cipSend += ",";
    cipSend +=webpage.length();
    cipSend +="\r\n";
    
    sendData(cipSend,1000,DEBUG);
    sendData(webpage,1000,DEBUG);
    
    webpage="<button>LED2</button>";
    
    cipSend = "AT+CIPSEND=";
    cipSend += connectionId;
    cipSend += ",";
    cipSend +=webpage.length();
    cipSend +="\r\n";
    
    sendData(cipSend,1000,DEBUG);
    sendData(webpage,1000,DEBUG);

    String closeCommand = "AT+CIPCLOSE="; 
    closeCommand+=connectionId; // append connection id
    closeCommand+="\r\n";
    
    sendData(closeCommand,3000,DEBUG);
   }
 }
}


String sendData(String command, const int timeout, boolean debug)
{
   String response = "";
   
   esp8266.print(command); // send the read character to the esp8266
   
   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;
}

I tried this code from the i got from the internet but this attached photo is the response of the Serial Monitor

#include <SoftwareSerial.h>

SoftwareSerial esp8266(2,3); // make RX Arduino line is pin 2, make TX Arduino line is pin 3.
                            // This means that you need to connect the TX line from the esp to the Arduino's pin 2
                            // and the RX line from the esp to the Arduino's pin 3
void setup()
{
 Serial.begin(9600);
 esp8266.begin(115200); // your esp's baud rate might be different
}

void loop()
{
 if(esp8266.available()) // check if the esp is sending a message 
 {
   while(esp8266.available())
   {
     // The esp has data so display its output to the serial window 
     char c = esp8266.read(); // read the next character.
     Serial.write(c);
   }  
 }
 

 
 if(Serial.available())
 {
   // the following delay is required because otherwise the arduino will read the first letter of the command but not the rest
   // In other words without the delay if you use AT+RST, for example, the Arduino will read the letter A send it, then read the rest and send it
   // but we want to send everything at the same time.
   delay(1000); 
   
   String command="";
   
   while(Serial.available()) // read the command character by character
   {
       // read one character
     command+=(char)Serial.read();
   }
   esp8266.println(command); // send the read character to the esp8266
 }
}

``
I tried this code too and the response of serial monitor is this at the baudrate of 9600 on the attachment I uploaded

I am not sure what your intentions when posting code.
I asked you a specific question.

When posting code, learn how to use the code tags

</>

As having gone through this rather painful exercise recently with the ESP8266 ESP-01, I highly recommend purchasing a USB-to-serial aka USB-to-TTL converter.

Trying to debug communication to the ESP8266 is a major pain in the butt without one unless you have a Mega 2560 with extra hardware serial ports.

ieee488:
Did you install the ESP8266 software using the Arduino IDE’s Board Manager?
Instructions at https://github.com/esp8266/Arduino

Arduino Uno RX <—> ESP8266 RX
Arduino Uno TX <—> ESP8266 TX

I bought at 3.3V power supply for the ESP8266, though others report no problems using the Arduino’s 3.3V outpout.

Yes, I’ve installed that but I think it won’t work for me because I don’t have USB-TTL. On allaboutee videos it’s all working but when I try it myself, It just frustrates me. This is really pain in my ass. Anyway, Thanks a lot buddy.

donmarlon: Yes, I've installed that but I think it won't work for me because I don't have USB-TTL. On allaboutee videos it's all working but when I try it myself, It just frustrates me. This is really pain in my ass. Anyway, Thanks a lot buddy.

I fell you pain.

None. Not one of the tutorials I read made mention of the ESP8266 software.

That took many hours before I got over that hurdle.

If you have an Arduino Uno with the DIP, then remove it completely. That's what I did. You have your USB-to-serial converter.

Then use the Serial Monitor to try to communicate with the ESP-01.

115200 baud and CR+LF worked for me.

Do you have a dedicated 3.3V power supply? You need it! The ESP-01 is draws more current than the Arduino 3.3V can provide.

ieee488: I fell you pain.

None. Not one of the tutorials I read made mention of the ESP8266 software.

That took many hours before I got over that hurdle.

If you have an Arduino Uno with the DIP, then remove it completely. That's what I did. You have your USB-to-serial converter.

Then use the Serial Monitor to try to communicate with the ESP-01.

115200 baud and CR+LF worked for me.

Do you have a dedicated 3.3V power supply? You need it! The ESP-01 is draws more current than the Arduino 3.3V can provide.

I have regulator circuit for 3.3v to supply the esp01. I'll try to use separate supply to the esp8266 not the supply coming from the arduino uno. Thanks a lot!

Thanks its working now.

donmarlon:
Thanks its working now.

So, what is your next step?

I have working setup, but using the ESP-01 as a web client is proving to be a challenge.

ieee488: So, what is your next step?

I have working setup, but using the ESP-01 as a web client is proving to be a challenge.

I have a project vending machine and I want to connect it with mysql and display real time clock and every purchase on webpage. We want exact like this but I have no idea to do it https://www.youtube.com/watch?v=jkzVLD5hfIU