0

This is my very first project with a Uno board and ESP module. I have some experience with 8051 uP. I'd like some guidance in addressing my issue.

Objective:

To connect ESP8266MOD to my wifi network and send a TCP message to my HOME_SERVER whenever required.

Hardware Module: UNO (Induino R5 Arduino R3 USB Clone Board) --> level shifter --> ESP8266MOD

As a first step, I am trying to send AT+RST command from the Uno to the connected ESP. But there is no response from the ESP. However, I am able to notice a LED blink on the ESP, whenever there is TXD operation in my Uno.

Hardware Connection:

UNO - Uses USB Power supply from laptop
ESP8266MOD- Uses 3 1.5V AA Batteries

                 ||
    UNO PINS       TXD      RXD     5V GND
                    ||      ||      ||
    LEVELSHIFTER     >>RXI   <<TXO  HV,GND 
                        ||      ||          
                    RXO<<    TXI>>  LV,GND
                    ||      ||      ||
    ESP8266MOD      RXD     TXD     3.3V,GND

ESP8266MOD Settings:
    CH_PD ->> 3.3V
    GPIO2 ->> 3.3V
    GPIO0 ->> GND
    GPIO15->> GND

Uno Code:

#include <SoftwareSerial.h>

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial ESP8266 (rxPin, txPin);

void setup() {
  Serial.begin(9600);
  ESP8266.begin(9600); // Change this to the baudrate used by ESP8266
  delay(3000); // Let the module self-initialize
}

void loop() {
  Serial.println("Sending an AT command...");
  delay(3000);
  ESP8266.println("AT+RST");
  delay(30);
  String response = "";
  while(ESP8266.available()) {
    char c = ESP8266.read();
    response+=c;
  }
  if(response != "") {
    Serial.println(response);
  } else {
    Serial.println("Empty\r\n");
  }
}

Output Video: Output video view

logic level converter --> ESP8266MOD

13
  • That yellow PCB, is it possible that it already have the level shift on it ? Jan 1, 2017 at 23:07
  • @AndreCourchesne No, The RX and TX are directly taken from pinout. I doubt that
    – Ragav
    Jan 2, 2017 at 0:23
  • Then maybe you have rx connected to rx (same for tx). I would use a continuity tester to make sure of the wirring. Jan 2, 2017 at 0:51
  • @AndreCourchesne I interchanged pin from in ESP end already. still no luck. However, with existing connection when there is TX from UNO, I am able to see LED blink in ESP.
    – Ragav
    Jan 2, 2017 at 1:08
  • Then the next step to me would be oscilloscope or logic analyser. Jan 2, 2017 at 1:11

1 Answer 1

1

If it is a new ESP module, your problem is quite likely a baud rate mismatch, since you are seeing an LED response but getting no reply.

The last batch of ESP-01s I received defaulted to 115200 baud, but that is too fast for SoftwareSerial (SS). You'll need to change it to 9600. My answer to a related question describes one way to change it.

You could also change it with SS. You'd have to start off SS at 115200 baud, which will usually transmit OK; just ignore the apparent garbage that comes back. Then change SS's baud rate to 9600 to match, and you should have solid communication.

These are the three commands you need to send the ESP to accomplish the change:

AT                             # ESP should respond "OK"
AT+RST                         # Resets the ESP
AT+UART_DEF=9600,8,1,0,0       # Sets ESP UART: 9600,N,8,1,no flow ctl

Note: Your module might have been preset to some other rate than 115200, in which case you'll have to try various rates until you can get an intelligible reply. Once you do, set the default rate to 9600.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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