Sent data not appearing on SuperChart in timeframes other than live


I have a sound decibel meter in an ESP32 using a digital microphone.
I am able to successfully print audio volume data on the serial port and also send it to Blynk at a rate of one sample per second.
What I am not understanding is that i can see the data live on SuperChart but on the other timeframes like 15 minutes, 1 hour … the widget says No data.

Here is the relevant code

#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <BlynkSimpleEsp32_SSL.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXXX";
char pass[] = "XXXXXXX";

#include <driver/i2s.h>
#include "sos-iir-filter.h"

void setup()
  // Debug console
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

void loop()

void takeMeasurements() {
  samples_queue = xQueueCreate(8, sizeof(sum_queue_t));
  // Create the I2S reader FreeRTOS task
  // NOTE: Current version of ESP-IDF will pin the task 
  //       automatically to the first core it happens to run on
  //       (due to using the hardware FPU instructions).
  //       For manual control see: xTaskCreatePinnedToCore
  xTaskCreate(mic_i2s_reader_task, "Mic I2S Reader", I2S_TASK_STACK, NULL, I2S_TASK_PRI, NULL);

  sum_queue_t q;
  uint32_t Leq_samples = 0;
  double Leq_sum_sqr = 0;
  double Leq_dB = 0;

  // Timeout for xQueueReceive
  const TickType_t xTicksToWait = pdMS_TO_TICKS(500); // Adjust as needed
  TickType_t lastBlynkRunTime = xTaskGetTickCount();

  while (true) {
    if(xQueueReceive(samples_queue, &q, xTicksToWait)) {
    // Read sum of samaples, calculated by 'i2s_reader_task'
    // while (xQueueReceive(samples_queue, &q, portMAX_DELAY)) {

      // Calculate dB values relative to MIC_REF_AMPL and adjust for microphone reference
      double short_RMS = sqrt(double(q.sum_sqr_SPL) / SAMPLES_SHORT);
      double short_SPL_dB = MIC_OFFSET_DB + MIC_REF_DB + 20 * log10(short_RMS / MIC_REF_AMPL);

      // In case of acoustic overload or below noise floor measurement, report infinty Leq value
      if (short_SPL_dB > MIC_OVERLOAD_DB) {
        Leq_sum_sqr = INFINITY;
      } else if (isnan(short_SPL_dB) || (short_SPL_dB < MIC_NOISE_DB)) {
        Leq_sum_sqr = -INFINITY;

      // Accumulate Leq sum
      Leq_sum_sqr += q.sum_sqr_weighted;
      Leq_samples += SAMPLES_SHORT;

      // When we gather enough samples, calculate new Leq value
      if (Leq_samples >= SAMPLE_RATE * LEQ_PERIOD) {
        double Leq_RMS = sqrt(Leq_sum_sqr / Leq_samples);
        Leq_dB = MIC_OFFSET_DB + MIC_REF_DB + 20 * log10(Leq_RMS / MIC_REF_AMPL);
        Leq_sum_sqr = 0;
        Leq_samples = 0;
        // Serial output, customize (or remove) as needed
        Serial.printf("%.1f\n", Leq_dB);
        Blynk.virtualWrite(V1, Leq_dB);

        // Debug only
        //Serial.printf("%u processing ticks\n", q.proc_ticks);
    // Check if 10 seconds have passed since the last
    if (xTaskGetTickCount() - lastBlynkRunTime > pdMS_TO_TICKS(10000)) {;
      lastBlynkRunTime = xTaskGetTickCount(); // Update the last run time

I don’t understand why you’re using a FreeRTOS task on core0 in this way.

What’s the logic behind this?


Hi Pete,

This particular code, I didn´t design it, I am only trying to use it with Blynk, maybe it’s not supported. The original repository is this GitHub - ikostoski/esp32-i2s-slm: Sound Level Meter with ESP32 and I2S MEMS microphone
Originally it runs on an infinite while loop inside setup. I modified it to have a timeout on the loop and issue at every 10 seconds to keep the watchdog, while trying to send data via Blnk.virtualWrite every second.
Data is being received at Blynk, i see it on live display with timestamps or with a value display. The only issue is when I try to address the history of values from other timeframes.

Wow, I have found the issue, not sure why it happened but maybe is the new default.
In the datastream configuration the config “enable history data” was disabled for the virtualpin.
Toggled it and now everything is fine!