I'm still relatively new to this kind of development, and am trying to build a weather station using the BMP280 sensor to capture the barometric pressure and humidity. The sensor is not delivering these values, and I'd like to ask if someone could point me in the right direction.
I have wired the sensor to the Z-Uno I2C pins 9 and 10 according to the information I found at Z-Uno.Z-wave.me and comparing these to the pins needed as described in the Adafruit I2C wiring guide. With this, the SCK pin is at pin 9 on the Z-Uno, and the SDI pin on pin 10. Below is the code I wrote to simply test functionality before I attempt to write the values to a database. The serial monitor reports only zero values.
I have studied the forum and looked at some things and tried them out. I also looked to see if a new version of the library is available, but I have the newest. I'm using the Z-Uno library 2.1.5 in the Arduino IDE.
I would greatly appreciate any help anyone could provide.
Thanks,
Karl
Code: Select all
#include <ZUNO_BMP280.h>
// Barometric pressure sensor
ZUNO_BMP280 bmp;
boolean foundBmp;
int barometricPressure; // here we will store the barometric pressure
int humidity; // here we will store the humidity
void setup() {
// put your setup code here, to run once:
Serial.begin();
Serial.println("start");
foundBmp = bmp.begin();
}
void loop() {
// put your main code here, to run repeatedly:
if (foundBmp = true) {
// Get barometric pressure
barometricPressure = bmp.readPressurePa()/10;
// Get humidity
humidity = bmp.readHumidityH10()/10;
Serial.print("Pressure = ");
Serial.print(barometricPressure);
Serial.println(" Pa");
Serial.print("Humidity = ");
Serial.print(humidity);
Serial.println(" %");
} else {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
}
// send every 10 second
delay(10000);
}