[SOLVED] Particle Electron cycling connection with Blynk

Does anyone know what the optimum settings are for the Particle Electron to run Blynk. I have one running the latest particle firmware 6.2.0 with basic blynk sketch created as seen on the Blynk sketch builder.

It constantly cycles through connecting - resetting - connecting, sometimes all it does is register onto the 3g network and thats it.

When I run a basic particle led blinking sketch without any blynk code it runs fine.

Anyone experiencing the same thing and can anyone offer some advice.

Probably becasue a basic blink sketch doesn’t need to connect to a server :wink:

Post your entire sketch here so we can see if you have the “optimum” settings (block out part of your auth code when posting).

Here’s the code. It’s straight from the the Blynk code builder…

    // This #include statement was automatically added by the Particle IDE.

    /*************************************************************
      Download latest Blynk library here:
        https://github.com/blynkkk/blynk-library/releases/latest

      Blynk is a platform with iOS and Android apps to control
      Arduino, Raspberry Pi and the likes over the Internet.
      You can easily build graphic interfaces for all your
      projects by simply dragging and dropping widgets.

        Downloads, docs, tutorials: http://www.blynk.cc
        Sketch generator:           http://examples.blynk.cc
        Blynk community:            http://community.blynk.cc
        Follow us:                  http://www.fb.com/blynkapp
                                    http://twitter.com/blynk_app

      Blynk library is licensed under MIT license
      This example code is in public domain.

     *************************************************************

      You’ll need:
       - Blynk App (download from AppStore or Google Play)
       - Particle Electron board
       - Decide how to connect to Blynk
         (USB, Ethernet, Wi-Fi, Bluetooth, ...)

      There is a bunch of great example sketches included to show you how to get
      started. Think of them as LEGO bricks  and combine them as you wish.
      For example, take the Ethernet Shield sketch and combine it with the
      Servo example, or choose a USB sketch and add a code from SendData
      example.
     *************************************************************/

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


    // Uncomment this, if you want to set network credentials
    //#include "cellular_hal.h"
    //STARTUP(cellular_credentials_set("broadband", "", "", NULL));

    // Run "ping blynk-cloud.com", and set Blynk IP to the shown address
    #define BLYNK_IP        IPAddress(45,55,130,102)

    // Set Blynk hertbeat interval.
    // Each heartbeat uses ~90 bytes of data.
    #define BLYNK_HEARTBEAT 60

    // Set Particle keep-alive ping interval.
    // Each ping uses 121 bytes of data.
    #define PARTICLE_KEEPALIVE 20

    #include <blynk.h>

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


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

      delay(2000);

      Particle.keepAlive(PARTICLE_KEEPALIVE);
      Blynk.begin(auth, BLYNK_IP);
    }

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

Have you confirmed this address via PING from a PC?

Oh, and have you tryed varients like

#define BLYNK_IP        (45,55,130,102)
or
#define BLYNK_IP        "45,55,130,102"
or even
#define BLYNK_IP        "45.55.130.102" // using periods instead of commas

Can you show your serial monitor readout when trying to connect?

Apologies @Gunner the Blynk IP i am using is 45,55,96,146. The code won’t compile with the variations you’ve suggested. Also I can open the serial monitor via the command prompt…"particle serial monitor " however nothing is displayed when the electron is booting up.

There should be something from Blynk showing that it is at least trying to connect… your Sketch may not even be getting the the Blynk.begin() command… perhaps that Particle.keepAlive(PARTICLE_KEEPALIVE); is stalling something? I am not familiar with any of the Particle devices to know what else to suggest??..

Hey @Gunner, I think the problem was signal strength…the very next day I took the particle to a different location and it hasn’t missed a beat since.

1 Like