I’m wondering if there’s an easy way to specify which of Wire.h’s “Wires” an MS5837 pressure sensor uses in Arduino code.
I’m trying to connect four different MS5837s, each to their own respective I2C port on a Teensy 3.6 (which conveniently has four I2C ports). The libraries make it very easy to connect one of them, however, the MS5837 library always specifies the use of just “Wire” in its function calls. Meanwhile, the Wire.h library allows for the use of multiple ports by using Wire, Wire1, Wire2, etc. in the function calls.
Has anyone encountered this problem and can offer a quick solution?
Ok, perhaps i’m talking out of my depth here (pun) but doesn’t I2C act as a serial connection, with each device having it’s own address on the line? Why plug each device into a separate port?
I use a 32 channel ADC for analog input AND a 32-channel SSC32U servo controller on the same I2C port…
Unless I’m mistaken, the MS5837’s I2C addresses are fixed, meaning they can’t be communicated with individually on the same bus without an I2C multiplexer (which I don’t have on hand).
In case anyone’s interested, I just ended up modifying the MS5837 library itself (and also replaced the “Wire.h” library with the more Teensy 3 I2C friendly “i2c_t3.h” library).
The only thing I changed was to pass i2c_t3 objects as arguments for the init() and read() functions to replace “Wire” with the argument name (to be declared in the actual Arduino code).
Hi Zurn,
Could you somehow post or send your .cpp .h and arduino code? -I tried to implement what you wrote but I can’t make it compile for Teensy 3.2 (or any other)
I am using just one of the MS5837 for the Teensy 3.2
Thanks