Analog A4 and A5 interference issues with I2C libraries - I think?

First time post, be gentle.

Using Arduino Uno with XD-204 XD-05 Data Logger Shield I purchased from

In my code I have included…

<SPI.h> (SPI comms) and <SD.h> (SD card)… both needed to make SD card operational
<Wire.h> (I2C comms) and … both needed to make RTC functional

For testing I have a simple 10K pot between 0/5VDC and the wiper taken to analog input.

I run a simple loop reading the analog input A0 to A5 depending what input I have my pots wiper connected to. Then convert and print/save date, time, ADCvalue and converted Voltage.

Everything works if I use A0 to A3 (ADCreading 0-1023, converted to volts 0.0-5.0 or thereabouts).

Here’s the big question…

Can I use A4 and/or A5 for analog inputs AT THE SAME TIME as using the I2C/RTC libraries mentioned above?

If I try to use A4 or A5 then the program ‘hangs’ (just stops stalls/stops) if the ADCreading is less than ~550 or more than ~1015 (pot turned up or down). As I return the pot to the middle ground the program keeps running.

Only after puzzling on this for a long while did I realize A4/A5 have that dual purpose for I2C SDA/SCL… I am guessing this is a problem if I try to read analog values at same time using those pins?

I need 6 analog inputs in my experiment. My courses of action seem to be…

  1. Different model (Nano perhaps)
  2. Find alternate to I2C based RTC… Any recommendations?
  3. Find an analog input expansion module that I can use via I2C or SPI… Any recommendations

Thank you for any advice.

A4/A5 are the I2C pins. Of course you can't use them for analog in if you're using them for I2C, if only because any I2C devices connected would mess with your analog signal. Connecting a pot to those pins turned all the way to the +5V side can actually cause damage to the pins.

Use A6/A7 as analog inputs instead (broken out on the Nano and Pro Mini boards).

Why do you need 6 analog inputs ? If that can be reduced to 4, then you can still use the Uno and the Data Logger shield.

Can I use A4 and/or A5 for analog inputs AT THE SAME TIME as using the I2C/RTC libraries mentioned above?

No. For the reasons mentioned in reply #1.

From #1
A4/A5 are the I2C pins.

To be a little clearer .... The pins labeled SCL and SDA are connected directly to the A5 and A4 pins.


Not only can you not use them for both purposes at the same time, you cannot use them at different times unless you disconnect one set of circuitry first with some sort of switching circuit. You also risk damaging
components, not just getting bad results if trying to use pins for different things simultaneously.