I'm trying to use the BME / BMP 280 4 pin sensor to get a temperature. I've tried both the SparkFun and Adafruit APIs and in both cases, the "begin" function returns false. I'm pretty new to this, so its probably something obvious.
I ran the i2c Scanner found here: Arduino Playground - I2cScanner and it finds a device at 0x76. The Adafruit API begin function accepts an address (defaults to 0x77) so I tried 0x76 but I still get a false return value.
Does the fact that the i2C scanner finds a device indicate that the wiring is correct? Any suggestions on troubleshooting?
I've attached screen shots of the wiring in case they are any help. Its probably not clear from the images, but the SDA pin is connected to the Arduino A5 pin and the SCL pin is connected to the Arduin A4 pin.
The code (including some commented out code from previous attempts) that indicates the begin function failure is below.
#include "Wire.h"
#include "SPI.h"
//Global sensor object
//Adafruit_BME280 mySensor;
BME280 mySensor;
unsigned int sampleNumber = 0; //For counting number of CSV rows
int delayTime;
void setup()
{
Serial.begin(9600);
Serial.println("Reading basic values from BME280");
Wire.begin();
bool status;
// status = mySensor.begin(0x76);
status = mySensor.begin();
// status = mySensor.begin(&Wire);
// Serial.println (BME280_ADDRESS, HEX);
Serial.print ("Status: ");
Serial.println (status);
When the I2C scanner finds the expected address, that's good news.
BME / BMP 280 4 pin sensor
But where did you get that board from and what is it advertised to be? The BME280 sensor is not the same as a BMP280.
Are the header pins soldered to the BME280 board? It's hard to tell from the photo.
(it would also help if you had not used yellow wires for both SDA and SCL)
The pins are not soldered. I didn't know if that is needed or if its just a "nice to have". Should I solder them and try again?
I got the board from here:
Should I be using a different API?
I was afraid the the yellow wires would make it difficult. I ran out of different colored wires. The SDA is connected to A5 and the SCL is connected to A4.
It is essential that the pins be soldered to the board.
Using the magnified view of the board at the link you gave, the chip does not look like a BME280 or BMP280. The datasheets show that the genuine chip is clearly marked "BME280". The one at that site appears to be marked "092" (or D92) and "UP".
I will try soldering the connections and see if I get any better results. If that doesn't get me a temperature, I will see if I can find any information about the specific board I bought. If all else fails, I'll make sure I get a real BME280.
I think soldering did the trick! After soldering the header pins to the sensor, I switched to the Adafruit API because that lets me specify the address (0x76 instead of 0x77) and I'm getting temperature readings.
wvmarie, thank you for the information about the library. I am only concerned at the moment about temperature (we're having A/C problems and I want to keep an eye on the temperature while I'm at work), so temperature is good enough.
Now I'm setting up a web service using the ethernet shield. I've already done some of that, so I think I'm in good shape!
A follow-up (because I do recognize that breakout board). There are a lot of cheap BMP clones and clone boards out there - I've actually sourced them off eBay because then they are dirt cheap, -but- you get what you pay for. I've had a few that failed out of the package (very few actually), several that were set up as the alternative not the default I2C address (not that this board actually has I2C jumpers so you can change the address), and some that were sold as BMP and were BME or vise versa. If you have a non-standard board... test with an I2C sniffer, and then test some more, and don't be too surprised if something unexpected happens.
bassebus:
My $2 BME280 was actually an BMP280, no humidity sensor, too bad.
No wonder, that's too cheap for the BME280, but quite right for the BMP280.
The BME280 sensor costs much more than USD 2 a piece in bulk - without the breakout board and so.