3

enter image description here

Hello. I have begun working with an ESP8266 and an Arduino Uno. The connection I used is shown below, except I am using an Arduino Uno. The rest of the connection is the same.

The code I'm using is:

#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3); // RX | TX

void setup() { Serial.begin(9600); ESPserial.begin(9600); Serial.println(""); Serial.println("Remember to to set Both NL & CR in the serial monitor."); Serial.println("Ready"); Serial.println(""); }

void loop() { if (ESPserial.available()) { Serial.write( ESPserial.read() ); } if (Serial.available()) { ESPserial.write(Serial.read()); } }

But the serial monitor is only printing:

Remember to to set Both NL & CR in the serial monitor.

Ready

What to do?

3 Answers3

2

ESP8266 WiFi modules typically have a baud-rate of 115200. This not only won't work with a 9600 baud host but SoftwareSerial can't go that fast. Or, more precisely, it can generally push out characters at that speed but it can't keep up with incoming ones. See this answer for how to change the speed of your module to 9600 baud.

Short answer: You have to reconfigure your ESP module to 9600 baud to use it with SoftwareSerial. You can do it blind (transmit a baud-change command to it at 115200 baud, even though you won't be able to read the reply). Once done, it will remain at 9600 baud and successfully communicate in both directions.

JRobert
  • 15,407
  • 3
  • 24
  • 51
1

ESP01 has two variants (blue PCB and black PCB), the old is configured to use 9600 baud (blue PCB) and the newer one uses 115200 baud (black PCB) as default.

There is also a difference in memory, 512kByte (4Mbit) or 1MB (8Mb) between the old and new version.

So try to change

ESPserial.begin(9600);

to

ESPserial.begin(115200);

And preferably both 9600 to 115200.

MatsK
  • 1,366
  • 1
  • 11
  • 24
0

You need to pull RST high - that is, connect a 10k between +3.3v and the ESP8266-01's RST pin.

Mark Smith
  • 2,181
  • 1
  • 11
  • 14