"Your Arduino is not in the network" - but it is

My project runs 24/7 sending temperature data to the Blynk server (yours). When I open my Blynk app I get the “not in Network” (NIN) message at the bottom of the screen. Yet my project display shows current data and I can interact with the device. The only bug seems to be a false message. It began a while ago (months?). I guessed it could be related to library / app version mismatch but within the last day or two I have updated both of them and I still see the NIN message.

I also tested with the Blynk ESP8266 WiFi Shield example and I see the same behavior.

My app has 3 projects in it. The project that comes into view when the app opens is the project of interest. The project screen is in it’s non-full-screen state. The NIN message appears immediately in white on black. When I tap to bring the project screen to full screen, it is already in ‘running’ state from my last session and I can interact with my project immediately.

If the project-device is truly off-line (powered off, for this test), the same NIN message in white on black appears when I open the app. If I put the app in ‘stopped’ state, then back to ‘running’, the NIN message appears again but it is in yellow on black.

Repeatable: yes
Severity: confusing to the user at first; not a show-stopper.

App: Blynk for Android 1.16.6
Library: Supposed to be 0.4.1 (but see my recent post re: version # mismatch)
OS: Android 6.0.1, kernel 3.4.0-gad29d11
Project board: Uno-like home-built board w/ 16MHz Atmega 328p, ESP8266 (9600 baud); behaves like Uno; code is compiled for Uno.

Are those projects active?

No, only one of them is active. While testing the example sketch, I used another project screen, but was the only one active during that time because I used the same project board.

Happens also to me and i found out that it is because esp8266 serial is overloaded by sending data to app and when app sends something to HW NIN or device was disconnected message appears. After while esp reconnects and works normally again.

The project sketch sends data every 30 seconds; the NIN message appears every time I open the app. A coincidence seems quite unlikely. The example sketch sends no data; it only listens to the app. (In my test, I had a button widget on the app that lights the on-board LED). Yet it also gets the NIN message.

What about memory leak/out of memory in arduino? My global variables take 1340 bytes right now and it works, but my project behaved strangely with 1452 bytes occupied. i’m also using mega328p

The example sketch pretty ruled that out: same behavior, trivial sketch. In addition, my project continues to run normally, including interacting with the app through the Blynk server. The only unusual behavior is the NIN message itself.

To be more specific:

  1. my project has a button-widget and an LED widget. The button widget’s callback function sends back a blink-sequence to the LED-widget. I can touch the button widget and see my board blink the LED widget as soon as the app’s project screen is up and in ‘running’.
  2. With the example sketch, I used a button widget to turn on the physical pin on the project board to which an LED is connected. That, too, works as expected.

@JRobert please try to add something like BLYNK_CONNECTED and print something to serial output so you can be 100% that reconnection is actually happens or not so we can be sure this is Blynk issue or not.

Ok, I’ll be happy to run another experiment, but what are you trying to find out? I think I’ve already shown the Blynk connection is maintained:

  • In the app, prepare a button-widget that toggles a pin on the board that has an LED attached;
  • Load the board with the example sketch and wait for it to connect.
  • Confirm communication by tapping the button-widget and watching the LED;
  • Without disturbing the board, close, then re-open the Android app. The message appears, then clears.
  • Immediately tap the button-widget on the board: note that the on-board LED lights.

Doesn’t that already show that the Blynk connection is up and running?

Connection is up and running. But there is a chance that connection was dropped before/after you opened app that’s why you see this message. BLYNK_CONNECTED will clarify this.

BLYNK_CONNECTED() was quiet after the first connection.

  1. I waited for the “first connect” message before I opened my app.
  2. Then I opened the app & immediately saw the NIN message on my screen.
  3. When the message cleared (quickly, maybe a couple of seconds), I tapped the project screen to bring it to full screen. It was already in ‘running’ state.
  4. I tapped the button-widget and confirmed the on-board LED responded as I touched/released the button-widget. The terminal was quiet the entire time.
  5. Without disturbing the board in any way, I closed the app and repeated 2 - 5. The results were the same.

This is the entire program output:

0���t謞�9�|[3717] AT version:0.40.0.0(Aug  8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
OK
[10985] +CIFSR:STAIP,"192.168.1.2"
+CIFSR:STAMAC,"18:fe:34:d4:a2:a9"
[10985] Connected to WiFi
[21337] Ready (ping: 39ms).
21784: Blynk first connect

And this is the Blynk example code with BLYNK_CONNECTED() added (I’ve removed most the header comments for brevity):

// * This example shows how to use ESP8266 Shield (with AT commands)
// * to connect your project to Blynk.
 
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#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[] = "xxxxxx";

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

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(10,9); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

void setup()
{
  // Set console baud rate
  Serial.begin(115200);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
}

void loop()
{
  Blynk.run();
}

BLYNK_CONNECTED() {
	static bool firstConnect = true;
	Serial.print(millis());
	if( firstConnect ){
		firstConnect = false;
		Serial.println(": Blynk first connect");
	}
	else
		Serial.println(": Blynk connected");
}

That’s strange. I don’t see BLynk library version… Are you sure this is latest library?

I just d/l’d it from the link on this site a couple fo days ago. The file I d/l’d was named “Blynk_Release_v0.4.1.zip”. The #define’d version # in the BlynkConfig.h file contained in it is 0.4.0.

Please try to update to latest app version and let me know if issue is still there.

My app has 3 project panels defined; Test-1, Test-2, and Test-3. I use Test-1 for the test program above. Only one project is online, in this case it is the test program I listed earlier.

With the new app, and the project board running and already connected to Blynk, when I start the app it says “Device of Test-2 is offline”, which is true but irrelevant and therefore, somewhat confusing, since the app wakes up with the Test-1 panel showing. Test-3 is also not online, but that is not mentioned.

When my project code (not the sample code for this test) is loaded, it talks to the Test-3 auth-code. In that case when I start the new app with the panel for Test-3 initially showing, the pop-up says “Device of Test-1 is offline”. Again, this is true, but irrelevant to project Test-3.