Issues connecting devices initially to Blynk Cloud - my first experience

Tagged this as a FAQ as I did resolve the issue - not sure why.
Feedback on proper posting is welcomed.
New to using Blynk, and to be known, I am using it as a DIY—not commercial. And am still getting blood all over the keyboard :slight_smile:

I am building a relay controller to control the switch panel—operating lights and such—in my camper via my mobile phone.

Problem: After initial success connecting my first device to the Blynk cloud - ran into not being able to reconnect after changing the sketch.

Resolution: Reboot network infrastructure, not just the router but all my mesh access points.

Follow-up question:
All other devices on the network were able to function whilst I could not connect the Blynk device. Even though the device seemed to be operating properly, compiling code, uploading, and scanning the SSID networks from the device, why was a reboot - especially of the mesh nodes - necessary?

Environment

  • MAC dev environment
  • com port well established
  • Hardware: Wemos d1 Mini, breadboarding
  • IDE: VSC Platform IO with appropriate libraries (initial ‘training’ was on the Arduino IDE)

Details:
Initially adding the device to Blynk, I did the quickstart method, and the device connected and got online with the basic sketch. As I said, I am new and noticed while I was playing around with the sketch and the breadboarded device that in no time I used up 7k+ messages of my allotted 200k messages. This was due to a timer function in the initial sketch that—tbh—I’m still trying to figure out. I just want to close relays via my phone.

I disabled the timer function/references and tried playing with datastreams (virtual pins) and the physical connections, and all of a sudden the device would not go back online after rebuilding the sketch. No errors. Compiling and uploading all worked.

Placed Serial.println() code in the loop() function of the sketch before the Blynk.run() call - no output.

I tried to back out my changes, but it still would not connect.

I deleted everything on the Blynk console- templates. devices, and datastreams, started again, creating new template, device, and datastreams. Still - could not go online.

IDE serial port connection to the board did not change. Compilation was successful, and upload was successful.

Thought I fried the D1 (or at least the 8266).

Went back to basic 8266 example sketches:

  • Step A: Wemos D1 scan networks sketch (no need to connect to ssid) - Success
  • Step B: Wemos D1 webserver (I forgot the name, but it’s the one that gives you a URL with a simple random graph). Needs to connect to ssid - Failure.
  • All other devices appear to be normal on my SSID network.

TBH - I do not know how to debug the Blynk API - tried to use Serial.println (see above), but the experience was not as expected.

Reboot the router. The router connects to the internet, and mesh nodes are available. Other items on the network are fine—laptops, phones, etc. Rerun steps A and B. Same results B failure).
Reboot mesh nodes. Other items on the network are fine. Rerun steps A and B. B success.

Redid the Blynk template → Device → Datastreams, and it worked.

So, in conclusion, it was not a Blynk problem. (Spent way too much time thinking it was a Blynk/Pilot error issue.)

Some things I still do not understand:

  • Inside the Sketch loop() block, I put a Serial.println(“.”) before the Blynk.run(); line that did not execute. e.g.:
    void loop()
    {
    Serial.println(“.”);
    Blynk.run();
    }

  • Why did rebooting my mesh nodes seem to work, but everything on the network was fine (no exhaustive testing) prior to rebooting?

The Blynk.begin() command, in void setup, is a blocking command. If it can’t connect to the Blynk server then all code execution stops at that point. As a result, your void loop will not execute.
There are ways around this, but I won’t go into them here.

ESP8266 devices can only connect via 2.4GHz WiFi, so it depends how your WiFi network is configured. It will also depend on how your mesh is configured.
Establishing a 2.4GHz only SSID for your home automation nodes is always a good idea.

Breadboards are generally a bad idea, the connections are often very flakey which can lead to inconsistent results, although that’s probably not the cause of your issue.

The FAQ category is for answers to frequently asked questions.
I’ve changed your post to “need help…”.
Be aware that when you post code to the forum it needs to have triple backticks at the beginning and end so that it displays correctly.

Pete.

Thanks for the reply and the guidance on posting.

What setup would you use for prototyping vs a breadboard?

You could use one of the Wemos proto boards, as discussed in this topic…

Pete.

Pete -

Thanks for this—literally the first article I found that got me interested in using Blynk. I am using a Wemos D1 Mini for my prototyping and am using a breadboard to interface with the relay circuitry, so I was confused when you said that breadboards are a bad idea.

I suspect from your comment that you didn’t understand the difference between a D1 Mini Proto board and a breadboard.

This type of proto board requires the joints to be soldered…

which is better than using a breadboard. All breadboards can produce high resistance connections, and the cheap ones are usually far worse than most. They are also prone to wires being disturbed very easily when the position of the components moves around on the bench.

If you’re only using a couple of relays then you could of course go for a Wemos triple base and two Wemos relay modules.

Pete.

OK—now I understand—looks like a sound idea.
Thank you!