GY-91 Sensor measuring Pressure; Arduino
From cod3v
Introduction
Note the I2C address. Use the I2C scanner https://cod3v.info/index.php?title=I2c_scanner#Theory and add the correct address to the
bmp.begin(ADDRESS);
You cold add a flag to see if it is connected, eg:
unsigned status;
status = bmp.begin(ADDRESS);
if (!status) {
Serial.println("Fail");
}
Theory
An example code from Adafruit library
#include <Wire.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp; // I2C
float T, p, h;
void setup() {
Serial.begin(9600);
bmp.begin(0x76); // Note the Address! Use i2c_scanner to find it
/* Default settings from datasheet. */
//bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */
// Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */
// Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */
// Adafruit_BMP280::FILTER_X16, /* Filtering. */
// Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
Serial.print("T [C]");
Serial.print("\t");
Serial.print("p [Pa] ");
Serial.print("\t");
Serial.print("h [m]");
Serial.println("\t");
}
void loop() {
T = bmp.readTemperature();
p = bmp.readPressure();
h = bmp.readAltitude(1013.25); /* Adjusted to local forecast! */
Serial.print(T); // LÄmpötila
Serial.print("\t");
Serial.print(p); // Paine
Serial.print("\t");
Serial.print(h); // Height should be calibrated
Serial.print("\t");
Serial.println();
delay(2000);
}
Exercises
- Warm the sensor by putting it
- Blowing into it.
- between fingers
- close to the radiator
- in the fridge; not really warming but. . .
- Try changing the pressure. Put it in a plastic bag and
- blow into it. Can you see the change
- use vacuum cleaner to reduce the pressure. How good is your vacuum cleaner?