I2C Issue with BMP280 and TH02

Hi there and sorry, if I am making a trivial mistake, but I am new to Arduino projects and I am experiencing a problem.
I want to connect a

  • Grove - Temperature&Humidity Sensor (High-Accuracy &Mini) v1.0 and a
  • Grove - Barometer Sensor (BMP280)
    to the Grove BaseShield of my Arduino Uno via I2C.

The example sketches work fine, when I connect only one of them, but when I connect both, the example Sketch for BMP280 does not run, whereas the Sketch of TH02 does run.

I digged into the BMP280 library, and found that the sketch gets stuck in the init() function when assigning dig_T3. More specifically in the function bmp280Read16(), because the wire.available() function called there, results in a number less than 2.

What could be the problem here and how can I fix it?
It seems as if the earlier connections while assigning dig_T1 and dig_T2 in the init() function did not get closed properly.

Thank you very much,
Oliver

@salman Can you help him?

Hi @owahl83, can you share both sketch and the final sketch you combined into one.

Hi @salman,

This is the original demo code:
/*
* Demo name : TH02_dev demo
* Usage : DIGITAL I2C HUMIDITY AND TEMPERATURE SENSOR
* Author : Oliver Wang from Seeed Studio
* Version : V0.1
*/

#include <TH02_dev.h>
#include "Arduino.h"
#include "Wire.h" 
 
void setup()
{  
  Serial.begin(9600);        // start serial for output
  
  Serial.println("****TH02_dev demo by seeed studio****\n");
  /* Power up,delay 150ms,until voltage is stable */
  delay(150);
  /* Reset HP20x_dev */
  TH02.begin();
  delay(100);
  
  /* Determine TH02_dev is available or not */
  Serial.println("TH02_dev is available.\n");    
}
 

void loop()
{
   float temper = TH02.ReadTemperature(); 
   Serial.println("Temperature: ");   
   Serial.print(temper);
   Serial.println("C\r\n");
   
   float humidity = TH02.ReadHumidity();
   Serial.println("Humidity: ");
   Serial.print(humidity);
   Serial.println("%\r\n");
   delay(1000);
}

and this is the modified code, that gets stuck

/*
 * Demo name   : TH02_dev demo 
 * Usage       : DIGITAL I2C HUMIDITY AND TEMPERATURE SENSOR 
 * Author      : Oliver Wang from Seeed Studio
 * Version     : V0.1
*/

#include <TH02_dev.h>
#include <Seeed_BMP280.h>
#include "Arduino.h"
#include "Wire.h" 

BMP280 bmp280;

void setup()
{  
  Serial.begin(9600);        // start serial for output
  
  Serial.println("****TH02_dev demo by seeed studio****\n");
  /* Power up,delay 150ms,until voltage is stable */
  delay(150);
    if(!bmp280.init()){
    Serial.println("Device error!");
  }
  /* Reset HP20x_dev */
  TH02.begin();
  delay(100);
  
  /* Determine TH02_dev is available or not */
  Serial.println("TH02_dev is available.\n");

 
}
 

void loop()
{
   float temper = TH02.ReadTemperature(); 
   Serial.println("Temperature: ");   
   Serial.print(temper);
   Serial.println("C\r\n");
   
   float humidity = TH02.ReadHumidity();
   Serial.println("Humidity: ");
   Serial.print(humidity);
   Serial.println("%\r\n");
   delay(1000);
}

Thank you very much for your help.
Oliver

Hi all,

same for me and same project with TH02 and BMP280 with an I2C hub and connector carrier for MKR 1010.

Almost same code, as I written in an other topic I’ve seen that when I instantiate the libraries (TH02_dev.h and Seeed_BMP280.h), without connecting any device to the MKR Carrier, the I2C scanning give me the result of 2 devices connected at addresses 0x60 and 0x6B.

When I connect one of them one by one, the addresses are: 0x60, 0x6B, plus the real address of the device (defined in the libraries: 0x40 for TH02 and 0X77 for BMP).

@owahl83 have you solved?

Hi Chnox,

I was wondering if you or someone eventually found out what was the trouble.
Thanks in advance!