2 depth sensors using arduino

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. 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 !

Hi @AlexandreLarribau,

The MS5837 sensor chip used in our Bar02 (and Bar30) depth sensors has a fixed I2C address, which means only one can be used on a given I2C port.

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
1 Like

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.

1 Like