I was trying to connect my Arduino Nano to my home Wi-Fi. To do that, I connected my Arduino to ESP8266 module.

I connected pins

Arduino  | ESP8266
3.3V     | VCC
3.3V     | CH_PD
D10      | RXD
D11      | TXD
GND      | GND

to connect to Wi-Fi, I used code which I found on internet.

What I'm getting is "FAILED - Timeout exceeded" which indicates there is no response from the ESP module. Is it possible I did something wrong and I fried it, or I connected it wrong? Or maybe it does not have enough power (I'm powering my Arduino via computer USB port)? I also read reviews which indicates customers who bought similar product from different vendors they had issues with firmware. Is it possible I have same problem?


#include <SoftwareSerial.h>
SoftwareSerial softSerial(10, 11); // RX, TX
String WSSID = "xxxxxxxxxxxx";
String WPASS = "xxxxxxxxxxxx";
bool r;

void setup() {
  delay(2000); // Without this delay, sometimes, the program will not start until Serial Monitor is connected
  r = espSendCommand( "AT+CIFSR" , "OK" , 5000 );
  if( !r ) {
    r = espSendCommand( "AT+CWMODE=1" , "OK" , 5000 );
    r = espSendCommand( "AT+CWJAP=\""+WSSID+"\",\""+WPASS+"\"" , "OK" , 15000 );

void loop(){    
  r = espSendCommand( "AT+CIPSTART=\"TCP\",\"\",80" , "OK" , 5000 );
  String getRequest = "GET /shiznic/ HTTP/1.1\r\nHost: www.rootpower.com\r\n";
  int getRequestLength = getRequest.length() + 2; // add 2 because \r\n will be appended by SoftwareSerial.println().
  r = espSendCommand( "AT+CIPSEND=" + String(getRequestLength) , "OK" , 5000 );
  r = espSendCommand( getRequest , "+IPD" , 15000 );
  //r = espSendCommand( getRequest , "world" , 15000 ); // page should respond with Hello, world.
  if( !r ) {
    Serial.println( "Something wrong...Attempting reset...");
    espSendCommand( "AT+RST" , "ready" , 20000);
    espSendCommand( "AT+CWMODE=1" , "OK" , 5000 );
    espSendCommand( "AT+CWJAP=\""+WSSID+"\",\""+WPASS+"\"" , "OK" , 15000 );

void espSerialSetup() {

  // change baud rate so SoftwareSerial works better -- need a certain version of ESP for this to work and be retained after power cycle
  // make sure Serial Monitor port speed is set to 9600
  softSerial.begin(115200); // default baud rate for ESP8266

bool espSendCommand(String cmd, String goodResponse, unsigned long timeout) {
  Serial.println("espSendCommand( " + cmd + " , " + goodResponse + " , " + String(timeout) + " )" );
  unsigned long tnow = millis();
  unsigned long tstart = millis();
  unsigned long execTime = 0;
  String response = "";
  char c;
  while( true ) {
    if( tnow > tstart + timeout ) {
      Serial.println("espSendCommand: FAILED - Timeout exceeded " + String(timeout) + " seconds" );
      if( response.length() > 0 ) {
        Serial.println("espSendCommand: RESPONSE:");
        Serial.println( response );
      } else {
        Serial.println("espSendCommand: NO RESPONSE");
      return false;
    c = softSerial.read();
    if( c >= 0 ) {
      response += String(c);
      if( response.indexOf(goodResponse) >= 0 ) {

        execTime = ( millis() - tstart );
        Serial.println("espSendCommand: SUCCESS - Response time: " + String(execTime) + "ms");
        Serial.println("espSendCommand: RESPONSE:");
        while(softSerial.available() > 0) {
        return true;
    tnow = millis();

UPDATE I changed connections to D11 | RXD D10 | TXD

and i also simplified my code

#include <SoftwareSerial.h>

SoftwareSerial esp(10, 11);

void setup() {
  while (!Serial);

void loop() {
  if (esp.available()) {

  if (Serial.available()) {

now I'm sending basic AT command to test connection, and still not getting any response. LED on ESP module is on, so I'm assuming it is working.

  • What kind of ESP8266 module? There are about 8 of them and they all have different wiring requirements. – Majenko Feb 19 '16 at 20:56
  • @Majenko I'm using ESP-01 – user902383 Feb 19 '16 at 21:04

By the looks of the information you have provided, it looks as though you have not made the crossed serial connection: rx-tx tx-rx.

Your wiring:

Arduino  | ESP8266
3.3V     | VCC
3.3V     | CH_PD
D10      | RXD
D11      | TXD
GND      | GND

And when you intialize the software serial library:

SoftwareSerial softSerial(10, 11); // RX, TX

You declare D10 as RX and then connect it to the ESPs RX and ditto for the TX line.

What you need to do is the following:

Arduino  | ESP8266
3.3V     | VCC
3.3V     | CH_PD
D10      | TXD   //change to this
D11      | RXD   //change to this
GND      | GND

Also you need to ensure that the arduino TX line does not exceed 3.3V you can use a voltage divider, logic-level shifter board or a 74LVC245. This is important as the 5V arduino pins will damage a 3.3V device. This is a note as arduino nano is a 5V device from what I know(I may be corrected).

  • I swap connections, and i connected D10 to TXD and D11 to RXD as you suggested, but there is no change. I'm not an expert on Arduino, and I heard same thing about voltage, but i have two power pins, one with 3.3V and one with 5V. So I assume 3.3 from board should be fine. – user902383 Feb 19 '16 at 22:40
  • If it is a 5V arduino, as in the voltage that the pins on the microcontroller go when set to HIGH, you will need to have a voltage divider as 5V WILL damage the ESP. Could you specify the exact model of you Arduino board? The 3.3V form the boards power is fine for the ESP power. The problem is if the 5V pin was exposed to the ESP pin. – RSM Feb 20 '16 at 6:28
  • I have clone of Arduino Nano v3, which as I said has 3.3v output. By any chance do you know best way to check is my ESP is fried or is it firmware problem? – user902383 Feb 20 '16 at 7:29
  • You can use an arduino as a USB to serial device by bypassing the MCU and then using the terminal to send commands to the esp and see the response, also you can change baud rates to see where it is. [This]( arduino.stackexchange.com/q/18575/2944) article would describe what I suggested, and I think there are programs people have made to reflash the firmware on theses things. – RSM Feb 20 '16 at 7:57
  • I tried to recreate same thing what was in that question, and i failed. When he cross cennected RX and TX, and he got something in response, and i didn't got anything. I don't think it is something which i did , as i got another one from same vendor, and i have same problems. I also tried to connect ESP directly to PC using FTDI module, but same issue, no response. do you have any idea what should be my next step? – user902383 Feb 21 '16 at 21:16

As far as I know, the 3.3v on the Arduino board might not have enough current for the ESP module, as it is very 'power hungry'.

I've had some hard time making my modules work properly, and your problem could be a number of things.

I will stick to Ockam's razor principle and go by the simple side.

In your code you are using 9600 baud,but the ESP8266 'base' speed is 115200. Try that speed (and CR+LF) also on your Usb cable and it might work.

  • have you looked at update? in that code i'm using 115200baud. I also connected to external power source which was around 3.15V and 0.65A. Still same result. – user902383 Feb 29 '16 at 20:59
  • Oh, sorry, I haven't noticed. I still think it is not fried, it might have something to do with firmware update, my modules were stuck for a while untill I figured how to do it properly. Check this page for some details: electrodragon.com/w/Category:ESP8266_Firmware_and_SDK . Also, take a look at the ESPlorer IDE, esp8266.ru/esplorer (you need to connect GPIO0 to GND when flashing) – Giordano Bruno Feb 29 '16 at 22:59
  • actually i'm getting somewhere, i think previous arduino was duff, now i'm getting some response, but it is meaningless crap. I tried using different boudrates but still nothing. – user902383 Feb 29 '16 at 23:19
  • That's a good sign, I am even more convinced it is about firmware update. – Giordano Bruno Mar 1 '16 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.