BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

BMP180 Atm


#1

I need a project with Dht11 and Bmp180.
I tried with your Dht11 and inserted a sketch with Bmp180 but I get this error;C:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:164:90: error: declaration of C function ‘StringSumHelper& operator+(const StringSumHelper&, unsigned char)’ conflicts with
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned char num);

Thanks
renzo695


#2

This artical will help you get started with the BMP180 sensor.

https://learn.sparkfun.com/tutorials/bmp180-barometric-pressure-sensor-hookup-

Once you have the data working in the serial monitor, add Blynk connection and timer code and then pass the serial monitor data to Blynk.

You should always get the sesnsor working without Blynk first as Blynk is merely an output or control system.


#3

Thanks Jamin,
the sketch with BMP180 runs correctly with Arduino, but when I try to compile to Wemos D1 i get many errors.

Wemos with the sketch Dht11 run correctly, also with Blynk.

Renzo


#4

You don’t say which library you’re using for the BMP180, but I’m guessing that’s where your problem lies. Try googling your library name, ESP8266 and Compile Errors and see what you come up with.

Pete.


#5

I use SFE_BMP180.h or BMP180.h with the same results.
I use Win XP


#6

Okay, I’m using SFE_BMP180.h (version 1.1.2) on a Wemos D1 Mini without any problems.
Can you post the code that’s not compiling?

Pete.


#7

Hi Pete,

Error is this; “e:\Programmi\Arduino\libraries\TFT\src/utility/Adafruit_ST7735.h:30:26: fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>”

While pgmspace.h exists.
The solution is beyond my poor knowledges.
While with Arduino is compiled correctly and a slight differentsketch, with Dht11, Wemos and Blink runs correctly-
Thank you for your kindness.
Renzo


#8

Looks like a similar issue to this, a library that expects an AVR board (Arduino) not ESP:

You need to post your full code if you want people to help you.

Pete.


#9

Many thanks but the example doesn’t fit with my my code.

I totally cancelled the part regarding the display of data on the oled, But the is different, is this:

Arduino:1.6.5 (Windows XP), Scheda:"WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"

Opzioni di compilazione cambiate, ricompilo tutto 
Uso la libreria Wire nella cartella: C:\Documents and Settings\mio\Documenti\Arduino\libraries\Wire (legacy) 
Uso la libreria SFE_BMP180-master nella cartella: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SFE_BMP180-master (legacy) 
Uso la libreria SPI nella cartella: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SPI-master  
 
C:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -IC:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include -IC:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include -IC:\DOCUME~1\mio\IMPOST~1\Temp\build4264022526565155186.tmp/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DLWIP_OPEN_SRC -DARDUINO=10605 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI" -DESP8266 -IC:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266 -IC:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\variants\d1_mini -IC:\Documents and Settings\mio\Documenti\Arduino\libraries\Wire -IC:\Documents and Settings\mio\Documenti\Arduino\libraries\SFE_BMP180-master -IC:\Documents and Settings\mio\Documenti\Arduino\libraries\SPI-master C:\DOCUME~1\mio\IMPOST~1\Temp\build4264022526565155186.tmp\meteo_SFE_BMP180_without_display.cpp -o C:\DOCUME~1\mio\IMPOST~1\Temp\build4264022526565155186.tmp\meteo_SFE_BMP180_without_display.cpp.o  
In file included from meteo_SFE_BMP180_without_display.ino:35:0:
C:\Documents and Settings\mio\Documenti\Arduino\libraries\SPI-master/SPI.h:1028:8: error: 'SPIClass' does not name a type
 extern SPIClass SPI;
        ^
Multiple libraries were found for "Wire.h" 
 Used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\Wire 
 Not used: C:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\Wire 
Multiple libraries were found for "SFE_BMP180.h" 
 Used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SFE_BMP180-master 
 Not used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\BMP180_ILI9163_SPI_TFT_Example 
 Not used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\BMP180_Breakout_Arduino_Library-master 
Multiple libraries were found for "SPI.h" 
 Used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SPI-master 
 Not used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SSD1306 
 Not used: C:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI 

Transalation: uso means I use, cartella means directory

Errore durante la compilazione
The complete sketch is this sketch;

