Uno+wifi atmega 328P esp8266 does not comunicate with blynk app

Google Uno and 8266 :wink:

there is no sketch for esp8266. the esp8266 has AT firmware. the Blynk library handles the WiFi connection using AT commands

i have found this sketch that repeats the signal

#ifndef D5
#if defined(ESP8266)
#define D5 (14)
#define D6 (12)
#define D7 (13)
#define D8 (15)
#define TX (1)
#elif defined(ESP32)
#define D5 (18)
#define D6 (19)
#define D7 (23)
#define D8 (5)
#define TX (1)
#endif
#endif

#define HWLOOPBACK 1
#define HALFDUPLEX 1

#ifdef ESP32
constexpr int IUTBITRATE = 19200;
#else
constexpr int IUTBITRATE = 19200;
#endif

#if defined(ESP8266)
constexpr SoftwareSerialConfig swSerialConfig = SWSERIAL_8E1;
constexpr SerialConfig hwSerialConfig = SERIAL_8E1;
#elif defined(ESP32)
constexpr SoftwareSerialConfig swSerialConfig = SWSERIAL_8E1;
constexpr uint32_t hwSerialConfig = SERIAL_8E1;
#else
constexpr unsigned swSerialConfig = 3;
#endif
constexpr bool invert = false;

constexpr int BLOCKSIZE = 16; // use fractions of 256

unsigned long start;
String bitRateTxt("Effective data rate: ");
int rxCount;
int seqErrors;
int parityErrors;
int expected;
constexpr int ReportInterval = IUTBITRATE / 8;

#if defined(ESP8266)
#if defined(HWLOOPBACK)
HardwareSerial& repeater(Serial);
SoftwareSerial logger;
#else
SoftwareSerial repeater;
HardwareSerial& logger(Serial);
#endif
#elif defined(ESP32)
#if defined(HWLOOPBACK)
HardwareSerial& repeater(Serial2);
#else
SoftwareSerial repeater;
#endif
HardwareSerial& logger(Serial);
#else
SoftwareSerial repeater(14, 12);
HardwareSerial& logger(Serial);
#endif

void setup() {
#if defined(ESP8266)
#if defined(HWLOOPBACK)
    repeater.begin(IUTBITRATE, hwSerialConfig, SERIAL_FULL, 1, invert);
    repeater.swap();
    repeater.setRxBufferSize(2 * BLOCKSIZE);
    logger.begin(9600, SWSERIAL_8N1, -1, TX);
#else
    repeater.begin(IUTBITRATE, swSerialConfig, D7, D8, invert, 4 * BLOCKSIZE);
#ifdef HALFDUPLEX
    repeater.enableIntTx(false);
#endif
    logger.begin(9600);
#endif
#elif defined(ESP32)
#if defined(HWLOOPBACK)
    repeater.begin(IUTBITRATE, hwSerialConfig, D7, D8, invert);
    repeater.setRxBufferSize(2 * BLOCKSIZE);
#else
    repeater.begin(IUTBITRATE, swSerialConfig, D7, D8, invert, 4 * BLOCKSIZE);
#ifdef HALFDUPLEX
    repeater.enableIntTx(false);
#endif
#endif
    logger.begin(9600);
#else
    repeater.begin(IUTBITRATE);
    logger.begin(9600);
#endif

    logger.println("Repeater example for EspSoftwareSerial");
    start = micros();
    rxCount = 0;
    seqErrors = 0;
    parityErrors = 0;
    expected = -1;
}

