# 2 depth sensors using arduino

**URL:** <https://discuss.bluerobotics.com/t/2-depth-sensors-using-arduino/14996>\
**Category:** Blue Robotics Software\
**Created:** [September 4, 2023, 1:32pm UTC](https://discuss.bluerobotics.com/t/2-depth-sensors-using-arduino/14996 "2023-09-04T13:32:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexandreLarribau](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@AlexandreLarribau](https://discuss.bluerobotics.com/u/AlexandreLarribau)\
**Post date:** [September 4, 2023, 1:32pm UTC](https://discuss.bluerobotics.com/t/2-depth-sensors-using-arduino/14996/1 "2023-09-04T13:32:59Z")

</div>

Hi !

I would like to use this library that I found on github [GitHub - bluerobotics/BlueRobotics\_MS5837\_Library: Arduino library for the MS5837 pressure sensor.](https://github.com/bluerobotics/BlueRobotics_MS5837_Library) to read the measures of 2 BR depth sensors (10m version). The problem is that I have 2 sensors and my arduino (pro mini) has only 1 pair of SDA/SCL (like most of them I think). Does anyone knows if this is possible and how it can be done ? Thanks !

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 6, 2023, 1:37am UTC](https://discuss.bluerobotics.com/t/2-depth-sensors-using-arduino/14996/2 "2023-09-06T01:37:38Z")

</div>

Hi @AlexandreLarribau,

> [@AlexandreLarribau](#):
>
> 2 BR depth sensors (10m version).

The MS5837 sensor chip used in our [Bar02](https://bluerobotics.com/store/sensors-cameras/sensors/bar02-sensor-r1-rp/) (and Bar30) depth sensors has a fixed I2C address, which means only one can be used on a given I2C port.

> [@AlexandreLarribau](#):
>
> Does anyone knows if this is possible and how it can be done ? Thanks !

The main workarounds I can think of are

1. Using a software-defined I2C library to allow connecting another device on a set of GPIO pins
  - this generally needs to operate more slowly than hardware-based I2C, but that may be fine
  - since our MS5837-arduino library expects a `TwoWire` port to connect to, it may be necessary to modify the library to be able to connect using the I2C interface provided by the different library

2. Adding a multiplexer chip on one of the I2C lines, in which case the sensor library thinks it’s only connected to a single sensor and you can switch which sensor is currently being communicated with using a GPIO pin
  - this is the simplest approach software-wise, but requires an extra piece of (cheap) hardware and some extra wiring
  - it should be fine to only multiplex one line, but you could also multiplex both and just wire the same GPIO pin to both of the switching inputs

---

<div class="post-metadata">

**Author:** ![AlexandreLarribau](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@AlexandreLarribau](https://discuss.bluerobotics.com/u/AlexandreLarribau)\
**Post date:** [September 6, 2023, 6:41am UTC](https://discuss.bluerobotics.com/t/2-depth-sensors-using-arduino/14996/4 "2023-09-06T06:41:22Z")

</div>

Ah too bad ! Thank you very much for this answer !  
I have an other old arduino around so I think I am just going to use it to transform the I2C value and get a 0-5V tension and read it on an analogic pin of my main arduino.
