Hi, I’m new to Blynk. I’m using Blynk and a ESP8266 for a battery-powered furnace monitoring system.
Is it true that it is not possible to interrupt the ESP8266 from deep sleep? It has to be reset? I realize this is an ESP question but my second question is tied to Blynk.
Since I’m trying to monitor the overall “on” time, I have to reset the ESP to start the clock and then monitor the status of a GPIO pin to determine the end time. After doing a virtualwrite, I put the ESP back to sleep. (Code below).
During the course of testing I’ve discovered that my Blynk app and the server can handle a 20 - 23 second delay before they lose contact with the server. Elapsed times greater than ~ 20 seconds are not logged.
I’ve gone through and removed all the delay() calls. I can’t figure out what else might be wrong.
One clue is the app shows a message “ESP disconnected” at about the 20 second limit (although this may also be the ESP going into deep sleep).
`#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Ticker.h>
#define PINOUT 0
#define INTERRUPTPIN 2
float previousMillis = millis();
float currentMillis = 0;
float ElapsedTime = 0;
float ElapsedTimeM = 0;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “authcode”;
void setup()
{
pinMode(INTERRUPTPIN, INPUT);
digitalWrite(INTERRUPTPIN, HIGH);
pinMode(PINOUT, OUTPUT);
digitalWrite(PINOUT, LOW);
Serial.begin(9600);
Blynk.begin(auth, “network”, “pass”, IPAddress(192,168,1,xx));
}
void loop()
{
Blynk.run();
for (byte i = 0; i < 10; i++)
{
digitalWrite (PINOUT, HIGH);
delay (50);
digitalWrite (PINOUT, LOW);
delay (50);
}
bool x = digitalRead(INTERRUPTPIN);
while (x == LOW)
{
x = digitalRead(INTERRUPTPIN);
Serial.print(" x "); Serial.println(x);
}
float currentMillis = millis();
float ElapsedTime = ((currentMillis - previousMillis)/1000);
Serial.print("Elapsed Time (in seconds) = "); Serial.println(ElapsedTime);
Blynk.run();
Blynk.virtualWrite(V4, ElapsedTime);
ESP.deepSleep(0);
}
`