Home        Store        Docs        Blog

Compatability with other I2C sensors

Hello, I am making a project that involves taking sensor data from two Blue Robotics sensors (TSYS01 and MS5837) along with data from three Atlas Scientific sensors (pH, Conductivity and Oxygen). Because of compatibility with another module, I had to switch the Atlas Scientific circuits to I2C mode, this caused an unexpected issue with the Blue Robotics sensors where the Atlas Scientific sensors wouldn’t output when the other sensors were connected. My setup consists of the Blue Robotics sensors going into a PX4 I2C splitter that then goes into an I2C converter that is connected to 5V, Ground, A4 and A5. For the Atlas scientific sensors I have them connected to a Whitebox tentacle shield and like I said, their circuits are in I2C for compatibility with another module. The problem occurs when I run the I2C asynchronous sample code from here with the Blue Robotics sensors connected. Even though the code never touches the Blue sensors, it only outputs “error: no data”. The code functions perfectly when they aren’t connected so I’m almost positive it’s a problem with comparability between the two. If you need anymore information just ask.

This sounds like a physical issue. When you connect the BR sensors to the circuit, you are changing the physical properties of the bus.

I2C is very sensitive to bus capacitance and consequently, the length of wire on the bus. If you add more wire to the bus, you increase the bus capacitance, and the rise and fall times of the signals become stretched out. If these signals are distorted to the point that they fall out of the timing specification, then you won’t have problems communicating.

  1. reduce the length of wire on the i2c bus as much as possible
  2. make sure that all of your connections are very secure, use solder if possible in place of breadboards. Some breadboards to not make great connections.

If you can provide a picture of your set up that will help, too.

I don’t think that my wires are too excessively long and the Blue Robotics sensors do output data just fine on their own. (I suspect this is an issue on Atlas Scientific’s end, I’m contacting them too but they aren’t very helpful) An issue on their GitHub says that the I2C library is incorrectly used all the time in their code like requesting 48 bits instead of 32 or ending the wire transmitting without starting it. You can read it here


Okay, It looks like Atlas Scientific doesn’t want to deal with this since it isn’t really a problem with their sensors. The best guess they gave me was that the Blue Robotics I2C signal is somehow deteriorating the signal from the Atlas sensors. If it helps at all I’ve tried a new Arduino board (from SparkFun this time) and the problem only occurs when the SDA and SCL wires are connected to A4 or A5, no other pins cause this issue. I also tried switching my level converter to 3.3v with no change in output, The sensors don’t even need to be connected to the level converter to cause the problem.

Hi @StockbridgeInvenTeam, sorry to leave you hanging, we were away for the holiday.

The sensors don’t even need to be connected to the level converter to cause the problem.

Do you mean that the atlas sensors do not work when you add only the level converter connected to the circuit, or that you have connected the Bar30 directly to the arduino?

I don’t think that my wires are too excessively long

I2C is meant to be used on short busses, usually not exeeding 10cm or so. Our 12" lead attached to the sensor is already pushing it. For further testing, I recommend that you try connecting just one of our sensors directly to the level converter (skip the i2c breakout board for now), try to use shorter jumper cables, and even remove the extra hats (for a better controlled environment). This will help shorten the bus length and reduce the number of connections/breaks in the conduction path, and help you get better signals. If you have access to an oscilloscope or logic analyzer, that will help immensely in diagnosing the problem.

Thank you for responding, The problem I’m having is that while the I2C level converter from Blue Robotics is connected to my Ardiuno, my other sensors from Atlas Scientific in I2C mode don’t output data even if I don’t have the actual sensors connected to my level converter, just the level converter causes the problem as far as I can see. Even without the breakout board I still get the issue and I do have access logic analyzer.

Hey @StockbridgeInvenTeam,

I have a few comments on this that might help. I agree with Jacob that the long wires and complexity of this overall circuit is likely causing the issues. There are a few things to try:

  1. Pull-up resistors. Our product don’t have internal pull-up resistors and I’m not sure about the Atlas Scientific products, but it’s possible that a stronger pull-up would help in this case. You could try adding 4.7k resistors connected from the SDA and SCL lines to the 5v power on the Arduino.

  2. You can try slowing down the I2C bus to reduce the effects of the long wires. You can do that on a standard Arduino Uno compatible device with the following lines of code, added after the Wire.begin() statement:

// Add these two lines to slow I2C clock to 12.5kHz from 100 kHz
// This is best for long wire lengths to minimize errors
TWBR = 158;  
TWSR |= bit (TWPS0);

I’d give those things a shot and see if it solves the problem. If not, there are some other options, like an I2C bus splitter that would actually provide independent buses for each sensor.

Hope that helps!


1 Like


Try to swap or remove the jumpers when possible, they usually are a frequently source of noise and connection issues.