I have a working SoftwareSerial connection to my ESP8266 module on my Arduino UNO board. However, the response I get from the ESP8266 using the SoftwareSerial library is semi-gibberish.
So I do get the correct response, but some characters are changed. For example when I ask the IP of the module, it sometimes returns the right IP, but most of the times just alters the IP, for example 092.168/123.5.
So what am I doing wrong?
This is the code I'm currently using:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(10, 11);
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Started");
}
void loop() {
if (esp8266.available()) {
Serial.println(esp8266.readStringUntil("\n"));
}
if (Serial.available()) {
esp8266.write(Serial.read());
}
}
When I send the AT
command, I sometimes get OK□しろいしかく
or some other extra random characters.
So how do I make the SoftwareSerial show (or receive) the correct response?
1 Answer 1
Try lowering your baudrate to 9600.
https://blogs.msdn.microsoft.com/abhinaba/2016/01/23/esp8266-wifi-with-arduino-uno-and-nano/
-
Thank you, however I tried chaning the baudrate to 9600 by sending
AT+IPR=9600
but I couldn't talk to it on rate 9600. I can't talk to it on any rate anymore... So what would the best way be to change that modules baud rate?Mason– Mason2017年04月20日 19:08:09 +00:00Commented Apr 20, 2017 at 19:08 -
You need to send that command at the baud rate the ESP8266 is expecting. The default is 115200.per1234– per12342017年04月21日 07:14:11 +00:00Commented Apr 21, 2017 at 7:14
-
The command I used
AT+IPR=9600
bricked the flash, but I tried it on a different ESP8266, used theAT+CIOBAUD=9600
and everything started to work! I can now read it without any gibberish, thanks!Mason– Mason2017年04月22日 18:37:20 +00:00Commented Apr 22, 2017 at 18:37
begin
on software serial.