Two I2C devices with the same Address

I am using an Arduino Mega

Is it possible to use two of the same sensors on it, one on PINS (20,21) the other on PINS(SDA1, SCL1)

Thx for the help

yes, PROVIDED you multiplex them.

you can use a simple multiplex IC or there are other hardware out there to do that (e.g https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/overview)

sherzaad: yes, PROVIDED you multiplex them.

you can use a simple multiplex IC or there are other hardware out there to do that (e.g https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/overview)

Thank you very much for your help:)

But which sensor(s) are we talking about. There are not that many which have no option to change the address.

septillion: But which sensor(s) are we talking about. There are not that many which have no option to change the address.

https://wiki.dfrobot.com/SHT20_I2C_Temperature_&_Humidity_Sensor__Waterproof_Probe__SKU__SEN0227

This one

Yep, you found a rare one that's indeed not changeable :D

sherzaad:
yes, PROVIDED you multiplex them.

you can use a simple multiplex IC or there are other hardware out there to do that (e.g Overview | Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout | Adafruit Learning System)

My understanding of the initial post was Miketech was asking if he could use both of them, with each on on a separate i2c bus.
What you have described is using both of them on the same bus.

Either way can allow using two devices with the same i2c address.

Multiplexing requires additional h/w while using a separate i2c bus can all be done in s/w with no additional h/w other than the requirement for using 2 additional Arduino pins.
i.e. use the Wire library for one bus and something like the SoftwareWire library for the other.

That said, it may be necessary to use the h/w multiplexing depending on the s/w used to talk to the sensor.
Depending on how it was written it may not be able to support an i2c bus that is not using the Wire object which would limit its use to a single i2c bus.

If the sketch will not be using a library to talk to the sensor, then it could be written to use separate i2c objects which would allow using one sensor with the Wire library and another sensor with a software i2c library.

— bill