/*
***************************
*
*PROGRAMMA IN USO SU DISPLAY
18/9/2017

Inserito programma BMP180_exxample sul quale c?è anche
il calcolo della pressione al livello del mare.

19/9
inserita freccia indicante tendenza pressione

Prossimi sviluppi salvare i dati su scheda SD
 TFT Graph

 
***************************+
 This example for an Arduino screen reads
 the value of an analog sensor on A0, and
 graphs the values on the screen.

 This example code is in the public domain.

 Created 15 April 2013 by Scott Fitzgerald

 http://www.arduino.cc/en/Tutorial/TFTGraph

  */
#include <Wire.h>
#include <SFE_BMP180.h>
#include <SPI.h>



int i=1;
// position of the line on screen
int xPos = 0;
float temp;
float patm; //usata per salvare ultima pressione per confronto
            // con attuale

//#Store an instance of the BMP180 sensor.
SFE_BMP180 pressure;
// Store the current sea level pressure at your location in Pascals.
float seaLevelPressure = 101620;  // Williamsburg, VA on
#define ALTITUDE 84.0 // Altitude of Basaldella-Udine
void setup() {
  // initialize the serial port
  Serial.begin(9600);
  // We start the I2C on the Arduino for communication with the BMP180 sensor.
   Wire.begin();
  // We create an instance of our BMP180 sensor.
  pressure = SFE_BMP180();
  if (pressure.begin())
    Serial.println("BMP180 init success");
  else
  {
    // Oops, something went wrong, this is usually a connection problem,
    // see the comments at the top of this sketch for the proper connections.

    Serial.println("BMP180 init fail\n\n");
    while(1); // Pause forever.
  }
   
}

void loop()
{  
  char status;
  double T,P,p0,a;
  // Loop here getting pressure readings every 10 seconds.
  // If you want sea-level-compensated pressure, as used in weather reports,
  // you will need to know the altitude at which your measurements are taken.
  // We're using a constant called ALTITUDE in this sketch:
    // If you want to measure altitude, and not pressure, you will instead need
  // to provide a known baseline pressure. This is shown at the end of the sketch.

  // You must first get a temperature measurement to perform a pressure reading.
  
  // Start a temperature measurement:
  // If request is successful, the number of ms to wait is returned.
  // If request is unsuccessful, 0 is returned.

  status = pressure.startTemperature();
  if (status != 0)
  {
    // Wait for the measurement to complete:
    delay(status);

    // Retrieve the completed temperature measurement:
    // Note that the measurement is stored in the variable T.
    // Function returns 1 if successful, 0 if failure.

    
         
    status = pressure.getTemperature(T);
    if (status != 0)
    {
      
      //Cancello lo schermo per T e indico andamento pressione
      //confrontanto pressione prima cancellazione con attuale
       
   
         
      // Print out the measurement:
      Serial.print("temperature: ");
      Serial.print(T,2);
      Serial.print(" deg C, ");
      Serial.print((9.0/5.0)*T+32.0,2);
      Serial.println(" deg F");

      //Display temperatura

      temp=T;
      
      // Start a pressure measurement:
      // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
      // If request is successful, the number of ms to wait is returned.
      // If request is unsuccessful, 0 is returned.

      status = pressure.startPressure(3);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

        // Retrieve the completed pressure measurement:
        // Note that the measurement is stored in the variable P.
        // Note also that the function requires the previous temperature measurement (T).
        // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
        // Function returns 1 if successful, 0 if failure.

        status = pressure.getPressure(P,T);
        if (status != 0)
        {
          // Print out the measurement:
          Serial.print("absolute pressure: ");
          Serial.print(P,2);
          Serial.print(" mb, ");
          Serial.print(P*0.0295333727,2);
          Serial.println(" inHg");

          

          // The pressure sensor returns abolute pressure, which varies with altitude.
          // To remove the effects of altitude, use the sealevel function and your current altitude.
          // This number is commonly used in weather reports.
          // Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.
          // Result: p0 = sea-level compensated pressure in mb

          p0 = pressure.sealevel(P,ALTITUDE); // we're at 1655 meters (Boulder, CO)
          Serial.print("relative (sea-level) pressure: ");
          Serial.print(p0,2);
          Serial.print(" mb, ");
          Serial.print(p0*0.0295333727,2);
          Serial.println(" inHg");
          Serial.print("Valore pressione: ");
          Serial.println(patm);
        

            // On the other hand, if you want to determine your altitude from the pressure reading,
          // use the altitude function along with a baseline pressure (sea-level or other).
          // Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.
          // Result: a = altitude in m.

          a = pressure.altitude(P,p0);
          Serial.print("computed altitude: ");
          Serial.print(a,0);
          Serial.print(" meters, ");
          Serial.print(a*3.28084,0);
          Serial.println(" feet");

          Serial.print("Posizione:");
          Serial.println(xPos);
          
  

        

  //Cancello lo schermo sul dato di T
  delay(50000);  // Pause for 5 seconds.
         

    
      if  (xPos >= 160) {
        xPos = 0;
        patm=p0;
        //TFTscreen.background(255, 255, 255);
  } 

  
        }
        else Serial.println("error retrieving pressure measurement\n");
      }
      else Serial.println("error starting pressure measurement\n");
    }
    else Serial.println("error retrieving temperature measurement\n");
  }
  else Serial.println("error starting temperature measurement\n");

 }

