Can i change the analog input from sensors ?

I have a ds3231 real time clock module and a oled screen and they both use the analog 4 and analog 5 pins. Is there a way i can change them so i can connect both at the same time ?

i2c is a bus that can handle over 100 devices, as long as they have different addresses.

elvon_blunden replied while I was writing this, but mine has a bit more information so I'll post it anyway:

In addition to being analog input pins, A4 and A5 are also the I2C pins on many Arduino boards. It's almost certain that the RTC and OLED use these pins because they are the I2C bus pins, rather than that they are ADC pins. I2C is a bus. You can connect as many I2C devices as you like to the I2C bus as long as each has a unique address (which your RTC and OLED definitely do). So just connect both of them to A4 and A5 and carry on!

1 Like

For the physical connection you would probably need to resort to breadboard: take a wire from each of the i2c pins to the breadboard, one to each of two rows. Then use the other holes in each row to take a wire to the other devices.

There is one easier way though, if you have a Uno. On an Uno, over by pin 13, next to AREF, there are two copies of the A4 (=SDA) and A5 (=SCL) pins which you can also use. They are electrically the same as the ones over with the analog pins; you can verify that with your Ohm meter. So if you need only 2x I2C devices, that may be easier than breadboard.

uno i2c.GIF

edit: changed pic for one with pins labelled