I'm using a Rapberry Pi 4 Model B with 4 same I2C sensors. I want to get real-time data from them, but my knowledge of I2C is limited. I know that I can connect them, using different buses, but same address, and I was wondering if I could connect them using different addresses also. I know that this is possible with a multiplexer, but I don't know if there is any software approach.

  • 2
    please add a clear, answerable question to your post
    – jsotola
    Commented Feb 11, 2023 at 21:23
  • 1
    my knowledge of I2C is limited ... look for tutorials ... SparkFun has one
    – jsotola
    Commented Feb 11, 2023 at 21:24

1 Answer 1


Yes, you can easily do this in software if your hardware provides the ability to change its i2c address. This is typically accomplished through the use of pullup resistors on the hardware which can be connected (or disconnected) by switches, solder bridges, etc. After all, i2c is a bus - not a point-to-point connection :)

Check your hardware documentation, or you can share your device specs, and we can check if you're unsure on how to do this.


From the URL you provided in your comment, I found this:

The sensor has 32 modifiable I2C addresses, ...

Therefore : Yes, you can put all 4 of your sensors on the same i2c bus.

Correction : All GPIO have pullups, BUT all but a very few (maybe 2?) of these pullups are only enabled in software. If you will make reference to this commonly-used RPi Pinout reference, then click on GPIO2, you will find this explanatory note:

SDA includes a fixed, 1.8 kΩ pull-up to 3.3v, which means this pin is not suitable for use as a general purpose IO where no pull-up resistor is desired.

GPIO2 and GPIO3 are the default i2c bus on RPi4B, aka i2c1. You will need to enable this bus before using it. It may be enabled using either the raspi-config utility, or from adding a line to the file /boot/config.txt:


In closing: I've gone a bit beyond your original question now, and so any follow-on questions on this topic should probably be submitted as a new question. Hope this helped.

  • Thank you for the response. As I said before, I use a Raspberry Pi 4 Model B (2018) and the sensors I use are these. They have the exact same module (I have test it personally) and the difference is only in the probe. I know that Raspberry Pi has integrated pullup resistors for every GPIO (correct me if I'm wrong). I have enough of the rest electronics (resistors, cables, breadboard etc). I don't know how to check the Pi specifically for its hardware abilities. Commented Feb 12, 2023 at 13:53
  • 1
    @ExhaustedCProgrammer: Please see the edits.
    – Seamus
    Commented Feb 12, 2023 at 21:01
  • Thank you. I think that I understand what to do. One last question here: am I supposed to give these addresses to every device? Or are they given by default? Commented Feb 13, 2023 at 6:15
  • 1
    @ExhaustedCProgrammer: On any given i2c bus, each device must have a unique address. I can't tell you definitively what the default address(es) are - that should be covered in the device documentation. However, I'd guess that all the devices come from the mfr with the same address - so you'll need to change the address on all but one of them.
    – Seamus
    Commented Feb 13, 2023 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.