Help with BMP-280 Sensor
I am unable to get past the "Could not find a valid BMP280 sensor, check wiring!" condition in the Adafruit BMP-280 library.
I recently ordered a BMP-280 sensor from “Funny DIY Expert” via Amazon. The sensor is labeled GY-B11 280 and has 6 pins:
VCC
GND
SCL (clock?)
SDA (MOSI?)
CSB (CS/SS?)
SDO(MISO?)
This is not the Adafruit version of the chip with a built in logic level converter, so I am using a logic level converter to communicate with my controler. I am using clones of the Arduino Nano and Arduino Mega (I have attempted with each board). I have attempted the example sketch on each board with both the I2C and SPI wiring configurations. My desired end state is to use the BMP-280 with the Nano and SPI protocol. Also, the datasheet I can finde at https://www.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf sudgests that there should be 7 pins, witht he 7th being VDDIO (as near as I can tell, the Adafruit version also has 7 pins, but the 7th pin is a 3.3V in for the on-board logic level shifter).
After receiving the “check wiring” message, I verified the communication path from the Nano to the BMP-280 with a fluke. The 5V signal passes correctly through the logic level converter resulting in a 3.3V signal at the correct pin of the BMP-280.
I suspected I may have a problem with my Arduino libraries because I also attempted to use this code from http://www.instructables.com/id/How-to-Use-the-Adafruit-BMP280-Sensor-Arduino-Tuto/step3/The-code/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS 10
Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
float pressure;
float temperature;
int altimeter;
void setup() {
bmp.begin();
Serial.begin(9600);
Serial.println("Adafruit BMP280 test:");
}
void loop() {
pressure = bmp.readPressure();
temperature = bmp.readTemperature();
altimeter = bmp.readAltitude (1050.35);
Serial.print(F("Pressure: "));
Serial.print(pressure);
Serial.print(" Pa");
Serial.print("\t");
Serial.print(("Temp: "));
Serial.print(temperature);
Serial.print(" oC");
Serial.print("\t");
Serial.print("Altimeter: ");
Serial.print(altimeter); // this should be adjusted to your local forcase
Serial.println(" m");
delay(5000); //Update every 5 sec
}
When I attempt to upload the code, I get an error message reading, “exit status 1
'bmp' was not declared in this scope.” in reference to the line:
pressure = bmp.readPressure();
If I change all “bmp.” entries to “bme.” entries (as indicated by the line:
Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK) I can upload the code. The same is true if I change:
Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
to:
Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
but the resulting output of T=0 P=0 and a nonsensical altitude indicate that I am not receiving data from the BMP-280.
These indications along with the fact that the lines:
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
pressure = bmp.readPressure();
altimeter = bmp.readAltitude (1050.35);
do not follow the standard font color code in the IDE (all are only black text vice the expected red), lead me to think I am having a problem with the libraries and not the BMP-280 itself. I have completely removed all Arduino related files and programs from my computer and re-installed from the source to ensure that they are properly located and not corrupted, but I still have the same problems.
I do not yet know enough about these projects to attempt to re-create specific commands from the associated libraries, so this is about all the troubleshooting I can think to do. Any recommendations on resolving this issue would be greatly appreciated. If you suspect that my BMP-280 is not functioning properly, please let me know how you diagnosed this problem so I can use the technique in the future and justify a return of the chip.
Thank you for your help,
Sam