-->
Page 1 of 2

Reading serial data from arduino

PostPosted: Wed Apr 27, 2016 10:55 am
by Gilles Orazi
Hi,

I'm trying to work with a small ESP8266 board and I have issues to communicate with it.

I first did a very basic test : I wired the board to the Rx and Tx pins of an arduino uno and sent commands manually from the serial monitor interface in the Arduino IDE. It worked very well, and I was able to send commands like AT, AT+CWLAP

The next step I took, was to send commands and read responses directly from the arduino. Unfortunately it does not work as expected. I tried various approaches with the Serial interface or the SoftwareSerial library. I always get some response with a kind of random characters.

The most basic code I tried was this one :

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

void setup()
{
Serial.begin(115200);
ESPserial.begin(115200);
}

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

Using this sketch to relay my manual commands from the Serial monitor, I only get some weird stuff in response.
I also tried to vary the baud rate, with no success.
I also tried to use Serial to communicate and used a LCD display to monitor, but I had no success.

Any idea / hint ?
Gilles:

Re: Reading serial data from arduino

PostPosted: Thu Apr 28, 2016 2:45 am
by Damaging_Ostrich
I'm trying to do something similar and ran into like issues. A couple of things to check out:
1. From what I read only certain pins can be used with software serial
2. Fast rates cause issues.

I got everything working 100% above after changing the baud rates to 9600.

Good luck

Re: Reading serial data from arduino

PostPosted: Sun May 01, 2016 9:57 am
by Stu
Did you get it to work? I'm not having luck at 9600 baud (or any other rate for that matter).

Re: Reading serial data from arduino

PostPosted: Tue May 03, 2016 10:08 am
by Gilles Orazi
Hello,

I lowered the baud rate and things are working better now. To do this, put the ESP8266 directly on the serial lines of the Arduino and send the command (AT+CIOBAUD=19200) from the serial monitor. Then, it's possible to unplug the ESP8266 and plug it into another project, it keeps the baud rate.

Thanks for the help, it actually put me on the way to the solution.

Regards,
Gilles