Strange data plotting on Superchart

Hi, I’m facing strange behavior while pushing data to superchart. It’s look likes the data plotted in not ordered timestamp, creating chart like the image below. Sometimes it just plot it in random x-axis and sometimes it just showing flat line across the graph. The value seems fine in another widget though.

Here is my code:

#define BLYNK_PRINT Serial
#define ONEWIRE_PIN 32

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <OneWire.h>
#include <DallasTemperature.h>

OneWire oneWire(ONEWIRE_PIN);
DallasTemperature DS18B20(&oneWire);
DeviceAddress sensor0={0x28,0x02,0x00,0x07,0x73,0x49,0x01,0x8A};
BlynkTimer timer;

const char auth[]="xxx";
const char ssid[]="xxx";
const char pass[]="xxx";
const char server[]="xxx.xxx.xxx.xxx";
const int port=8081;

void setup() {
  Serial.begin(9600);
  DS18B20.begin();
  DS18B20.setResolution(sensor0,12);

  ServerBegin();
  timer.setInterval(200L,refresh);
}

void loop() {
  if(Blynk.connected()) { 
    Blynk.run();
    timer.run();
  }
  else {
    ServerBegin();
  }
}

void ServerBegin() {
  unsigned long now=millis();;
  
  //Connection to WiFi
  WiFi.begin(ssid,pass);
  while(WiFi.status()!=WL_CONNECTED && millis()-now<10000UL) {
    delay(1000);
  }
  if(WiFi.status()==WL_CONNECTED) {
    //WiFi connected message
  }
  else {
    //Connection failed message
    WiFi.disconnect();
    return;
  }

  //Connection to Blynk server
  Blynk.config(auth,server,port);
  Blynk.connect(1000);
  if(Blynk.connected()) { 
    //Server connected message
  }
  else {
    //Connection failed message
    return;
  }

  //Connection success
}

void refresh() {
  DS18B20.requestTemperatures();
  float val=DS18B20.getTempC(sensor0);

  Blynk.virtualWrite(V12,val); //Push data to superchart widget
  Blynk.virtualWrite(V13,val); //Push data to labeled value widget
}

BLYNK_CONNECTED() {
  //Load all set value when connected
  Blynk.syncAll();
}

Screenshot:

I’m running this project on ESP32 using Blynk library v0.6.1 connected to local server v0.41.10 on Windows 10. I wonder why this happen? Is it because something in server side where data stored? or connection issue? I haven’t tested it on blynk server yet though.

1 Like

@adamalfath Does this happen only in Live chart mode?

Yeah, it seems only happen in live mode. Another resolution looks like showing a smooth plot

1 Like

If possible, can you join our beta program (there is an option for that at blynk’s screen in google play app), and it will allow you to send a log from the app.

Okay, I’ll give it a try. Thanks for the responses anyway.
In the meantime, is there any log file from my phone (android) or local server that can send manually?

No, only beta app’s version is logging data, we have no logs in production version of the app.

I’m uploading new beta version with a fix to your issue. It should be available in 8-12 hours and have 2.27.10 version.

I’ve already update my app to version 2.27.10 and it solve the problem.
Thanks for your support guys :slightly_smiling_face:

1 Like