How to connect multiple I2C sensors/devices with Arduino
I want to connect two, three or more I2C sensors/devices to Arduino (as slave), How can I do it??
You need to do the following:
- Make sure that each sensor/device should have a unique I2C address to these sensors/devices. In the case of the addresses are duplicate, you need to change I2C address of the sensor/device to make it unique. To change I2C address of a sensor/device, you need to read its datasheet or manual. Manufacturers usually offer one of the follwing ways to change I2C address:
- Changing I2C address via command
- Changing I2C address via a jumper (soldering may required)
- For wiring, you can connect all I2C sensors/devices to the same Arduino I2C pins (SCL, SDA, VCC, GND).
- In the code, you just need to specify the unique I2C address for each sensor/device
To check I2C address of a sensor/device, see How to know I2C address of sensor/device
|1 × Arduino UNO Buy on Amazon|
|1 × USB 2.0 cable type A/B Buy on Amazon|
Please note: These are affiliate links. If you buy the components through these links, We may get a commission at no extra cost to you. We appreciate it.
The Best Arduino Starter Kit