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

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

the hardware i use is a uno + wifi atmega328p esp8266. 8Mb flash

Ihave upgraded the firmware to AT version 1.1
I have uploaded sketchs esp8266_shield from blynk

• smartphone version andriod 9
• Blynk server version 2.27.19
• Blynk Library version 0.5.3 and 0.6.1

 WARNING!
    It's very tricky to get it working. Please read this article:
    http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#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[] = "auth";

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

// 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();
}

@Kitty_Visser please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

thanks

These boards are an awful choice for a beginners IoT project, as they represent the worst of all worlds (expensive, bulky, difficult to understand, limited support/documentation etc etc).
If you search the forum you’ll find a number of posts about them, and the RobotDyn version of the same thing. You’ll see that to get these working you needed these settings to be correct:

  • The ESP AT firmware must be the correct version
  • The switches must be in the correct positions
  • The correct pins must be used for the serial communication between the Uno and ESP
  • The correct must be used for the serial communication between the Uno and ESP

I don’t think you need to use SoftwareSerial with these boards, but if you do then SoftwareSerial won’t work properly at a baud rate of 115200.

Pete.

1 Like

i think i have to ad a sketch to the esp8266 but don’t know wat because blynk has the code for wifi settings i only have to send it through uart

It depends what you are trying to achieve.

If you want an Arduino Uno with WiFi capabilities then the ESP needs to be running the factory (or updated) “AT” firmware. If you upload a sketch to the ESP8266 then you overwrite this AT firmware and you’ll never get the ESP8266 to act as a WiFi modem for the Uno until you re-flash the AT firmware.

If you simply want to use the (more powerful) ESP8266 processor then you can upload the sketch to the ESP8266, but if you do this then you cant use any of the Uno pins that run down the side of the board. Only the pins labelled “ESP Pins” will work, and because they are arranged in a 4x3 cluster with no on-board labels they are more difficult to use compared to the pins on a NodeMCU.

Pete.

i want to let it act as wifi modem

here is why you should and how to use SoftwareSerial with Uno+WiFi board:

i use solftware serial only i can’t find a sketch for the esp8266 to make to esp8266 a modem only extend the signal to the uno

a sketch for software serial without having to give passwords and sidd thats already done in the uno

If I get what your saying you will need to flash the default “AT” command firmware onto the 8266. If that it still doesn’t work make sure it has lots of power. Sometimes it works adding a capacitor between power and ground as it just draws a lot of power for a short time.

EDIT The sketch goes on the Arduino and it talks to the network via the 8266s TX and RX pins.

which value?

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