Rtc1307 and Oled1306 working on Uno but NOT on Nano33

Hi,
I've realized that I made a mistake since I wrote my question in Italian and not in English. I apologize for this misunderstanding but I am a newbie on Arduino AND in this forum and so Im presentin again the same question but in English
This is my problem
I succeded in connecting an Elegoo 1307 rtc to an Oled 1306 on Uno board but when i tested the same sketch with the same devices on a Nano 33 it didn't work
Is this related to the fact that in Uno I can connect each 2Ic device to a different couple of pins while in Nano I have to connect both devices to D18 & D19 pins ?
I checked with I2C scanner and the two devices have different addresses but I do not know if this is dealt with by Nano33 or I have to do something ( and I don't know how)
I tried to verify this topic ( the possibility of connecting multiple I2Cs in Nano33 )and I've found this link

Second i2c interface Arduino Nano 33 IoT.

However, I don't know if this is the needed solution for my problem or if there is something easier to do.
Thx in advance for your help and apologies for a probably trivial question
Bruno

That is only a mistake if you post in Italian in the English part of the forum. There is an Italian forum section, there is no problem posting it there.

You mean the SDA, SCL pins and the A4, A5 pins? In fact they are the same pins! If you check the schematic for Uno you can see that these pins connect to the same 2 pins on the atmega328.

No, you don't need to use a second i²c interface. Your 2 devices have different addresses, as you have found from using the scanner, so can be connected to the same i²c bus.

Whatever the problem is here, we have not discovered it yet. You should post a schematic and your code. Please read the forum guide before you do that.

Hi,
really thx for the time you're spending in helping a newbie.
The schematics is the following one:
Oled 1306 connected with 4 pins ( Vcc, GND, SDA, SCL) to SDA/SCL pins on Uno and 1307 connected with 4 pins (Vcc,GND,SDA,SCL) connected to A4/A5 on Uno ( yes, your're perfectly right, everything works on Uno if I connect on the same couple of pins both I2C devices).
But on Nano 33 there is just a couple of pins identified as SDA/SCL, the D18 and D19 pins so I'm forced to connect both devices to this couple and in this case the Oled just shows a garbage of unintelligible characters.
The code is this

#include <Wire.h>
#include <RTClib.h>
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
RTC_DS1307 rtc;

String time;

void setup() {
  Serial.begin(9600);
  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    while (true);
  }
  delay(2000);
  oled.clearDisplay();
  oled.setTextSize(1);
  oled.setTextColor(WHITE);
  oled.setCursor(10, 10);

  if (! rtc.begin()) {
    Serial.println("errore rtc");
    Serial.flush();;
    while (true);
  }

  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  time.reserve(10);;
}
void loop() {

  DateTime now = rtc.now();
  time = "";
  time += now.hour();
  time += ':';
  time += now.minute();
  time += ':';
  time += now.second();

  oledDisplayCenter(time);
}

void oledDisplayCenter(String text) {
  int16_t x1;
  int16_t y1;
  uint16_t width;
  uint16_t height;

  oled.getTextBounds(text, 0, 0, &x1, &y1, &width, &height);

  // display on horizontal and vertical center
  oled.clearDisplay(); // clear display
  oled.setCursor((SCREEN_WIDTH - width) / 1, (SCREEN_HEIGHT - height) / 2);
  oled.println(text); // text to display
  oled.display();
}

I used a suggestion I found in an educational video on Arduino and it worked fine with Uno as expected.
I really don't understand the issue with Nano 33 since I was able to use the same Oled display for other sensors, like a DHT 11 or a humidity capacitive sensors ( both of them, however, use a single wire foir the signal NOT connected to SDA/SCL but to an analog pin)
Thanks for your precious help
Bruno

Are your OLED display and RTC 5v logic level devices?

The Uno is 5v, the Nano33 is a 3.3v logic level device.

Have you tested the oled with the Nano33 without the RTC? Use one of the example sketches from the oled library.

Perhaps you can post some bright, clear photos of the circuit, so that we can trace every wire.

Some of the SD1306 OLEDs are fitted with a regulator and designed for use on 5V systems.

Some SD1306 OLEDs do not have a regulator fitted and are designed for use on 3.3V systems.

Thank you all for your suggestions.
Yes, I've tested the OLED with Nano33 AND without the RTC and it works fine.
I connected both a DHT11 sensor and a humidity capacity sensor and I was able to read their ouputs on the screen.
The trouble is present only when the Elegoo 1307 is connected on Nano33
So, it looks like that the Oled works both on Uno and on Nano ( so I think that it has a voltage regulator fitted even if I do not know how to check)
The humidity sensor and the DHT 11 ( that are connected to an analog pin while the Oled is connected to SDA/SCL pins) work fine on Nano 33 and obviously on Uno.
RTC works on Uno where RTC is connected to SDA/SCL pins close to AREF pin while the Oled SDA and SCL are connected to A4 and A5 pins ( even if from the schematics and from PaulRb said they are the same).
I took a picture of the physical circuit on the breadboard with Nano 33, RTC and Oled showing garbagewith all the connections but I was not able to find "Additional Options" to upload the photo and share it with you.
Can you help me ?
Thx again

The easiest is to just cut & paste. If Windows use Snip, If Mac use Grab to capture the image, then simply paste into the reply window.


Hi, thx for your advice.
Here you have the physical circuit: red jumpers for 3.3 VCC; black jumpers for GND,white jumpers for SCL and orange/brown jumpers for SDA.
The same circuit works fine on Uno.
Thx for your suggestions

Any suggestion to solve this problem ?
I know that as a newbie, my question is probably trivial but I am not able to find an answer
Could you help me ?
Thx

Have you run the i2c scanner program on the Nano 33? Can you see both devices?

What version of the Nano33 do you have?

I have an original Nano 33 IOT.

it seems that the RTC1307 its a 5V only device.

As found here:

some suggestions here:

Thx a lot for your suggetsion.
However, at the end, I solved the problem by using a
DS3231 instead of DS1307.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.