Hi,
we are using an Arduino Nano 33 IoT and we have to use two sensors with the same I2C address that can't be modified, how can we do? At the moment we try to use this guide (Creating a new Wire | Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports | Adafruit Learning System) to obtained the second I2C port but we are not able to acquire the data or we acquire the same data for both sensor like we are reading two time the same sensors.
Welcome to the forum.
Do you have a I2C Scanner sketch to scan the bus ?
Can you make it scan the second I2C bus ? Please show the code that you have now.
Arduino activates only one I2C bus.
The SERCOM hardware can create a second I2C bus, but it is not easy.
You have to find a free SERCOM, some use sercom2
with PIO_SERCOM_ALT
for the second I2C bus.
Hi,
there are I2C bus switches to solve such problems. E.g. the PCA9546A. With this chip you can connect up to four separate bus lines with one I2C line at the controller. Only one line is active at a time. You cann connect your sensors to 2 different lines and with the PCA9546a you select the sensor you want to talk to,
Indeed - That's the approach discussed in the thread I linked earlier
Before trying to use both buses together, have you verified that you can use each one separately.
As always, the secret to solving difficult problems is to break them down until they become tractable ...
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.