0

I have connected a BMP280 temperature/pressure sensor to an Arduino Uno just like here:

pin layout BMP280+Arduino Uno

and used the example code provided by the Adafruit BMP280 library. However, the values for temperature and pressure return 0.00 on the serial monitor. What might be the reason for this? I have set it up in I2C mode and deleted the lines responsible for the SPI connections.

    /***************************************************************************
  This is a library for the BMP280 humidity, temperature & pressure sensor

  Designed specifically to work with the Adafruit BMEP280 Breakout 
  ----> http://www.adafruit.com/products/2651

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required 
  to interface.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK 13 // deleted the following 4
#define BMP_MISO 12
#define BMP_MOSI 11 
#define BMP_CS 10

Adafruit_BMP280 bme; // I2C
// and the following 2 lines:
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(9600);
  Serial.println(F("BMP280 test"));

  if (!bme.begin()) {  
    Serial.println("Could not find a valid BMP280 sensor, check wiring!");
    while (1);
  }
}

void loop() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");

    Serial.print("Pressure = ");
    Serial.print(bme.readPressure());
    Serial.println(" Pa");

    Serial.print("Approx altitude = ");
    Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
    Serial.println(" m");

    Serial.println();
    delay(2000);
}
  • Yes, the manufacturer's data sheet says there is one integrated (120 Ohms) – ahemmetter Apr 23 '16 at 11:50
  • Well, I followed this tutorial instructables.com/id/…. Where in the schematic would I place such a resistor? – ahemmetter Apr 23 '16 at 15:52
  • Is your I2C address 0x76 or 0x77? Run the I2C scanner to find out: (playground.arduino.cc/Main/I2cScanner) I found that Adafruit_BMP280.h had 0x77 and changing it to 0x76 made it work. No pullups were needed. – user26534 Sep 10 '16 at 19:28
0

I2C has to have pull up resistors on the data lines, otherwise it just doesn't work.

Have a quick search for the correct value but off the top of my head is 4.7k ish.

You have to place a resistor from the SDA and SCK lines to the +5V and suddenly it will jump into life. (Hopefully)

  • I suspect there are already pull-ups on the breakout; doesnt make any sense to not include them. Also if there were no pull-ups, begin() would have failed and there'd be a different error message – TisteAndii Apr 23 '16 at 22:25
  • The recommended value is 10k, according to the documentation. When I connect one of them each between the data pin and V+, I still get an output of 0 – ahemmetter Apr 26 '16 at 10:57
0

I had the same problem and I solved it by changing I2C address from 0x77 to 0x76, in Adafruit_BMP280.h

  • 1
    Good answer, and it would be better if you also had an explanation – dhimaspw Dec 16 '16 at 9:06
0

well the reason for changing the I2C address from 0x77 to 0x76 is when you have your SD0 pulled down to ground.

If there is nothing attached to SD0 on the BMP280 the device address is 0x77 by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.