Chart in Dashboard does not show values of a Datastream

Hi,

unfortunately I cannot see my sensor data (DHT22 humidity) in a Dashboard chart. The same issue is in Blynk App (Android v. 1.17.0(187)

Configuration:
LILYGO TTGO T-SIM7000E (ESP32)
communication type: LTE Simcard
Sensor DHT 22:
Blynk library version 1.3.2
Blynk server

two Datastreams: HUMIDITY , TEMPERATURE,
data type: double (both)
Decimals: #.## (both)

Status Quo;
The data is shown correctly for TEMPERATURE in the gauge AND in the chart. → OK
The gauge for HUMIDITY shows the actual value. → OK
The chart for HUMIDITY says “No data”- → NOK That’s strange, because the gauge has/shows the values of the datastream. :-\

desired State:
The dashboard shows a line chart with the historical data of the given HUMIDITY datastream

What I did so far:

  • read the documentation :wink:
    Gauge | Blynk Documentation and …/chart

  • searched the forum for Bugs related to “chart”
    No shown sensor value on my blynk app

  • Create a new chart from scratch. → “no data” → NOK

  • build a “Heatmap Chart” → “no data” → NOK

  • changed the Decimal to #.#

  • changed data type to integer

Thanks in advance.
Matt

Here is my code.
I think the problem is not inside the code, because the datastreams can be seen in a gauge.


#define BLYNK_TEMPLATE_ID "my_secret_ID"
#define BLYNK_TEMPLATE_NAME "DHT22"
#define BLYNK_AUTH_TOKEN "my_secret_token"


#define RXD2 26    //VVM501 MODULE RXD INTERNALLY CONNECTED
#define TXD2 27    //VVM501 MODULE TXD INTERNALLY CONNECTED
#define powerPin 4 ////VVM501 MODULE ESP32 PIN D4 CONNECTED TO POWER PIN OF A7000 CHIPSET, INTERNALLY CONNECTED

// Select your modem:
#define TINY_GSM_MODEM_SIM7000   //SIMA7000 Compatible with SIM7000 AT instructions

/*
// Default heartbeat interval for GSM is 45
// If you want override this value, uncomment and set this option:
// With this approach hardware periodically sends ping command with a predefined frequency 
// (every 45 seconds by default, BLYNK_HEARTBEAT property). If the hardware doesn't send anything within 45 seconds,
//  the server will wait for additional 103 seconds. 
// After that, the connection is assumed to be broken and closed by server. 
*/
#define BLYNK_HEARTBEAT 300

#include <BlynkSimpleTinyGSM.h>
#include <DHT.h>
#include <DHT_U.h>
#include <Arduino.h>
#include <Wire.h>
int rx = -1;
#define SerialAT Serial1
String rxString;
int _timeout;
String _buffer;

BlynkTimer timer;

// Wie oft sollen Daten in die Blynk Wolke gesendet werden?
int update_interval = 20000L ;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = BLYNK_AUTH_TOKEN;

// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "web.vodafone.de";
char user[] = "";
char pass[] = "";



bool reply = false;

TinyGsm modem(SerialAT);
#define Sensor_PIN 22  //D15-DHT22, REFER CONNECTION DIAGRAM AT TOP OF THIS PAGE
#define DHTTYPE DHT22
DHT  dht(Sensor_PIN, DHTTYPE);


void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.println("%");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println("*C");
  SerialAT.print("Humidity: ");
  SerialAT.print(h);
  SerialAT.println("%");
  SerialAT.print("Temperature: ");
  SerialAT.print(t);
  SerialAT.println("*C");
  delay(10000);

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }


  Blynk.virtualWrite(V0,t); // WRITING TEMPERATURE VALUE TO VIRTUAL PIN V0 IN BLYNK
  Blynk.virtualWrite(V1,h); // WRITING HUMIDITY VALUE TO VIRTUAL PIN V1 IN BLYNK

}




void setup() {
  pinMode(powerPin, OUTPUT);
  digitalWrite(powerPin, HIGH);
  delay(1000);
  digitalWrite(powerPin, LOW);
  delay(1000);
  Serial.begin(115200);
  delay(100);
  SerialAT.begin(115200, SERIAL_8N1, RXD2, TXD2);
  delay(1000);
  dht.begin();
  delay(2000);
  Serial.println("Modem Reset, Please Wait");
  SerialAT.println("AT+CRESET");
  delay(1000);
  SerialAT.println("AT+CRESET");
  delay(2000);
  SerialAT.flush();

  Serial.println("Echo Off");
  SerialAT.println("ATE0");   //120s
  delay(1000);
  SerialAT.println("ATE0");   //120s
  rxString = SerialAT.readString();
  Serial.print("Got: ");
  Serial.println(rxString);
  rx = rxString.indexOf("OK");
  if (rx != -1)
    Serial.println("Modem Ready");
  delay(1000);

  Serial.println("SIM card check");
  SerialAT.println("AT+CPIN?"); //9s
  rxString = SerialAT.readString();
  Serial.print("Got: ");
  Serial.println(rxString);
  rx = rxString.indexOf("+CPIN: READY");
  if (rx != -1)
    Serial.println("SIM Card Ready");
  delay(1000);

  String name = modem.getModemName();
  delay(500);
  Serial.println("Modem Name: " + name);

  Blynk.begin(auth, modem, apn, user, pass);
  // Setup a function to be called every second
  timer.setInterval(update_interval, sendSensor);
}

void loop()
{

  Blynk.run();
  timer.run();

}

Why all the delay() commands, especially this one?…

Does your V1 datastream have the “enable history data’ option enabled?

Pete.

Why all the delay() commands, especially this one?
Especially after sending the AT commands I was cautious. The modem should have enough time to respond. I made bad experiences with an arduino and a external SIM shield earlier.

Does your V1 datastream have the “enable history data’ option enabled?
No. That’s the point! I changed it and now it works fine.

Thanks a lot, Pete!

You seriously need to remove that 10 second delay in your sendSensor function, and if necessary change the duration of this timer instead…

You’re defeating the whole object of using BlynkTimer and you will get disconnections caused by heartbeat timeouts.

Pete.

Thanks for the advice. I removed the delay. Everything works fine.

Kind Regards,
Matt

1 Like