BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Why the data stored in raw data storage (Metabase Dasboard) different from the Blynk Dashboard?

Hi, currently i;m building a project where i need to monitor few parameter from multiple sensor nodes. One of them is water flow meter that i build with YF-S201 on WeMos D1 mini. I build 2 dashboard, one on the Blynk Apps and the other using Metabase for browser dashboard.
However, i found an issue with the dashboard on my Blynk App.


The first image is my Blynk Dashboard, the second is my metabase dashboard. The Blynk Dashboard does not show the flow for my water flow meter ( I have set the graph Y axis to auto).

Current code:

////---------- Blynk Setup
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
////----------

////---------- OTA Setup
#include <ESP8266mDNS.h>  // For OTA w/ ESP8266
#include <WiFiUdp.h>  // For OTA
#include <ArduinoOTA.h>  // For OTA
char OTAName[] = "Node2 - Water Flow Temp";
////----------

////---------- Projects parameter
#include <OneWire.h>
#include <DallasTemperature.h>

#define FLOW_PIN 4 //D2
#define ONE_WIRE_BUS 2 //D4

#define FLOW_METER V1
#define TEMP V0

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature ds18b20(&oneWire);

volatile int flowCounter = 0;
const float pulse2Liter = 7.5;
float flowValue = 0;

unsigned long oldmillis = 0;

float waterCTemp = 25.00;


///-----------Credentials
char auth[] = "YourAuth";
char ssid[] = "YourSSID";
const char* pass = "YourPass";
char server[] = "192.168.141.230";  // IP for your Local Server
int port = 8080;
////----------

BlynkTimer timer;



void myTimerEvent()
{
  noInterrupts();
  
  //Read Temperature and check water flow 
  ds18b20.requestTemperatures();
  waterCTemp = ds18b20.getTempCByIndex(0);

  Serial.print("Last Flow :");
  Serial.print(flowValue);
  Serial.print(" (");
  Serial.print(flowCounter);  
  Serial.print(")  Water Temperature: ");
  Serial.print(waterCTemp);
  Serial.println(" C");
 
 if(Blynk.connected()){
 flowValue = float(flowCounter * (1000.0 / (millis() - oldmillis))) / pulse2Liter;   
 Blynk.virtualWrite(FLOW_METER, flowValue);
 Blynk.virtualWrite(TEMP, waterCTemp);
 }
 //oldmillis = millis();
 interrupts();
 
}
void flowConverter(){
  noInterrupts();
  
  // frequency compensation --> true Frequency = pulses * ( 1000 mS / time_passed_in_mS)
  flowValue = float(flowCounter * (1000.0 / (millis() - oldmillis))) / pulse2Liter;   
  flowCounter = 0;
  
  if(flowValue > 0.0){
Blynk.virtualWrite(FLOW_METER, flowValue);
}
  oldmillis = millis();
  interrupts();
  
}

void setup() {
  Serial.begin(9600);  // BLYNK_PRINT data

  WiFi.begin(ssid, pass); 
  Blynk.config(auth, server, port);
  Blynk.connect();

  ArduinoOTA.setHostname("Node2 - Water Flow Temp");  // For OTA - Use your own device identifying name
  ArduinoOTA.begin();  // For OTA

  pinMode(FLOW_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(FLOW_PIN), flowTrigger, RISING);
  


  timer.setInterval(5* 60 * 1000L, myTimerEvent); // every 5 minutes
  timer.setInterval(1000L, flowConverter); // every seconds
  oldmillis = millis();
}

void loop() {
  //noInterrupts();  
  ArduinoOTA.handle();  // For OTA
  if(!Blynk.connected()){

Serial.println("Blynk has been disconnected");
Serial.print("Connecting");

while(!Blynk.connected()){ // reconnect if Blynk is disconnected
  Serial.print(".");
  boolean connection = Blynk.connect();

  if(connection){
    Serial.println();
    break;
}
  }  
  }
  if(Blynk.connected()){  
Blynk.run();    
ArduinoOTA.handle();  // For OTA    
  }  
  timer.run(); // Initiates BlynkTimer
  //interrupts();

  
}

void flowTrigger(){
  flowCounter++;  
}

/*void determineFlow(){
  noInterrupts();
  if((millis() - oldmillis) >= 1000 ){
flowValue = (flowCounter * (1000.0 / (millis() - oldmillis))) / pulse2Liter;
flowCounter = 0;    
  oldmillis = millis(); 
  }
  interrupts();
} 
 */

My guess would be that you’re not sending the correct water flow data to Blynk in the first place, especially if both the labelled value widget and the superchart don’t display any data.
Are you using the correct virtual pin in your code?

Pete.

I did, the labelled value widget did show the correct data when there a flow, but the superchart do not.

I have a code that actually do show in the superchart and metabase dashboard, but that code send the water flow data every second regardless there is a flow or not. My new code is to have the value sent when there is a flow.

Do you have High or Low resolution selected for the 1 day range?

(You can only select 7 in total, so you may have to de-select some from the top before re-selecting in the bottom).

Pete.

I have Live, 1h, and 12h in standard resolution while 1d, 1wk and 1Mo in high resolution.

And what happens if you view the data in one of the other tabs, 1 hour maybe, and scroll back to a point where there was a peak?

Also, do you have “connect missing data points” turned on?

Pete.

I can scroll back to where I use my old code and it show the proper value in all tabs (1h, 1d, and 1wk). I did have the “connect missing data poitns” enabled.

The peaks in that image is when i use my old code where the data is send every second.