Saturday, July 22, 2017

BMP180 and wemos D1 reading temperature, pressure and altitude


To read the pressure, temperature and altitude you can use an BMP180 cheap i2c breakout.

1. Materials:

Wemos D1USD 3.99
BMP180USD 1.97
Total:USD 5.96


2. Libraries:

Install Adafruit BMP_085 libraries from Library Manager:


3. Connections:
VCC----3V3
GND----GND
SDA----D2
SCL----D1



4. Code:

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

Adafruit_BMP085 bmp;

void setup()
{
  Serial.begin(115200);
  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP180 sensor, check wiring!"));
  }
}
void loop()
{
  // Wait a few seconds between measurements.
  delay(2000);

  Serial.print(F("Pressure: "));  Serial.println(bmp.readPressure()/100);
  Serial.print(F("Temperature: "));  Serial.print(bmp.readTemperature()); Serial.println(F("*C"));
  Serial.print(F("See level pressure: "));  Serial.println(bmp.readSealevelPressure());
  Serial.print(F("Altitude: "));  Serial.println(bmp.readAltitude());
  Serial.println(F("----------------------------------------"));
}



No comments:

Post a Comment