BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

[SOLVED] Robotdyn & Blynk - ATmega2560+ESP8266

Greeting all Blynk enthusiasts! :grinning:

I have done long time research, how get working Arduino and ESP8266.
There is partial success :metal:, I mean classic MEGA and ESP8266-01 as a separate platform connected through cables are working together just fine (thanks to those topics here).
But Robotdyn…
I have followed this Robotdyn uno+wifi (just like the others).
ESP on combo board is responding on AT commands.

Ai-Thinker Technology Co. Ltd.

ready
AT


OK
AT+GMR

AT version:1.1.0.0(May 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb)
Ai-Thinker Technology Co. Ltd.
Jun 13 2016 11:29:20
OK

I have uploaded this code to the MCU.

#define BLYNK_PRINT Serial


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "...";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "...";
char pass[] = "...";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup()
{
  // Debug console
  //Serial.begin(9600);
  //delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
}

void loop()
{
  Blynk.run();
}

Dip-switches were set to MCU-ESP, but unfortunately nothing happen. Also, I tried external power supply or even antenna. But again, nothing happens.
(In my opinion the combo board is not faulty, I have done this before and it was working fine )

Is there anything what am I missing?
If you have some suggestions how figure it out, I would be soo grateful!

1 Like

Hi,

You need to disable:

#define BLYNK_PRINT Serial

You are not able to print by serial as you are using the serial port to communicate to the ESP.
(You can add in terminal in the Blynk app to receive and see the messages the UNO is sending. See examples in the documentation).

On the other hand I do not see what the code is expected to do.
Suggest to add in a button, inside a timer, to activate the built in led to see if the UNO is connected to the server.

BB

1 Like

Hello,

Thank you for your response!
I have commented out #define BLYNK_PRINT Serial.
Now code looks like this:

//#define BLYNK_PRINT Serial


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "...";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "...";
char pass[] = "...";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup()
{
  // Debug console
  //Serial.begin(115200);
  //delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
}

void loop()
{
  Blynk.run();
}

Sadly, it is still not working :disappointed_relieved:

My goal is just to get connected the combo board. (You will not believe how happy I will be…:grinning:)
ONLINE/OFFLINE status I am observing via Blynk app.

Today I noticed kinda strange thing for me. The first row. This appears on serial monitor when is connected ESP on combo board, but I have not seen it on serial monitor for classic stand alone ESP. I have used the same materials for flashing both.

{l⸮⸮|⸮d⸮|⸮⸮d⸮b<⸮⸮⸮e⸮s⸮⸮no⸮$gn⸮⸮⸮cp⸮⸮ds$sd⸮⸮lcco⸮<l$Ǐc⸮⸮gn⸮
ready
AT


OK

Could it be the result of an ever-failing attempts?

Just noise as the ESP boots and locks onto the set BAUD rate… I see it often on my MEGA with ESP-01 for network connection.

As Gunner says, if the BAUD rate is incorrect you can get scrambled text.
The ready, AT and ok indicates it locks into correct baud in the end.

I do not fully understand what you intend to accomplish with the code. What you already have is minimal code to connect to to the ESP. No other specific function in place.
Remember that you will not get any response in the Arduino terminal as the serial port on the Uno is communicating with the ESP and therefore not available for communication with the terminal.
I suggest you read up on the terminal widget available in Blynk, as you can use that to see what is happening while the Uno connects with Blynk and write to it from within your code to debug.

I just realized that you are working with Mega instaed of Uno. You therefore have more than one hardware serial.
You then can have Blynk_Print serial active bút need to configure the serial ports in the code and with the dip-swithes on the boards.

Hi!

It took me four months of struggling, but finally I know how to connect my combo board.

I would like to share my tiny knowledge with you and leave it here for further generations.

In order to connect Robotdyn mega to Blynk you need to do few steps.

  1. Flash ESP
  2. Upload code
  3. Setting switches

This was a quick overview. Now let’s go to do it.

  1. Flash ESP
    For flashing ESP follow this instruction list: Robotdyn uno+wifi
    (in this part, there is no difference between uno and mega) Stop following this list abeam “After flashing the ESP it finally started to reply to AT commands.” and go to my next step.

  2. Upload code
    Be very careful with dip-switch!
    2.1. For this task, dip setting should be 3.ON 4.ON others are OFF.
    2.2.I have downloaded an example and made some changes.
    2.3. You need to change Serial from 1 to 3 like this: #define EspSerial Serial3.
    (exactly this i was solving four months)
    Code should look like this:

#define BLYNK_PRINT Serial


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "...";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "...";
char pass[] = "...";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial3

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup()
{
  // Debug console
  Serial.begin(9600);
  delay(10);

  // Set ESP8266 baud rate;
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

This is ABSOLUTE minimum code to connect combo board.
When is the board successfully connected, you can see ONLINE status in Blynk app.
For more fun, you can add Terminal or Button for ledpin (it is described in docs). After uploading go to the next step.

  1. Setting switches
    3.1. 8dip-switch: 1.ON 2.ON 3.ON 4.ON others are OFF.
    This setting let you see serial print and at the same time it will communicate with ESP.
    3.2. switch near ICSP set to RXD3 x TXD3
    After moving all necessary switches go to the next step.

  2. Power it up, open app and take a beer.

That’s all folks…

Troubleshooting

  1. Wrong Dip-setting
  2. Weak WIFI signal
  3. Wrong SSID, PASS, AUTH
  4. Use external power supply
  5. Possibly it could be high baud of ESP (never happen to me). You can reduce it to 9600 (to the same level as Serial.print)
    For reducing baud use this
AT+UART_DEF=9600,8,1,0,0

or

AT+CIOBAUD=9600

it should reply

OK
1 Like

A post was split to a new topic: Twitter for Blynk doesn’t work with Robotdyn