void loop() {
#ifdef HWLOOPBACK
#if defined(ESP8266)
    if (repeater.hasOverrun()) { logger.println("repeater.overrun"); }
#endif
#else
    if (repeater.overflow()) { logger.println("repeater.overflow"); }
#endif

#ifdef HALFDUPLEX
    char block[BLOCKSIZE];
#endif
    // starting deadline for the first bytes to come in
    uint32_t deadlineStart = ESP.getCycleCount();
    int inCnt = 0;
    while ((ESP.getCycleCount() - deadlineStart) < (1000000UL * 12 * BLOCKSIZE) / IUTBITRATE * 24 * ESP.getCpuFreqMHz()) {
        int avail = repeater.available();
        for (int i = 0; i < avail; ++i)
        {
            int r = repeater.read();
            if (r == -1) { logger.println("read() == -1"); }
            if (expected == -1) { expected = r; }
            else {
                expected = (expected + 1) % (1UL << (5 + swSerialConfig % 4));
            }
            if (r != expected) {
                ++seqErrors;
                expected = -1;
            }
#ifndef HWLOOPBACK
            if (repeater.readParity() != (static_cast<bool>(swSerialConfig & 010) ? repeater.parityOdd(r) : repeater.parityEven(r)))
            {
                ++parityErrors;
            }
#elif defined(ESP8266)
            // current ESP8266 API does not flag parity errors separately
            if (repeater.hasRxError())
            {
                ++parityErrors;
            }
#endif
            ++rxCount;
#ifdef HALFDUPLEX
            block[inCnt] = r;
#else
            repeater.write(r);
#endif
            if (++inCnt >= BLOCKSIZE) { break; }
        }
        if (inCnt >= BLOCKSIZE) { break; }
        // wait for more outstanding bytes to trickle in
        if (avail) deadlineStart = ESP.getCycleCount();
    }

#ifdef HALFDUPLEX
    repeater.write(block, inCnt);
#endif

    if (rxCount >= ReportInterval) {
        auto end = micros();
        unsigned long interval = end - start;
        long cps = rxCount * (1000000.0 / interval);
        long seqErrorsps = seqErrors * (1000000.0 / interval);
        logger.print(bitRateTxt + 10 * cps + "bps, "
            + seqErrorsps + "cps seq. errors (" + 100.0 * seqErrors / rxCount + "%)");
#ifndef HWLOOPBACK
        if (0 != (swSerialConfig & 070))
        {
            logger.print(" ("); logger.print(parityErrors); logger.println(" parity errors)");
        }
        else
#endif
        {
            logger.println();
        }
        start = end;
        rxCount = 0;
        seqErrors = 0;
        parityErrors = 0;
        expected = -1;
    }
}

only there are errors in it there are variables that are not defined

repeater:38:11: error: ‘SoftwareSerialConfig’ does not name a type
constexpr SoftwareSerialConfig swSerialConfig = SWSERIAL_8E1;
^
repeater:61:16: error: no matching function for call to ‘SoftwareSerial::SoftwareSerial()’
SoftwareSerial logger;
^
C:\Users\kitty\OneDrive\Documenten\Arduino\libraries\EspSoftwareSerial\examples\repeater\repeater.ino:61:16: note: candidates are:
In file included from C:\Users\kitty\OneDrive\Documenten\Arduino\libraries\EspSoftwareSerial\examples\repeater\repeater.ino:1:0:
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\SoftwareSerial/SoftwareSerial.h:38:4: note: SoftwareSerial::SoftwareSerial(int, int, bool, unsigned int)
SoftwareSerial(int receivePin, int transmitPin, bool inverse_logic = false, unsigned int buffSize = 64);
^
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\SoftwareSerial/SoftwareSerial.h:38:4: note: candidate expects 4 arguments, 0 provided
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\SoftwareSerial/SoftwareSerial.h:35:7: note: constexpr SoftwareSerial::SoftwareSerial(const SoftwareSerial&)
class SoftwareSerial : public Stream
^
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\SoftwareSerial/SoftwareSerial.h:35:7: note: candidate expects 1 argument, 0 provided
C:\Users\kitty\OneDrive\Documenten\Arduino\libraries\EspSoftwareSerial\examples\repeater\repeater.ino: In function ‘void setup()’:
repeater:81:70: error: no matching function for call to ‘HardwareSerial::begin(const int&, const SerialConfig&, SerialMode, int, const bool&)’
repeater.begin(IUTBITRATE, hwSerialConfig, SERIAL_FULL, 1, invert);
^
C:\Users\kitty\OneDrive\Documenten\Arduino\libraries\EspSoftwareSerial\examples\repeater\repeater.ino:81:70: note: candidates are:
In file included from C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/Arduino.h:246:0,
from sketch\repeater.ino.cpp:1:
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:73:10: note: void HardwareSerial::begin(long unsigned int)
void begin(unsigned long baud)
^
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:73:10: note: candidate expects 1 argument, 5 provided
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:77:10: note: void HardwareSerial::begin(long unsigned int, SerialConfig)
void begin(unsigned long baud, SerialConfig config)
^
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:77:10: note: candidate expects 2 arguments, 5 provided
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:81:10: note: void HardwareSerial::begin(long unsigned int, SerialConfig, SerialMode)
void begin(unsigned long baud, SerialConfig config, SerialMode mode)
^
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:81:10: note: candidate expects 3 arguments, 5 provided
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:86:10: note: void HardwareSerial::begin(long unsigned int, SerialConfig, SerialMode, uint8_t)
void begin(unsigned long baud, SerialConfig config, SerialMode mode, uint8_t tx_pin);
^
C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\cores\esp8266/HardwareSerial.h:86:10: note: candidate expects 4 arguments, 5 provided
repeater:83:14: error: ‘class HardwareSerial’ has no member named ‘setRxBufferSize’
repeater.setRxBufferSize(2 * BLOCKSIZE);
^
repeater:84:24: error: ‘SWSERIAL_8N1’ was not declared in this scope
logger.begin(9600, SWSERIAL_8N1, -1, TX);
^
C:\Users\kitty\OneDrive\Documenten\Arduino\libraries\EspSoftwareSerial\examples\repeater\repeater.ino: In function ‘void loop()’:
repeater:119:18: error: ‘class HardwareSerial’ has no member named ‘hasOverrun’
if (repeater.hasOverrun()) { logger.println(“repeater.overrun”); }
^
repeater:139:58: error: ‘swSerialConfig’ was not declared in this scope
Meerdere bibliotheken gevonden voor “SoftwareSerial.h”
expected = (expected + 1) % (1UL << (5 + swSerialConfig % 4));
Gebruikt: C:\Users\kitty\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0\libraries\SoftwareSerial
^
Niet gebruikt: C:\Users\kitty\OneDrive\Documenten\Arduino\libraries\EspSoftwareSerial
repeater:152:26: error: ‘class HardwareSerial’ has no member named ‘hasRxError’
if (repeater.hasRxError())
^
exit status 1
‘SoftwareSerialConfig’ does not name a type

