Problem with Arduino and AT commands

First of all, hello to everybody. This is my first experience with the ESP8266 ESP-12 Module.

I have it connected to Arduino Uno R3, and I want to use it to send data from a sensor to server. Here is the thing. First I uploaded a blinking code to the ESP8266 using the Arudino IDE and the Arduino board as an UART, and it worked fine (I did this just to prove there is an initial communication between the Arduino and the Module).

After this, I flashed the ESP8266 with this flasher:

but with the v0.9.2.2 AT Firmware, and it was completed succesfuly.

Next, I upload a simple code (I will write it at the end of the post) to the Arduino, just to send “AT” through the serial monitor, and I’m expecting to receive “OK”, so that I can continue with my project. But all I get is an upside-down question mark, in other words garbage. I try with different baud-rates and I get different garbages. Important to say, if I remove both RX and TX lines from the Arduino, I still get the same garbage, so in my opinion the problem is not with the module itself, but with the configuration of the Arduino, most possibly the code.

The hardware connection of the ESP8266 module is the following:

(I am using external 3,3V power source)
RST → through 1k resistor to VCC
CH_PD → through 1k resistor to VCC
GPIO0 → open or to VCC (I know that GND is for flashing mode, that worked just fine)
GPIO15 → GND
GPIO2 → VCC (for the last two I’m not sure why, I read it somewhere but I dont think it even matters).
RX to the RX of Arduino (Pin 0)
TX to the TX of Arduino (Pin 1)
GND of the Module with the GND of the Arduino with the GND of the power supply.

In addition the TX of the Arduino is going through a 180R/330R voltage divider to the ESP8266 pin, so a 5V logic signal will be lowered to 3,3V.

What might be the problem? I suspect something with the code. First thing that comes to my mind is the baud-rate. I read that the default baud-rate of the firmware I uploaded is either 9600, 57600, or 115200 (that is the mySerial.begin(); part), but I tried with ALL the baud rates and I still dont get proper response. Also, as far as I can see the serial pins on the Arduino are 0 and 1 (RX and TX), but in the example I found, softwareSerial pins were designated to pins 10 and 11. On these pins I dont get no response at all, and on the Rx and Tx I get the garbage responses.

Does anyone have any experience with this? I am working alone and I am having tough time figuring this out. Any kind of suggestion will be useful. Thanks in advance!

Here’s the code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1);  //RX,TX

void setup() 
{
   
   Serial.begin(9600);     // communication with the host computer
 
    // Start the software serial for communication with the ESP8266
    mySerial.begin(9600);  
 
    Serial.println("");
    Serial.println("Remember to to set Both NL & CR in the serial monitor.");
    Serial.println("Ready");
    Serial.println("");    
}
 
void loop() 
{
    // listen for communication from the ESP8266 and then write it to the serial monitor
    if ( mySerial.available() )   {  Serial.write( mySerial.read() );  }
 
    // listen for user input and send it to the ESP8266
    if ( Serial.available() )       {  mySerial.write( Serial.read() );  }
}

With SoftwareSerial you should NOT use pins 0,1 since they are dedicated to usb( well, there are some rules the user must follow, so better leave them for now).
Try two (any) other pins like 10 and 11 in your example.
Also make sure you are connecting correctly rx-tx of module to "tx-rx" pins declared in SoftwareSerial

Thank you so much bro, it’s working like a charm :smiley:

Cheers!