Greetings,
As some may remember from my earlier topic, I’m using Robotdyn’s Arduino Uno Board with builtin ESP8266 module. Along with the previous help of a few members of this forum, I have succeeded to connect my Blynk app with Arduino and Esp.
While using, I noticed something odd. I had only one button in my application, which was to turn D13 (Builtin-LED) ON and OFF. If sometimes I pressed it quickly (only 2-3 times), the Blynk app would automatically disconnect me. I said to myself that I should probably not do it that fast, since I don’t need it to be done so fast, but when I implemented a timer to #writeVirtual to a V5 pin with a sensor information with a delay of 2 seconds, it kinda goes fine for around 10 seconds, then it disconnects again and I have to wait for it to reconect.
I have searched on forums and topics and found out that it may be the BAUD rate causing this, if I’m not mistaken, but I am not sure how can I equalize baud rate of my Arduino and ESP and still get it working. I also read that the old firmware of ESP could cause this, but if I get a confirmation that it’s possible, I’ll try to update it. The firmware I currently have is the one that I got in this topic: Encountering issue with robotdyn UNO r3 + esp8266
Current settings:
- ESP8226 baud rate is: 115200
- Arduino Uno’s: 9600 (Works, but with the problem above)
I’m connecting to Blynk server, as can be seen in the code below.
I tried setting Arduino to 115200, but it never gets to successfully stay connected to the app for longer than a second, while disconnecting right afterwards.
I also tried settings both to 9600, but it looked as same, tho cannot really remember.
Blynk library is: Blynk_Release_v0.6.1
#define BLYNK_PRINT Serial
#include <BlynkSimpleShieldEsp8266.h>
#include <ESP8266_Lib.h>
// Varijable
BlynkTimer timer;
int i = 0;
char auth[] = "myAuthToken";
char ssid[] = "SSID";
char pass[] = "XYZ";
#define EspSerial Serial1
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(4, 5); // RX, TX
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
void setup()
{
// Debug konzola
pinMode(7, INPUT);
Serial.begin(9600);
delay(10);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
timer.setInterval(2000L, updateReading);
}
void updateReading() {
i++;
if (i == 1023)
i=0;
Blynk.virtualWrite(V5, i);
}
void loop()
{
timer.run();
Blynk.run();
}
I was wondering if anyone has encountered something similiar, and is willing to show me the best way to debug it properly and determine the problem.
EDIT: I switch to 115200 monitor to see the debug of the ESP, and back to 9600 for arduino when needed.
And one question… Should I use hardware serial communication instead of software for Arduino UNO and ESP8266?