Using A4/A5 as Analog Inputs While Using I2C on Arduino UNO R4 WiFi

I am using an Arduino UNO R4 WiFi with Qwiic devices (IMU and ADS1115) connected to the I2C bus. If I also connect the analog output (S pin) of two FSR sensors directly to A4 and A5, will this cause a conflict with the I2C communication?

Check with the following header pin digaram (Fig-1) of UNO R4 WiFi.

If you are using Qwiic connector for I2C devices, then you can use A4/A5 as analog channels without any conflict. Howevet, if you use I2C1 (A4, A5 or D18, D19), then you cannot use A4/A5 as analog channels.


Figure-1:

as GolamMostafa said you can use Qwiic connector but keep in mind it is only for 3.3v i2c devices. or
you can use A4 &A5 for i2c and use analog multiplexer for your analog input

I had the same concern before. From what I understand, the UNO R4 allows A4 and A5 as analog inputs without conflicting with I2C functionality.

The Qwiic connector uses the Wire1 interface, which I presume you already know, rather than the Wire interface which used pins A4 and A5

The two interfaces are separate so you can use A4 and A5 ad analogue pins if required

From Fig-1 of post #2, I understand that --
1. If using I2C devices with Qwiic connector, then Wire.begin() is correct.
2. If using using I2C devices wit A4/A5, then Wire1.begin() is correct.

Header pins A4/A5 are the MCU pin names. By defualt, they convey digital IO signals. The alternal functions are: ADC and I2C.

1. analogRead(A4) will connect A4-pin with Ch-4 of the internal ADC. Intrenal digital port and I2C module remain disconnected.

2. Wire1,begin() will connect A4/A5 with the internal I2C Module. Digital Port and ADC modules remain disconnected.

3. pinMode(A4, OUTPUT) will connect A4-pin with internal digital port. ADC module and I2C module remain disconnected.

From https://docs.arduino.cc/tutorials/uno-r4-wifi/qwiic/

The Arduino UNO R4 WiFi has two I2C buses, and the Qwiic connector is connected to the secondary one.

Practically, this means that if you intend to use the Qwiic connector, when you're writing the code for your sketches, you cannot use the primary Wire
object for I2C that you normally would, but you instead need to use the secondary one, Wire1

.

yes, you are right. but it should be Wire.begin() not Wire1.begin() for using i2c on A4/A5 pins.
Wire1.begin() is for using i2c through Qwiic connector
Official Qwiic documentation

#include <Wire.h>
#include <SparkFun_Qwiic_Humidity_AHT20.h>

AHT20 humiditySensor;

void setup() {
  Serial.begin(9600);
  Wire1.begin();  //Join I2C bus
  //Check if the AHT20 will acknowledge
  if (humiditySensor.begin(Wire1) == false) {
    Serial.println("AHT20 not detected. Please check wiring. Freezing.");
    while (1)
      ;
  }
  Serial.println("AHT20 acknowledged.");
}

void loop() { 


  float temperature = humiditySensor.getTemperature();
  Serial.print("Temperature: ");
  Serial.print(temperature, 2);
  Serial.println(" C");
}