Displaying a Analog Value to Blynk APP via Virtual pins

I think your syntaxis is incorrect: http://docs.blynk.cc/#blynk-firmware-configuration-blynkconfig

Oh right, he is also using Wifi authentication in that line. Does that make a difference?.. ESP’s… I know very little about them.

@willerpw the syntax for Blynk.config() only takes auth, plus server and port, if not using Blynk’s cloud server.

To use Blynk.config() you have to first make a regular WiFi connection.

Also in loop() it is expected that you use something like this:

1 Like


OK, I think you then need these lines: (again, I am guessing a bit here… test and compare with the documents and other examples)

Blynk.connectWiFi(ssid, pass);
Blynk.config(auth);  // or Blynk.config(auth, wifi); ??

Then for the main loop:

void loop()
  if(Blynk.connected()) { 
  timer.run(); // Initiates SimpleTimer

From what I can tell it seems like your device might need some time to “boot” in order to give proper and fast readings.

“Like you mentioned, I saw some strange calculations for the run-time at the beginning of the loops (i.e. up to 3 seconds to complete instead of 175ms). This generally lasts about 1 min and then evens out”
Src: https://openenergymonitor.org/forum-archive/node/2669.html

@willerpw now that you have worked out what the PushData example does you can remove all reference to it (i.e. myTimerEvent() function and the call in setup()). You just need the energy() stuff.

As the code is currently written the LCD will not be updated when you are not connected to Blynk. There are ways to overcome this but really you should work out why you are being disconnected from Blynk.

As you have seen with PushData, Blynk is rock solid if you your code is well written.

thank you @Gunner.

@Costas definetly. Im busy implementing all of you guys ideas. Will update you when I get it sorted or when I reach a brick wall.

Really greatful for all your help so far.

Chiming in as I’m also using EmonLib with some cheap 5A CTs (to a WeMos pin A0).

I had a similar issue as @willerpw with any emon1.calc function running at a frequency greater than 1 second. In my case it is emon1.calcIrms(1480);… meaning that 1,480 current samples are taken (source)! Of course putting this in loop() was no good, 500ms was shaky, 1 sec decent, 5 sec just fine. I should note this wasn’t just affecting my Blynk connection, this was affecting the ESP’s WiFi connection (from what I could tell pinging, etc).

I only picked up on this because I was trying to trigger a notification on a very short (< 1 sec) current blip, then noticed my OTA updates weren’t working. I’m going to try tweaking the number of samples vs. frequency and see what I get.