1

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: Oled.begin(); Oled.setFlipMode(true); Oled.setFont(u8x8_font_7x14B_1x2_r);

Pressure.begin(); }

void loop() { // put your main code here, to run repeatedly: Oled.clear();

Oled.setCursor(0, 10); Oled.print("Temp: "); Oled.print(Pressure.readTemperature()); Oled.print(" C"); Oled.setCursor(0, 20); Oled.print("Pres: "); Oled.print(Pressure.readPressure()); Oled.print(" Pa"); Oled.setCursor(0, 30); Oled.print("Alti: "); Oled.print(Pressure.readAltitude()); Oled.print(" m");

delay(1000); }

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
fireblazer10
  • 111
  • 2
  • 10

1 Answers1

3

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() { Oled2.begin(); Oled2.setFlipMode(true); Oled2.setFont(u8x8_font_7x14B_1x2_r);

Pressure.begin(); }

void loop() { Oled2.clear();

Oled2.setCursor(0, 10); Oled2.print("Temp: "); Oled2.print(Pressure.readTemperature()); Oled2.print(" C");

delay(1000); }

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

Peter Paul Kiefer
  • 1,893
  • 9
  • 11