@vshymanskyy I’ve been travelling for a while, but now I’m home I thought I’d give the ESP-01/Arduino Uno combo a try with Blynk.NCP.
It’s working, but the process wasn’t very intuitive and I came across a couple of issues so I thought I’d feed-back on those and share the process with anyone else who’d interested…
Software Versions used in the test
I downloaded Blynk Library 1.3.0 and used the BlynkNCPSimple.ino
that is part of that release.
I used the BlynkNCP_generic_esp8266_1M.flash.bin
from the NCP v0.6.2 release and uploaded it to my ESP-01 using nodemcu-flasher or Windows from here…
My initial attempt to upload the .bin file failed with a size mismatch error, but I fixed that by changing the Flash Size setting to 1MB, from the default of 4MB…
I used Arduino 1.8.19 for everything else.
Hardware Setup
I have a homemade proto shield that allows an ESP-01 to be hooked-up to an Uno without the need for a breadboard or any jumper wires, and this uses pins 2 and 3 on the Uno for serial communication with the ESP-01…
As the Uno only has one hardware serial port on pins 0 & 1 the SoftwareSerial is required. As the Uno struggles to emulate a serial port at speeds higher than 9600 baud some changes were needed to accommodate this.
Changes to the BlynkNCPSimple.ino sketch
I obviously had to change the SoftwareSerial pins to be used to suit my board…
// Create Serial1 for ARDUINO_AVR_UNO and similar boards
#if defined(__AVR_ATmega328P__)
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3); // was 10, 9
#endif
and I initially thought that I had to un-comment this line…
//#define SerialNCP Serial1
but actually I needed to add this line…
#define BLYNK_NCP_SERIAL Serial1
which looks like a naming error in your sketch?
I then had a compilation error that highlighted this line…
const long baudTarget = BLYNK_NCP_BAUD;
with the error…
NCP_Helpers.h: In function 'bool ncpSetupSerial(uint32_t)':
NCP_Helpers.h:83:27: error: 'BLYNK_NCP_BAUD' was not declared in this scope
const long baudTarget = BLYNK_NCP_BAUD;
^~~~~~~~~~~~~~
BLYNK_NCP_BAUD
isn’t defined anywhere in the sketch, so this is definitely a bug.
As I wanted the baud rate to be 9600 I added this in the #if defined(__AVR_ATmega328P__)
section…
// Create Serial1 for ARDUINO_AVR_UNO and similar boards
#if defined(__AVR_ATmega328P__)
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3);
#define BLYNK_NCP_BAUD 9600
#endif
I then just needed to add my BLYNK_TEMPLATE_ID
and BLYNK_TEMPLATE_NAME
to the sketch, provision the board in the app and it’s working perfectly!
Pete.