04-20-2019 03:18 PM - edited 04-20-2019 03:21 PM
Hi all,
Had a look on the forums and could not find a similar problem that I am experiencing.
I have designed a board using the BMP280, where I'd like to read off temperature, pressure and altitude using I2C. To do this, I pulled pin CSB high (+3.3V) to activate I2C as per datasheet recomendation and SDO was pulled low to use the address 0x76.
I am using an Atmega2560 (using arduino bootloader but on a standalone board) to attempt to read the I2C. I added the libraries needed and changed the access address to 0x76 instead of the default 0x77. However, when reading the BMP280, I get a constant temperature of 136.1C with very large pressure and altitude (do not remember exact values). The values do not change if I apply external pressure or temperature to the sensor.
Is there an another register besides the ID address I also have to set as I am using the 0x76 address? I cannot change the position of the SDO pin now due to the PCB already being made... Attached schematic if that helps.
NOTE: I also have an RTC and another sensor (MPU6050) on the same I2C lines. They both work. However, initially the MPU6050 also did not work with similar behaviour as the BMP280. Here the ID address had to be changed fromt the default 0x68 to 0x69. There are no ID address collisions between the I2C devices.
Any input that may give a direction will be greatly appreaciated! 🙂
EDIT: Pull up resistors have been added to the SCL and SDA lines!
04-20-2019 09:05 PM
Hi,
Try to run an I2C scanner program to verify the addresses and sensor connection.
Michael
04-21-2019 04:29 PM
@micha_pr wrote:Hi,
Try to run an I2C scanner program to verify the addresses and sensor connection.
Michael
Thank you, however this has already been done! The device can be found on address 0x76 as expected. It is just the returned values that do not make sense.
04-21-2019 06:54 PM
Can you publish the used program / library?
It must work 🙂 ...
04-22-2019 07:36 PM
@micha_pr wrote:Can you publish the used program / library?
It must work 🙂 ...
A bit slow of a response...
Of course! I believe this is the arduino code that was used.
*********************************************************************
/***************************************************************************
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>
Adafruit_BMP280 bmp; // I2C
//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 (!bmp.begin()) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pa");
Serial.print("Approx altitude = ");
Serial.print(bmp.readAltitude(1013.25)); // this should be adjusted to your local forcase
Serial.println(" m");
Serial.println();
delay(1000);
}
*********************************************************************
And the Adafruit_BMP280.h header file had this section changed (0x77 to 0x76).