i have tried that but does not work version 1.1 from AT is the latest version

@Kitty_Visser you clearly have no idea what you are doing, and the advice provided by a number of different forum members hasn’t helped point you in the right direction.
This isn’t really a reflection on you, it’s an issue with the hardware you are trying to use for your fisst project.
If you had started with different hardware - say a NodeMCU - then you would have been up and running in a very short time using the Blynk Sketch Builder and you would have found it much easier to start understanding that code and tweaking it to meet your exact needs.

With this hardware there are no ready-made sketch builder examples, and there are so many permutations of ESP firmware, serial/SoftwareSerial settings, baud rate and switch settings that it’s much more difficult to guide you through the process of getting this working.

I really would recommend you spending around $3 and ordering a NodeMCU. You’ll have that working in a few minutes of it arriving.

Take a read of this topic about my thoughts on hardware choices for beginners…

Pete.

why do you use EspSoftwareSerial on an Uno? EspSoftwareSerial is a library for the esp8266

It is for the esp I have tried the latest At firmware but does not work

you can have AT firmware or a sketch in esp, not both. for Blynk on Uno+WiFi upload AT firmware to esp8266 and Blynk sketch to ATmega328p

I know

so then don’t use EspSoftwareSerial in ATmega sketch, it is not a SoftwareSerial to ESP, it is a SoftwareSerial for ESP

@Juraj i suspect that we’re being trolled here, by Ms Phisher :thinking:

Pete.

1 Like

I get this error

ets Jan 8 2013,rst cause:2, boot mode:(1,7)

they say it`s power related or reset who is not fully reset

I have a power adapter of 12V 3A connected

you have wrong boot pins state. you have gpio 0 LOW so the esp8266 goes into flashing mode. (the 1 in “boot mode” tells me this. it should be 2.) switch the dip switch for esp8266 flashing mode to off. and then switch the USB to ATmega and upload the Blynk sketch. (assuming you didn’t delete the AT firmware with attempts to upload sketch to esp8266)

thanks verry mutch, it works

why does it go to 74880 baudrate?

now i get this error

ets Jan 8 2013,rst cause:2, boot mode:(3,7)
after that it says ready but does not yet connect en get en error from blynk

[1623] ESP is not responding

i wired the RX TX correctly

74880 is only the baud rate of the esp8266 bootloader log. (it would be 115200 with 40MHz crystal but esp8266 modules usually have 26 MHz crystal).
the Blynk example uses 38400 baud so the AT firmware should be set to this baud rate too.
http://help.blynk.cc/en/articles/605485-esp8266-with-at-firmware

don that dit not work

get error 1620 esp not responding

now i saw at the page you send firmware to put it in modem mode!

the firmware it has a link to is not there anymore is it the latest 1.5.4 this on i had installed?

Is there a AT function call to set it to modem mode?