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?

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

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 Apr 20 '17 at 19:08
  • You need to send that command at the baud rate the ESP8266 is expecting. The default is 115200. – per1234 Apr 21 '17 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! – Mason Apr 22 '17 at 18:37

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.