Seeking Solutions: ESP32 Monitoring and Setup Connection Issues

I’ve assembled a setup to monitor temperature, humidity, and atmospheric pressure using an base ESP32 , BMP180 and DTH22. The connection diagram is standard. It’s connected to blynk.io. Currently, the data updates every 30 seconds.

However, I’m encountering the following issues:

  1. In the blynk.Console, the information appears on the chart, but it only updates when the display mode is set to ‘Last’. In all other modes, only the last value is displayed and the display freezes. Refreshing the screen or toggling back and forth to the ‘Last’ mode updates the chart temporarily, but it freezes again.
  2. After approximately 3 days of operation, the connection shuts off and goes into Offline mode. To restore the connection, I need to press the Reset button or restart the ESP32 board. After researching online, I came across a suggestion that for stable operation, one should avoid using the delay() function and instead use a Timer() function. Additionally, it’s recommended to minimize operations within the Loop() function. Currently, only three components remain: Blynk.run(), readAndSendData(), and either delay(30000) or timer.run().

I’ve experimented with varying the delay frequency between data transfer sessions, ranging from 10 seconds to 10 minutes. However, when set to 10 seconds, the ESP32 board shuts off after about 10 days, and when set to 10 minutes, it shuts off after approximately 1 hour.

I’m seeking advice on how to resolve these problems.

Turn on the “Enable history data” option for each datastream that you want to view in Superchart.

We need to see your code.

When you post it, put triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Is there any reason why you chose the “Solved” category for this topic, rather than “Need help with my project”?

Pete.

Thanks for the answer,
In the Superchart, I have the “Include historical data” option enabled for each data stream.

this is code:

#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "***********"
#define BLYNK_TEMPLATE_NAME "***********"
#define BLYNK_AUTH_TOKEN "***********"

#include <BlynkSimpleEsp32.h>
#include <Adafruit_BMP085.h>
#include <DHT22.h>

#define pinDATA 17 // SDA, or almost any other I/O pin

DHT22 dht22(pinDATA); 
Adafruit_BMP085 bmp;
//BlynkTimer timer; 
 
void setup() {
  Serial.begin(115200); //1bit=10µs
  
  if (!bmp.begin()) {
	Serial.println("Could not find a valid BMP085 sensor, check wiring!");
	while (1) {}
  }
  
  Serial.println("\ntest capteur DTH22");
  Blynk.begin(BLYNK_AUTH_TOKEN, "MYWIFI", "***********");
  //timer.setInterval(60000L, readAndSendData);
}

void loop() {
  
  Blynk.run();
  readAndSendData();
  delay(30000);
  //timer.run(); 
}

void readAndSendData() {
  
  float t=(bmp.readTemperature()+dht22.getTemperature())/2;     // average from two sensor
  
  float humidity = dht22.getHumidity();
  float pressure = bmp.readPressure()/100;  //hPa 
  float SealevelPressure = bmp.readSealevelPressure(490);
  float altitude = bmp.readAltitude(SealevelPressure);

  Blynk.virtualWrite(V0, t);
  Blynk.virtualWrite(V1, humidity);
  Blynk.virtualWrite(V3, altitude);
  Blynk.virtualWrite(V4, pressure);
   }

@Davit I gave you triple backticks to copy/paste, but you’ve used different characters instead, which don’t work.

Please edit your post and replace these characters…

with these…

