Wemos mini bmp180 sensor example

This bmp180 from Bosch is the best low-cost sensing solution for measuring barometric pressure and temperature. The sensor is soldered onto a PCB with a 3.3V regulator, I2C level shifter and pull-up resistors on the I2C pins. The BMP180 replaces the BMP085.

Specification

  • Pressure sensing range: 300-1100 hPa (9000m to -500m above sea level)
  • Up to 0.03hPa / 0.25m resolution
  • -40 to +85°C operational range, +-2°C temperature accuracy

 

Here is a breakout which makes it easy to use the sensor, link at the bottom. The sensor will cost about $2.50 so its a nice little, low cost addition to use.

GY-68-1 GY-68-3

Wiring

Make the following connections

GND <-> GND

3V3 <-> VIN (or 3Vo)

D1 <-> SCL

D2 <-> SDA

Code

You will need the Adafruit BMP085 library for this example, you can either download it or use the library manager in newer Arduino IDEs.

https://github.com/adafruit/Adafruit-BMP085-Library

In this example I am only looking at the temperature and pressure but there are other functions in the library

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <Adafruit_BMP085.h>

Adafruit_BMP085 bmp;

void setup() 
{
  Serial.begin(9600);
  //Wire.begin (4, 5);
  if (!bmp.begin()) 
  {
    Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
    while (1) {}
  }
}

void loop() 
{
  Serial.print("Temperature = ");
  Serial.print(bmp.readTemperature());
  Serial.println(" Celsius");

  Serial.print("Pressure = ");
  Serial.print(bmp.readPressure());
  Serial.println(" Pascal");


  Serial.println();
  delay(5000);
}

[/codesyntax]

 

Output

Open the Serial monitor and you should see something like this

wemos bmp180
wemos bmp180

Links

BMP180 Replace BMP085 Digital Barometric Pressure Sensor Board Module For Arduino

4 COMMENTS

  1. I attempted to use your code with a wemos r1 d2 board and bmp180 sensor but i get this when i try to verify it:

    C:\Users\Tadd\Documents\Arduino\tempsensorplay\tempsensorplay.ino: In function ‘void loop()’:

    tempsensorplay:48: error: redefinition of ‘void loop()’

    void loop()

    ^

    tempsensorplay:17: error: ‘void loop()’ previously defined here

    void loop()

    ^

    exit status 1
    redefinition of ‘Adafruit_BMP085 bmp’

    Not sure what to do here. Please help me out, thank you.

    • The only time I have seen that is if you have 2 void loops() like

      void loop() {
      // put your main code here, to run repeatedly:

      }

      void loop() {
      // put your main code here, to run repeatedly:

      }

LEAVE A REPLY

Please enter your comment!
Please enter your name here