Readings are different Measured to displayed

Hello,

I am having my first try with Blynk 2.0. and notice a couple errors?

I am measuring Room temperature, Pressure and Humidity with a BME680 Sensor and display them on the Blynk app. All seems to be working ok…but

Room Temp on device is 23.11 but its displaying 23.26
Room Humidity on device is 58.11 but its diplaying 58.18
Pressure is 1019.73 and its display 1019

all values are stable so no big changes, all datastreams are Doubles (#.##)

any ideas?

Also I can seem to change the number of decimals on Temp and Humidity but not pressure.

again any ideas?

Hello. Are you sure you see the same values you send to the UI? Do you print every value your hardware sends?

it’s impossible

Do you mean difference between the app and the web consule? If so are you looking at the device screen (via search and click on your device) or via web dashboard?

I am scanning the sensor every 2 seconds, the values I am quoting are from them ESP32 on Serial monitor and on the app on my iphone. Itis not a massive problem but I would expect them to be the same.

Does Blynk do any filtering to the values it displays?

well it’s happening

For your info the web dashboard and App read the same. Just different to what is actually measured.

Try to send some consequentive numbers like n = n+1 . I have the similar problem - I see numbers 21, 22, 23, 24 etc at my Serial monitor (sent once a minute), but 21, 23, 24 at application or web display. So, some data seems to be missing time to time somewhere in the system, but I can’t fugure the problem here. So, I’m still playing with it. Actually, not a problem for my purposes, but it’s ubnormal.

You need to post your code, and some information about how you’ve set-up your datastreams.

Pete.

Hello Pete,

Here is my code, basically the BME680 sensor test with the blynk bits added.

Cheers

Simon

Where?

Pete.

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLWgf-UfN7"
#define BLYNK_DEVICE_NAME "Thermostat"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WROVER_BOARD
//#define USE_TTGO_T7

#include "BlynkEdgent.h"

//...........................................................

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"

#define BME_SCK 18
#define BME_MISO 19
#define BME_MOSI 23
#define BME_CS 15

#define SEALEVELPRESSURE_HPA (1013.25)

//Adafruit_BME680 bme; // I2C
//Adafruit_BME680 bme(BME_CS); // hardware SPI
Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);

double roomTemp,roomPressure, roomHumidty;

void setup()
{
  Serial.begin(115200);
  delay(100);

  BlynkEdgent.begin();

//..........................................................

  while (!Serial);
  Serial.println(F("BME680 async test"));

  if (!bme.begin()) {
    Serial.println(F("Could not find a valid BME680 sensor, check wiring!"));
    while (1);
  }

  // Set up oversampling and filter initialization
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms


  
}

void loop() {
  BlynkEdgent.run();

//........................................................

  // Tell BME680 to begin measurement.
  unsigned long endTime = bme.beginReading();
  if (endTime == 0) {
    Serial.println(F("Failed to begin reading :("));
    return;
  }
  Serial.print(F("Reading started at "));
  Serial.print(millis());
  Serial.print(F(" and will finish at "));
  Serial.println(endTime);

  Serial.println(F("You can do other work during BME680 measurement."));
  delay(50); // This represents parallel work.
  // There's no need to delay() until millis() >= endTime: bme.endReading()
  // takes care of that. It's okay for parallel work to take longer than
  // BME680's measurement time.

  // Obtain measurement results from BME680. Note that this operation isn't
  // instantaneous even if milli() >= endTime due to I2C/SPI latency.
  if (!bme.endReading()) {
    Serial.println(F("Failed to complete reading :("));
    return;
  }
  Serial.print(F("Reading completed at "));
  Serial.println(millis());

  Serial.print(F("Temperature = "));
  Serial.print(bme.temperature);
  Serial.println(F(" *C"));

  Serial.print(F("Pressure = "));
  Serial.print(bme.pressure / 100.0);
  Serial.println(F(" hPa"));

  Serial.print(F("Humidity = "));
  Serial.print(bme.humidity);
  Serial.println(F(" %"));


  roomTemp = bme.temperature;
  roomPressure = bme.pressure/100;
  roomHumidty = bme.humidity;

  Blynk.virtualWrite(V0, roomTemp);
  Blynk.virtualWrite(V1, roomPressure);
  Blynk.virtualWrite(V2, roomHumidty);

  Serial.println();
  delay(2000);

  
}

opps

@Rollmop please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

@Rollmop my suggestion would be to move the bme.temperature to variable and print it and send exactly it.

Because in your current example, you read the bme.temperature twice and value could be changed between this 2 readings. It’s just a guess, because I don’t know how bme library works. But this would be the first thing I would try.

3 Likes