BMP280 WEMOS D1 Pressure Temp Altitude

Thanks to @Costas for Blynking Magic, here is a working model of the BMP280 pressure sensor. This code has been modified so that pressure is in Mbars from native Pascal, also the altitude correction is specific to my location and will need to be modified to suit the users own location.

The Adafruit_BMP280_Library Library is used.

Here is the Arduino Sketch:-

       // BMP280.ino

    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    #include <Wire.h>
    #include "SPI.h" //Why? Because library supports SPI and I2C connection
    #include <Adafruit_Sensor.h>
    #include <Adafruit_BMP280.h>

    //Setup connection of the sensor
    Adafruit_BMP280 bmp; // I2C

    /*//For SPI connection!
    #define BMP_SCK 13
    #define BMP_MISO 12
    #define BMP_MOSI 11 
    #define BMP_CS 10
    //Adafruit_BMP280 bme(BMP_CS); // hardware SPI
    //Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

    char auth[] = "*******************************";
    char ssid[] = "********************";
    char pass[] = "***************";
    char server[] = "*********";
    BlynkTimer timer;

    float pressure;     //To store the barometric pressure (Pa)
    float temperature;  //To store the temperature (oC)
    int altimeter;      //To store the altimeter (m) (you can also use it as a float variable)

    void setup() {
      bmp.begin();    //Begin the sensor
      Serial.begin(9600); //Begin serial communication at 9600bps
      Serial.println("Adafruit BMP280 test:");
      Blynk.begin(auth, ssid, pass, server);
      timer.setInterval(5000L, ReadSensors);   // read sensor every 5s 

    void ReadSensors(){
      //Read values from the sensor:
      pressure = bmp.readPressure();
      temperature = bmp.readTemperature();
      altimeter = bmp.readAltitude (1029.00); //Change the "1050.35" to your city current barrometric pressure (

      Blynk.virtualWrite(V1, pressure/100);     // write pressure to V1 value display widget
      Blynk.virtualWrite(V2, temperature);  // write temperature to V2 value display widget
      Blynk.virtualWrite(V3, altimeter-51);    // write altimeter to V3 value display widget
      //Print values to serial monitor:
      Serial.print(F("Pressure: "));
      Serial.print(" Mb");
      Serial.print(("Temp: "));
      Serial.print(" oC");
      Serial.print("Altimeter: ");
      Serial.print(altimeter); // this should be adjusted to your local forcase
      Serial.println(" m");    
      //delay(5000); //Update every 5 sec  

    void loop() {;;

Here is the Blynk QR Code for the App side:-

Here is a Screenshot of the APP

Here is the USER changed data for converting to Mbars and local altitude.

Here is Wemos D1 wiring to SDA (GPIO 14), SCL (GPIO 15)


I think you have only posted part of the sketch.

Thanks Costas, corrected now.

Hi, I’m getting “BlynkTimer does not name a type” while compiling the sketch, I know, it’s probably some lame question but I couldn’t find the answer, please advise.
Best Regards

It means you are using old Blynk libraries, upgrade manually (not via the IDE) to 0.4.8 and you’ll be fine.

Hi Costas, thanks for your prompt reply. The issue still persisted after manually updating Blynk libraries as you advised. However adding “#include Blynk.h” to my sketch resolved the problem.

Thanks again!

I have never seen or needed that #include Blynk.h requirement in any of my sketches, with or without timers.

It still sounds like you have some corruption in your libraries… clear out all the old libraries before manually adding in the new ones.

24 posts were split to a new topic: Using BME280 with Blynk