Need help with Arduino WiFi Rev 2 and Blynk IoT

Hi Pete, Alwaily_iq,

I have similar problem.
The device is Arduino UNO Wifi Rev2
The blink library is version 0.6.1. The code with the newest cannot be compiled.

Here are the settings of the IDE.
Arduino IDE Settings

This is the serial monitor:
image

The only server that I could connect to is:
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);

What could be the problem?

I use this code, basically the Quickstart with some adjustments:

/*************************************************************
This is a simple demo of sending and receiving some data.
Be sure to check out other examples!
 *************************************************************/

/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID           "***************"
#define BLYNK_TEMPLATE_NAME         "Quickstart Device"
#define BLYNK_AUTH_TOKEN            "********************************"

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <SPI.h>
//#include <WiFi101.h>
//#include <BlynkSimpleWiFiShield101.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>


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


BlynkTimer timer;

// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0)
{
  // Set incoming value from pin V0 to a variable
  int value = param.asInt();

  // Update state
  Blynk.virtualWrite(V1, value);
}

// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
  // Change Web Link Button message to "Congratulations!"
  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}

// This function sends Arduino's uptime every second to Virtual Pin 2.
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V2, millis() / 1000);
}

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

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

  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.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!
}

You should update the library to the latest version (1.1.0).
If you have the latest version of the library installed, go to the libraries folder and delete the older versions manually.

@nikisun please don’t hijack other people’s topics, especially when you’re using totally different hardware and your issue is different.

I’ve moved your post to a new topic.

That will never work with Blynk IoT.

The QuickStart wizard has very few board types available, and the “Arduino” board there is not the board you are using.

You should probably delete the QuickStart device & template and use one of the 1.1.0 library examples instead, and manually create a template and device.

Pete.

Hi John93,
I´m not sure where to find these different libraries. In the folder with the libraries I do not see dedicated folder for the different versions (0.6.1 or 1.1.0).
As said, if I update to 1.1.0 the code cannot be compiled/uploaded.
Already last year I saw people facing similar prolem when using Arduino UNO WiFi Rev 2.
Back than I didn`t make a thorough investigation since the two projects that I was working on, still worked with the old Blynk application.
Here are the threads.

I see also that you and Pete have been quite active there.
Is there a summary of the solution or I still need to go through the threads?

Thank you!

Hi Pete,
thank you for creating new thread. My intention was not to hijack anything., thought it was the same context.

Cheers,
nikisun

Here:

But you MUST upgrade from 0.6.1 first.

Pete.

Hi Pete,
I’ve updated the library and then corrected the spelling error (atol instead of atoll).
All works for now.
Thank you for the guidance!
nikisun

1 Like

Hi Pete, John93,
I have similar problem as before.
After some time (first minutes, then seconds) the blynk server somehow kicks the arduino out and does allow it to reconnect again.
Blynk library is updated with the latest version 1.2.0
Arduino Uno WiFi Rev2

Here is an example from the serial monitor:

09:25:33.886 -> [2825] 
09:25:33.886 ->     ___  __          __
09:25:33.933 ->    / _ )/ /_ _____  / /__
09:25:33.979 ->   / _  / / // / _ \/  '_/
09:25:33.979 ->  /____/_/\_, /_//_/_/\_\
09:25:34.028 ->         /___/ v1.2.0 on Arduino UNO WiFi Rev2
09:25:34.074 -> 
09:25:34.074 ->  #StandWithUkraine    https://bit.ly/swua
09:25:34.121 -> 
09:25:34.121 -> 
09:25:34.121 -> [2999] Connecting to blynk.cloud:80
09:25:34.262 -> [3190] Ready (ping: 31ms).
09:26:11.298 -> [40370] Connecting to blynk.cloud:80
09:26:11.392 -> [40457] Ready (ping: 49ms).
09:28:56.570 -> [206168] Connecting to blynk.cloud:80
09:28:56.616 -> [206169] Connecting to blynk.cloud:8080
09:29:01.546 -> [211169] Connecting to blynk.cloud:80
09:29:01.640 -> [211240] Ready (ping: 33ms).
09:29:58.299 -> [268111] Connecting to blynk.cloud:80
09:29:58.346 -> [268112] Connecting to blynk.cloud:8080
09:30:03.296 -> [273112] Connecting to blynk.cloud:80
09:30:03.388 -> [273177] Ready (ping: 32ms).
09:32:04.598 -> [394765] Connecting to blynk.cloud:80
09:32:04.643 -> [394850] Ready (ping: 29ms).
09:32:15.931 -> [406167] Connecting to blynk.cloud:80
09:32:15.978 -> [406168] Connecting to blynk.cloud:8080
09:32:20.915 -> [411168] Connecting to blynk.cloud:80
09:32:21.008 -> [411233] Ready (ping: 31ms).
09:34:19.826 -> [530475] Connecting to blynk.cloud:80
09:34:19.921 -> [530554] Ready (ping: 43ms).

Here is the code:

/*************************************************************
  This is a simple demo of sending and receiving some data.
  Be sure to check out other examples!
 *************************************************************/

/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID   "******"
#define BLYNK_TEMPLATE_NAME   "******"
#define BLYNK_AUTH_TOKEN            "*******"

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>

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

BlynkTimer timer;

// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V1)
{
  // Set incoming value from pin V0 to a variable
  int value = param.asInt();
  Serial.print("V1 Button is pressed: ");
  Serial.println(value);
    if(value == 1){
  // Update state
  Blynk.virtualWrite(V2, 255);
  Serial.println("V2 LED should be ON");
    }
    
    else {
      Blynk.virtualWrite(V2, 0);
      Serial.println("V2 LED should be OFF");
      }
}

// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
  // Change Web Link Button message to "Congratulations!"
  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}

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

  //Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  // You can also specify server:
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud",80);

}

void loop()
{
  Blynk.run();
  timer.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!
}

Thank you!
nikisun

When you post serial output it’s far better if you do this as text, and use triple backticks, rather than as a screenshot.

I don’t see how the code you’ve posted and be producing this output…

And I don’t understand why you’re specifying the server name and port 80 in your Blynk.begin command.

Pete.

Hi Pete,
I’ve edited the serial monitor output.

Now about the output. Not that I’ve changed the code significantly (it’s very short, few lines in total) but the message in the serial monitor has changed since yesterday. It is very strange that on one row is 80 and on the next one is 8080… no idea.

About the server. I’ve use:

 Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

I’m wondering whether the Arduino Uno WiFi is the big problem, because I’ve tried the quickstart template with the same code on Uno Wifi Rev 2 and on MKR WIFI 1010, and with the MKR I do not face this server issue.

Bests,
nikisun

You’d be better using code specifically for that board.

Pete.

Hi Pete,
I have added additional code which checks the Wifi connection. Now I see from time to time that the device reconnects to the internet.
Since this code is implemented, I do not see the connection problem with the blynk server anymore.
Maybe this was the issue.

I’ll update again after more thorough testing.

nikisun