Any Arduino + ESP8266 (AT firmware) to be deprecated?

I know, the ESP-01 is probably the least friendly pinout to use.
The resistors to switch between 5v and 3.3v logic level aren’t really necessary.

Pete.

@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…

image

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…

image

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! :grinning:

Pete.

4 Likes

Thanks for your feedback, I’ll review our example based on it.

1 Like

@PeteKnight looks like you used the low-level BlynkNcpDriver example, but there’s a simpler example in the Blynk library: Blynk -> Blynk.Edgent -> Edgent_NCP

Please check it out

2 Likes

That works, by changing this…

// Redefine NCP connection port settings, if needed
//#define BLYNK_NCP_SERIAL            Serial1
//#define BLYNK_NCP_BAUD              2000000

to this…

#define BLYNK_NCP_SERIAL Serial1
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3);
#define BLYNK_NCP_BAUD 9600

(Obviously this is using the same hardware setup as before, with the ESP-01 connected to pins 2 & 3 of the Uno)

07:53:53.488 -> [2999] Main firmware: 0.1.0
07:53:53.488 -> [3000] Build: Jul 30 2023 07:38:52
07:53:53.488 -> [3000] 
07:53:53.488 ->     ___  __          __
07:53:53.488 ->    / _ )/ /_ _____  / /__
07:53:53.488 ->   / _  / / // / _ \/  '_/
07:53:53.488 ->  /____/_/\_, /_//_/_/\_\
07:53:53.488 ->         /___/ v1.3.0 on Arduino Uno
07:53:53.488 -> 
07:53:53.488 ->  #StandWithUkraine    https://bit.ly/swua
07:53:53.488 -> 
07:53:53.488 -> 
07:53:53.488 -> [3022] NCP responding (baud 38400, 5796 us)
07:53:53.556 -> [3067] NCP responding (baud 9600, 17944 us)
07:53:53.591 -> [3094] Blynk.NCP firmware: 0.6.2
07:53:53.792 -> [3300] State: Connecting Network
07:53:58.102 -> [7601] State: Connecting Cloud
07:54:03.875 -> [13307] State: Connected
07:54:03.875 -> [13307] Connected to Blynk 🙌

Pete.

1 Like