You can ignore all comments in italian
Thanks
Renzo


#10

Correction: the second row is this:
I totally cancelled the part regarding the display of data on the oled, But the error is different, is this:


#11

You need to edit your post and format the code correctly using “```cpp”

See https://community.blynk.cc/faq

Pete.


#12

I apologize if I do something wrong, I don’t want to offend or to be impolite .

Of curse the main part of the code is not mine, nor are libraries.
How may I send you the code that you asked me and what you mean “format the code correctly using”***cpp"?

May I send the code using the command of Arduino IDE <copy for forum Ctrl+Shift+C> ?


#13

If you follow the link I gave to the FAQs (https://community.blynk.cc/faq) and scroll down to the bottom - to the section that says “wrap your code” - you’ll see an explanation of what you need to do.

Pete.


#14

@PeteKnight I fixed it… sometimes it is just easier to do it for them then try to explain up front :wink:

@renzo695 As per the Welcome Topic, I have “formatted” your posted code with the required backticks as showen here:

Blynk - FTFC


#15

Thanks @Gunner, you’re a star!

@renzo695 - I’ve popped your code into my Arduino IDE and it compiles first time…

Sketch uses 239373 bytes (22%) of program storage space. Maximum is 1044464 bytes.
Global variables use 32716 bytes (39%) of dynamic memory, leaving 49204 bytes for local variables. Maximum is 81920 bytes.

I think you may have a problem with your IDE installation. Not sure of the easiest way of fixing that, short of re-installing. If you have access to another PC then maybe do a fresh install on that.

Pete.


#16

Thanks, I’ll try but I don’ t know where I have to begin with.
Consider that i am an hobbyst I have a mechanical and thermodynamical preparation and when I follow the school transistors was not invented yet.

Al the few that I know I learned browsing the Web.

Thank you very much for your patience.


#17

You’ve previously managed to install the Arduino IDE software on your computer, so uninstalling and re-installing shouldn’t be anything that you’re unfamiliar with.
If you’re not confident doing that then maybe do a quick Google search?

Pete.


#18

@renzo695 Just looking back through the thread, the compiler error messages you posted show warnings that you cane multiple versions of your libraries installed.

Multiple libraries were found for “Wire.h”
Used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\Wire
Not used: C:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\Wire
Multiple libraries were found for “SFE_BMP180.h”
Used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SFE_BMP180-master
Not used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\BMP180_ILI9163_SPI_TFT_Example
Not used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\BMP180_Breakout_Arduino_Library-master
Multiple libraries were found for “SPI.h”
Used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SPI-master
Not used: C:\Documents and Settings\mio\Documenti\Arduino\libraries\SSD1306
Not used: C:\Documents and Settings\mio\Dati applicazioni\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI

It appears that the compiler is using the versions in the Arduino folders rather than those in the ESP8266 folders. You should probably fix this issue before you do anything else, it may save you re-installing the IDE.

Pete.


#19

I compiled the sketch in a computer that I never use an runs perfectly, thank.

The fact is that Arduino instructions say to put the libraries in the folder ,
but many sketches don’t recognize this folder so the same library is spread around the disk.

Problem solved thank.