Using BME280 (Not BMP) with Blynk

@Toro_Blanco I’m addicted, had my browser open 14 hours now. Reading the docs and trying sketch’s in the builder, since @Gunner replied to my first post. Even tried Google in the hope I’d find an easy example of a BME280 being used with Blynk so I could try and pick it apart to see how it was done. So far all I’ve managed to do is admire someone else’s hard work as I’ve watched a NodeMCU and an ESP8285 send data to the Blynk app on my phone… :disappointed:

Well keep at it. I will not be near a computer until tomorrow (responding from my phone). When I can I will try and see if I can come up with something to help you out.

Basically you will need the library for the BME, and need to know the calls to get the temp/humidity/pressure. Put those calls in a timed loop with some virtualwrites to display data to BLYNK.

1 Like

@Toro_Blanco Been trying that, get a lot of orange writing at the bottom of the Arduino IDE. Only about 5% of it makes any sense. :astonished:

Your original sketch was almost what you needed.
Replace the reference to the library, change the BMP’ to BME’s and change the line that reads the altitude to bme.readHumidity

Once it’s working you can tidy-up the variable names from altitude to humidity.

Pete.

1 Like

@PeteKnight Thanks, but I’m done for today. I’ll try again on my next day off work … Thanks for your help everyone, see you again soon …

Morning guys.
Well after 5 hours sleep I jump in the truck, coffee and sandwiches in hand, only to receive a phone call telling me the site is under 2 feet of water. Strong winds have blown over a huge oak that cracked a water main.

So, here I am again. Coffee and sandwiches in one hand, mouse in the other, and still wearing my overalls … :joy:

HUGE thank you to @PeteKnight for pointing me in the right direction. Because I’ve done it, well almost, 390% humidity. This sensor thinks I’m on site. :sweat_smile:

Pete, I did try changing the altitude to bme.readHumidity but then it fails to compile. Gives me “error: ‘humidity’ was not declared in this scope_”_ . If I leave it I get 390% humidity. :crazy_face:

At least the water is a comfortable 24°C :stuck_out_tongue:

1 Like

What is the code you are currently using to get this reading… are you sure it is not the pressure instead?

Not sure if I know how to post this properly but here goes.

#include <Blynk.h>
    #include <ESP8266WiFi.h>
    #include <Wire.h>
    #include <BlynkSimpleEsp8266.h>
    #include <Adafruit_Sensor.h>
    #include <Adafruit_BME280.h>
    #define SEALEVELPRESSURE_HPA (1013.25)
    //Setup connection of the sensor
    Adafruit_BME280 bme; // I2C

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

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

    void setup() {
      bme.begin(0x76);    //Begin the sensor
      Serial.begin(9600); //Begin serial communication at 9600bps
      Serial.println("Adafruit BME280 test:");
      Blynk.begin(auth, ssid, pass);
      timer.setInterval(2000L, ReadSensors);   // read sensor every 5s 
    }

    void ReadSensors(){
      //Read values from the sensor:
      pressure = bme.readPressure();
      temperature = bme.readTemperature();
      humidity = bme.readHumidity ();

      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);    // write altimeter to V3 value display widget
      
      //Print values to serial monitor:
      Serial.print(F("Pressure: "));
      Serial.print(pressure);
      Serial.print(" Mb");
      Serial.print("\t");
      Serial.print(("Temp: "));
      Serial.print(temperature);
      Serial.print(" °C");
      Serial.print("\t");
      Serial.print("Humidity: ");
      Serial.print(altimeter); // this should be adjusted to your local forcase
      Serial.println(" %");    
      //delay(2000); //Update every 5 sec  
    }

    void loop() {
      Blynk.run();
      timer.run();
    }

The code goes inbetween triple backtick characters… I fixed your last post :wink:

Blynk - FTFC

1 Like

Thanks Gunner, this is a bit of a steep learning curve for me, I’ve been in construction all my life. This is a whole new world for me …

Your code seems to have alternating altimeter and humidity variables… hard to see what means what :stuck_out_tongue: Try cleaning that up.

1 Like

I’VE DONE IT!

Admittedly with a lot of help from you guys but, IDID IT! :rofl::smiley::rofl::smiley:

3 Likes

Now get back to work instead of eating up your lunch and playing “computer games” :rofl:

1 Like

I’m going to celebrate, having 2 sugars in my next coffee instead of 1 … :joy:
Thanks for your help, much appreciated …

1 Like

Well done for sticking with it.
This is why contributors to the forum don’t tend to post code for people. The sense of achievement and the confidence and knowledge gained by doing it yourself - with a few nudges in the right direction - will help you stick with it in future.

If you scan the other forum topics you’ll see that a small handful of people answer most of the questions that are asked. They all started off like you and their knowledge and experience has grown over time by putting in the hours at the keyboard, and gaining a few grey hairs in the process. If you keep at it, you’ll be one of those people answering the questions :grinning:

Pete.

3 Likes

And don’t forget all the $$, glory, power, girls… (wakes up to the reality of geekdom)… hrumph… I think i’m in the wrong hobby :stuck_out_tongue:

2 Likes

I got another phone call. They wanted help installing pumps to empty the site, only just got home, soaked to the skin.

Feel a bit stupid at the moment, everything is so alien to me, so much I don’t understand. Yet others find it a easy as walking the dog. I’m hoping for an early retirement, fingers crossed this will be my hobby that I use as a substitute for the last 35 years grafting on building sites. :construction_worker_man:
It was your “your almost there” comment that got me thinking and heading in the right direction, thank you.

I plan to retired not dig myself an early grave. :joy:
Plus the wife only lets me out on Friday nights while she’s at work(she’s an A&E Nurse, nightshift).

I’ve just had an hour playing with the Blynk app on my phone. Impressive but wasn’t aware that the “Energy” thing was restricting my ability to do stuff at first. Just brought 28,000 “Energies” so I can have a proper mess with it. :wink:

cool, I have been trying develop a project the same by using the same sensor…
would you mind to share the arduino code just to see how it is now?
thanks and congrats…