I tried to connect two modules that require I2C connection and they won't work at the same time.

I used the Arduino Sensor Kit - Base. This kit does not need any connection, you just have to code to get your desired output. I wanted to display the Air Pressure (BMP280) module values to the 0.96" OLED Display, however, it is refusing to run both the air pressire and the OLED display at the same time. Only running one module (either Air pressure or OLED) at a time makes it work. Does it have something to do with how the I2C connection is wired on the board?

#include "Arduino_SensorKit.h"

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
  Oled.setCursor(0, 10);
  Oled.print("Temp: ");
  Oled.print(" C");
  Oled.setCursor(0, 20);
  Oled.print("Pres: ");
  Oled.print(" Pa");
  Oled.setCursor(0, 30);
  Oled.print("Alti: ");
  Oled.print(" m");


What I did:

  1. Test to see if Air Pressure will still work while both Air Pressure and OLED is connected by using Serial.begin(). Now I know that only the OLED does not work when both modules are connected.
  2. Changed order of initialization. Same result: Air Pressure works but not OLED
  • "it is refusing to do so" means what? It's printing nothing to the OLED? It's printing things but getting the values wrong? Please be more specific. – Majenko Jan 20 at 15:21
  • it has nothing to do with how the I2C connection is wired on the Base shield. run the I2C scanner sketch to see the devices I2C addresses – Juraj Jan 20 at 15:45
  • 1
    @Juraj Still the same output. OLED won't work :( – fireblazer10 Jan 21 at 1:40
  • 2
    @RowanP Thank you for clearifying and for reminding me of what I what to do last evening. I completely forgott :-(. The BMP280 and Oled speed capabilities can be the same but as the Pressure lib and the Oled lib both use the Wire lib when they initialize, there may be a side effect if both specify different speeds. It is just a guess. Perhaps the Wire lib gets confused. – Peter Paul Kiefer Jan 24 at 13:41
  • 2
    I opend an issue on github. I think there is a problem with the Oled constructor. github.com/arduino-libraries/Arduino_SensorKit/issues/15 If i'm right, the clock of the 'I2C bus resets the OLED. If Pressure is active the I2C clock is active. -> reset the Oled. Tada. ;-) – Peter Paul Kiefer Jan 25 at 19:04

About two weeks ago there was a change in the Arduino_SensorKit Library that introduced an error with the instanciation of the Oled object.

I found the error in the release (v1.0.6) of the library. The previous release (v1.0.5) could cause another issue, as it uses a software I2C. I doubt the hardwired sensores are connected with the correct pins. But I have no hardware, so I can not check this.

I propose a workaround to see, if the identified issue caused your observations.

#include "Arduino_SensorKit.h"

U8X8_SSD1306_128X64_NONAME_HW_I2C Oled2;
// if the line above does not work
// comment it and uncomment the following line.
// U8X8_SSD1306_128X64_NONAME_HW_I2C Oled2(U8X8_PIN_NONE);

void setup() 


void loop() 
  Oled2.setCursor(0, 10);
  Oled2.print("Temp: ");
  Oled2.print(" C");


Could you please try out and report your experience. If it would work, I can support the fixing of the issue.

  • It works! OLED just keeps blinking but it shows the output now! The blinking could be fixed by changing Oled2.clear() to Oled2.refreshDisplay(). Thank you so much! – fireblazer10 Jan 28 at 13:19
  • 1
    You're welcome. Meanwhile I got feedback from marqdevx. He is about to release a new version of the lib. I think as soon as it is available, this workaround is not necessary furthermore (<- don'T know if this is an english word. But it sounds good ;-) ). As soon as the new revision is available I'll edit my answer and add your "blinking" solution too. Cheers! – Peter Paul Kiefer Jan 28 at 13:30

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.