Real-time clock modules are usually easy to connect because most of them use the I2C bus. However, many RTC chips use fixed I2C addresses. This can create address conflicts when multiple RTCs or similar devices are connected to the same bus.
This article explains why these conflicts happen and how to solve them in practical embedded systems.
Why I2C Address Conflicts Happen
Each I2C device on a bus must have a unique address. When two devices use the same address, the microcontroller cannot communicate with them independently.
- Both devices respond at the same time
- Data becomes corrupted or unpredictable
- The bus may appear locked or unreliable
This is a common issue when using modules with fixed addresses.
RTC Chips with Fixed Addresses
Many popular RTC chips have fixed I2C addresses that cannot be changed by jumpers or software.
| RTC Chip | Typical I2C Address | Address Changeable? |
|---|---|---|
| DS1307 | 0x68 | No |
| DS3231 | 0x68 | No |
| PCF8523 | 0x68 | No |
| PCF8563 | 0x51 | No |
The DS1307 and DS3231 both use address 0x68, which means they cannot normally be used together on the same I2C bus.
Can You Use Two DS3231 Modules on One Bus?
Not directly. Since both modules use the same fixed address, the microcontroller cannot tell them apart.
- Both respond to address 0x68
- Both may drive SDA at the same time
- Read data may be invalid
To use multiple identical RTC modules, the bus must be separated or switched.
Solution 1: Use an I2C Multiplexer
The cleanest solution is to use an I2C multiplexer such as the TCA9548A or TCA9546A.
- Creates multiple separate I2C channels
- Allows devices with the same address on different channels
- Microcontroller selects one channel at a time
This is the recommended method when multiple identical I2C devices must be used.
How an I2C Multiplexer Works
The microcontroller communicates with the multiplexer first, then enables one downstream channel.
- Select I2C channel
- Communicate with RTC at address 0x68
- Switch to another channel if needed
- Communicate with another RTC at the same address
Because only one channel is active at a time, address conflicts are avoided.
Solution 2: Use Separate I2C Buses
Some microcontrollers support multiple I2C hardware buses or flexible software I2C pins.
- One RTC on bus 1
- Another RTC on bus 2
- Same address allowed because buses are separate
This approach can work well on ESP32, RP2040 and other flexible microcontrollers.
Solution 3: Use Different RTC Chips
Another option is to select RTC chips with different I2C addresses.
- DS3231 at 0x68
- PCF8563 at 0x51
This avoids address conflicts without additional hardware, but requires different software handling.
Solution 4: Power Switching
In some special cases, only one RTC module can be powered at a time.
- Power one device
- Communicate with it
- Power it down
- Power the next device
This is usually not ideal for RTCs because they are meant to keep time continuously. It is generally better to use a multiplexer.
Address Conflicts with EEPROMs on RTC Modules
Some RTC modules include an additional EEPROM chip, often a 24C32 or similar device.
- RTC address: usually 0x68
- EEPROM address: often 0x50 to 0x57
This can create conflicts with other EEPROMs or I2C memory devices on the same bus.
Using an I2C Scanner
An I2C scanner sketch is one of the easiest ways to detect connected devices and identify possible address conflicts.
- Shows detected addresses
- Confirms whether the RTC responds
- Helps identify unexpected EEPROMs or other devices
If two devices share the same address, a scanner may still show only one address, so manual inspection of the connected modules is still important.
Pull-Up Resistor Considerations
Address conflicts are not the only issue when connecting many I2C modules. Pull-up resistors can also cause problems.
- Many modules include their own pull-ups
- Too many pull-ups reduce the effective resistance
- This can overload devices or distort signals
When using many modules, only one properly sized set of pull-up resistors should be active on the bus.
Common Symptoms of Address Conflicts
- RTC not detected reliably
- Incorrect time readings
- Random I2C errors
- Bus hangs during communication
- Only one of several devices appears to work
Best Practices
- Check all I2C addresses before finalizing a design
- Use an I2C scanner during development
- Use a multiplexer when identical addresses are unavoidable
- Watch for extra EEPROM chips on RTC modules
- Manage pull-up resistors carefully
Conclusion
I2C address conflicts are common when working with RTC modules because many popular RTC chips use fixed addresses. The DS1307 and DS3231 both use address 0x68, so they cannot normally share the same bus.
For most designs, the best solution is to use one RTC per bus or add an I2C multiplexer when multiple identical devices are required. Careful address planning avoids confusing bugs and makes the entire system more reliable.
