0

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?

asked Apr 20, 2017 at 18:05
3
  • 1
    You never call begin on software serial. Commented Apr 21, 2017 at 1:53
  • How do you convert logic level Arduino UNO (5V) and ESP8266 (3.3V)? Commented Apr 21, 2017 at 19:19
  • @AltAir, I don't, the board accepts a logic level of 5V Commented Apr 22, 2017 at 18:37

1 Answer 1

0
3
  • 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? Commented Apr 20, 2017 at 19:08
  • You need to send that command at the baud rate the ESP8266 is expecting. The default is 115200. Commented 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 the AT+CIOBAUD=9600 and everything started to work! I can now read it without any gibberish, thanks! Commented Apr 22, 2017 at 18:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.