```

Pete.

1 Like

Okay, so you’ve added-in the BlynkTimer timer code, but it’s all commented-out.

You need to uncomment it, the. Remove both of these lines from your void loop…

For testing purposes, you might want to change this…

to 5000L so that you take a reading every 5 seconds, which will help you with your diagnostics of the Superchart issue.

Pete.

The timer is closed by comment because I tried to compare Delay() and Timer() how the system will behave, the answer is clear - nothing has changed.
I even tried setting it to a 1 second cycle for both functions. nothing has changed.
About one month ago everything worked without problems, even with an update cycle of 10 minutes, but about 2 weeks ago this problem appeared with the SuperChart update.

But this does not at all solve the problem that ESP32 is disconnected from there Console, it is not at all clear what to do

One second is too quick when you are using a slow sensor like the DHT22, which is why I suggested 5 seconds.

What you need to do is to run the BlynkTimer code without these two lines 8n your void loop…

and with the BlynkTimer set to a 5 second frequency, and report back on the results.
You also need to share info about which datastreams you are plotting in Superchart, and how they are configured.
It would also help if you added more serial print statements into your code, and shared the serial monitor output at the point when your device goes offline.

Pete.

Hello.
After I cleaned the loop() function for two days of operation, the Esp32 did not disconnect from the console even once. Very nice.
But, unfortunately, the problems with the SuperChart are not over.
In the mode Latest, data is displayed and updated without problems. In other display modes, Last Hours, 6 Hours, 1 day or 1 week still freezes and is not updated. What’s interesting is that in these modes only the SuperChart is not updated, and the Gauge and Label widgets work perfectly and are updated regularly.
I tried changing the chart type, disabling/enabling AutoScale and other widget options, erasing the widget and creating them again. In the end, nothing has changed.
I launched the blink.console in Google Chrome and MS Edge. The problem hasn’t gone away.
After that, I installed the Blink application on my Android phone and created a dashboard with similar widgets there. Everything works fine on the phone. All widgets update data permanently.
As I understand it, the problem is related to the update of the SuperChart widget in the desktop browser.
I am sending screenshots for Chart Setting and Virtual Pin DataStream




Please post the code you are using, and a screenshot of the temperature superchart in “Latest” view showing the temperature varying.

Have you tried adding a serial print statement to your readAndSendData function to show the value of the variable t after this line?..

Pete.

Screenshots are loaded from above, in previous posts.
Of course, I used serial monitor for setup. Here is a dump:

[screenshot of serial monitor removed by moderator]

When you post serial output to the forum you need to copy the text from the serial monitor and post it with triple backticks at the beginning and end. Please edit your previous post to replace the screenshot.

And of course, the serial output means nothing without seeing the code that generates it.

Those screenshots appear to show the same temperature (18.1°) across the whole duration of the time period. I can’t see any steps where the temperature varies, which is why I asked to see…

Pete.

The temperature is stability and changes with truly little delta. Now, i was turned on Auto Scaling mode and changing is show.

It is code too:

#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL6WB3CFjlI"
#define BLYNK_TEMPLATE_NAME "Weather Station"
#define BLYNK_AUTH_TOKEN "sP6rmb_kjKS7KJLrbTCGtAIRWDBIzo61"

#include <BlynkSimpleEsp32.h>
#include <Adafruit_BMP085.h>
#include <DHT22.h>

#define pinDATA 17                                                        // SDA, or almost any other I/O pin

DHT22 dht22(pinDATA); 
Adafruit_BMP085 bmp;
BlynkTimer timer; 
 
void setup() {
  Serial.begin(115200); 
  
  if (!bmp.begin()) {
	Serial.println("Could not find a valid BMP085 sensor, check wiring!");
	while (1) {}
  }
  
  Serial.println("\ntest capteur DTH22");
  Blynk.begin(BLYNK_AUTH_TOKEN, "MYWIFI", "9xsc-gu3n-nr2e");
  timer.setInterval(5000L, readAndSendData);
}

void loop() {
  
  Blynk.run();
  timer.run(); 
}

void readAndSendData() {
  float temperature=(bmp.readTemperature()+dht22.getTemperature())/2;     //average temperature from two sensor
  float humidity = dht22.getHumidity();
  float pressure = bmp.readPressure()/100;                                //calculate the hPa 
  float SealevelPressure = bmp.readSealevelPressure(490);
  float altitude = bmp.readAltitude(SealevelPressure);

  Blynk.virtualWrite(V0, temperature);
  Blynk.virtualWrite(V1, humidity);
  Blynk.virtualWrite(V3, altitude);
  Blynk.virtualWrite(V4, pressure);
    
    Serial.print("temperature=");
    Serial.println(temperature);
  //  Serial.print("humidity=");
  //  Serial.println(humidity);
  //  Serial.print("altitude=");
  //  Serial.println(altitude);
  //  Serial.print("pressure=");
  //  Serial.println(pressure);

}