# Two identical I2C sensors give wrong data: address conflict

> Fix two I2C devices with the same address: change the address pin, use a multiplexer such as the TCA9548A, or use a second bus.

Canonical: https://roboticsengineering.in/fix/two-same-i2c-sensors-address-conflict/ | Published: 2026-11-03 | Updated: 2026-11-04

**Two devices with the same I2C address cannot share one bus.** Change one address, add a multiplexer or use a second bus.

## What the message means

Every device answers to its address. When two answer at once the replies collide and the data are wrong or missing.

## Fix it in this order

1. Run an I2C scanner with one device at a time and note each address.
2. Look for an address pin on the module (such as AD0 on the MPU6050) and set it differently on the second one.
3. Otherwise add an I2C multiplexer, such as the TCA9548A, and select the channel before each read.
4. The ESP32 has two I2C buses, so you can put one device on each.
5. Keep pull-up resistors in place and the wires short.

## Why it happens

Two sensors of the same type share one fixed I2C address, so only one can be addressed. Some breakouts have an address pin or solder jumper to change it.

If yours does not, use a multiplexer such as the TCA9548A to put each sensor on its own channel, or put one sensor on a second I2C bus, which the ESP32 provides.

## If you see this, do this

| You see | Do this |
| --- | --- |
| Scanner shows one address for two devices | Same address. |
| Works alone, fails together | Address conflict. |

## Related

[I2C device not found](https://roboticsengineering.in/fix/i2c-device-not-found-arduino-esp32/), [pull-up values](https://roboticsengineering.in/fix/esp32-i2c-pull-up-resistor-values/), [MPU6050 address](https://roboticsengineering.in/fix/mpu6050-returns-zeros-or-wont-wake/).

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.

## Why this happens

On an I2C bus, the controller sends a 7-bit address and the device that owns it answers. The lines are open-drain: a device can only pull them low. If two devices answer to the same address, both pull the data line at once and the controller reads a mix. The data are wrong, or the transfer fails.

The address is fixed by the chip’s design, with at most a pin or two to choose between a few values. Common examples are the MPU6050 (0x68 or 0x69 using AD0), the BME280 (0x76 or 0x77 using SDO) and the BH1750 (0x23 or 0x5C using ADDR). Check the datasheet for your part.

## How to confirm the cause

- Connect only the first sensor and run an I2C scanner. Note the address. Then do the same with the second sensor alone.
- Connect both. If the scanner shows one address instead of two, they share an address.
- Look for an address pin or a solder jumper on each breakout, and read what the datasheet says each setting does.
- Check whether another device on the bus, such as a display, uses the same address.
- Do not mix up 7-bit and 8-bit forms. 0x68 as 7-bit appears as 0xD0 when the read/write bit is included.

## Worked example

A simple scanner, and what you should see once AD0 on the second MPU6050 is tied high.

```
#include <Wire.h>
void setup() { Serial.begin(115200); Wire.begin(); }
void loop() {
  for (byte a = 1; a < 127; a++) {
    Wire.beginTransmission(a);
    if (Wire.endTransmission() == 0) { Serial.print("0x"); Serial.println(a, HEX); }
  }
  Serial.println("--");
  delay(2000);
}
// expected with both sensors: 0x68 and 0x69
```

## Common mistakes

- Leaving the address pin floating instead of tied to GND or VCC.
- Changing the address in hardware but not in the library call.
- Forgetting that a multiplexer needs its channel selected before every read.
- Using a multiplexer address that clashes with another device. The TCA9548A uses 0x70 to 0x77.
- Concluding from a scan done with only one sensor connected.

## If this did not fix it

- Pull-up resistors and wire length. A long bus with weak pull-ups gives errors even with unique addresses.
- Mixed voltage levels between 3.3 V and 5 V devices.
- A sensor that is simply faulty. Test each one alone on a short bus.
