Blynk + AutoConnect with Static IP on ESP8266 12E is not working


this is my first topic in this forum. I have problem with Blynk on Blynk server. I’m using Blynk connection with autoconnect with static IP and this configuraton can’t works. But if make this configurations on local server then works fine. Where is the problem?

Details :
• ESP 8266 12E and Blynk server
• Smartphone with Android
• Blynk Library version: 0.5.3

#define BLYNK_PRINT Serial
#include <FS.h>                   //this needs to be first, or it all crashes and burns...

#include <ESP8266WiFi.h>          //
#include <BlynkSimpleEsp8266.h>
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>          //

 * this example shows how to set a static IP configuration for the ESP
 * although the IP shows in the config portal, the changes will revert 
 * to the IP set in the source file.
 * if you want the ability to configure and persist the new IP configuration
 * look at the FS examples, which save the config to file

char auth[] = "7a8ec8d93aae40d990b290970955f131";
//default custom static IP
//char static_ip[16] = "";
//char static_gw[16] = "";
//char static_sn[16] = "";

BlynkTimer timer;

void setup() {
  // put your setup code here, to run once:

  //Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;


  //reset settings - for testing

  //set static ip 
  //the commented bit only works for ESP8266 core 2.1.0 or newer
  /*IPAddress _ip,_gw,_sn;
  IPAddress _ip = IPAddress(192,168,1,45);
  IPAddress _gw = IPAddress(192,168,1,1);
  IPAddress _sn = IPAddress(255, 255, 255, 0);
  wifiManager.setSTAStaticIPConfig(_ip, _gw, _sn);


  //tries to connect to last known settings
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP" with password "password"
  //and goes into a blocking loop awaiting configuration
  if (!wifiManager.autoConnect("AutoConnectAP")) {
    Serial.println("failed to connect, we should reset as see if it connects");

  //if you get here you have connected to the WiFi
  Serial.println("connected...yeey :)");

  Serial.println("local ip");

   Blynk.begin(auth, NULL, NULL, "", 80);

void loop() {
//  if ( digitalRead(TRIGGER_PIN) == LOW ) {
 //  WiFiManager wifiManager;
// wifiManager.resetSettings(); 
//};; // Initiates BlynkTimer
  // put your main code here, to run repeatedly:


This code is working fine on local server but not on Blynk server.
Auth Token is active now.
Please help. This is my first project.

Your description of the problem seems a bit garbled to me, but it appears that you may be using an Auth code from your local server to connect to the Blynk cloud server. This will never work, as there is no synchronisation between projects, and associated Auth codes, on local/cloud servers.

If this isn’t the issue then I think you should clarify the issue and elaborate on your problem.


For the local server I have another Auth code. I am using the library WiFiManager to the configuration static IP. Difference in combination between the local server and the Blynk server is only between IP addresses and Auth codes.

What error? What is showing in DEBUG? Anything more descriptive than “can’t works”?

ESP is connecting with my WiFi network but not with Blynk server. Debug from serial port:

*WM: Connection result:
*WM: 3
*WM: IP Address:
connected…yeey :slight_smile:
local ip
[70195] Connecting to
[70208] Connected to WiFi
[70236] IP:
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
//_, /////_
__/ v0.5.3 on NodeMCU

Give Blynk a Github star! => https…

[70498] Connecting to blynk… :80
[75498] Connecting to blynk… :80
[80499] Connecting to blynk…: 80

I ment proper DEBUG

And since when does the Serial monitor crop info?


Hi Maryush, u can try this code for esp8266

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "yourtoken";

// Your WiFi credentials.
// Set password to "" for open networks.
// Replace with your network credentials
const char* ssid     = "YourNetworkName";
const char* password = "YourPassword";

// Set your Static IP address
IPAddress local_IP(192, 168, 1, 185);
// Set your Gateway IP address
IPAddress gateway(192, 168, 1, 1);

IPAddress subnet(255, 255, 0, 0);
IPAddress primaryDNS(8, 8, 8, 8);   //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

void setup()
  // Debug console

 if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
    Serial.println("STA Failed to configure");

  // Connect to Wi-Fi network with SSID and password
  Serial.print("Connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {

  while (Blynk.connect(1000) == false) { 

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

void loop()
  // 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!

@Santo_Lim. Thank you for you contribution. But please note the time/date stamps before posting. This topic is over ten months old and the OP hasn’t returned to this forum since.