I was wondering if someone could give me some advice. I bought a couple of minIMU-9 v3 and intended to use these together with a Raspberry Pi & I2C. I used a breakout board with a ribbon cable to prototype my solution and all seemed great. I now want to connect the sensor via a UTP cable (approx 3 meters) to the Raspberry PI and I am having issues.
The “i2cdetect” utility on the PI will detect the LSM303D but it cannot detect the L3GD20H (Gyro). Obviously it has an issue with the length of cable. I know the minIMU-9 has internal pull up resistors but I played around with those to see if that would fix the problem but no luck. I am providing the 3V3 via that same cable off of the Pi, would a local power supply (for example two AAA) make a difference?
Any help or suggestions are welcome!! thanks.
I am sorry you are having trouble communicating with the gyro on your MinIMU-9. There will be some noticeable voltage drop across a 3m cable, which could be lowering your 3.3V supply to a voltage that is tolerable for the accelerometer and magnetometer, but not the gyro. Can you try adding a local power supply like you suggested and see if that helps? Powering from those two AAA batteries might work, but ideally you should see if you can use a regulated power supply.
If that does not work, you might try using something like this I²C Long-Distance Differential Extender.
Thanks Jon, apologies not getting back quicker, but other duties called.
I have some result while trying to play around with an attempt to do local feed as you suggested, although a surprising one. I was working methodically up through the connections to test the results.
I am using a break-out board, but using that same cable (UTP) to connect with the minIMU-9:
Step 0 - connect with 4 wires: SCL, SDA, GND, VDD (= +3.3V from the Raspberry Pi); RESULT: Giro not found by i2cdetect = only 1D found, not 6B [this is the issue I described]
Step 1 - connect 2 wires; SDA, SCL = i2cdetect nothing found (makes sense)
Step 2 - connect 3 wires; SDA, SCL, GND = i2cdetect detects BOTH, 1D and 6B; this result surprises me totally!
Step 3 - connect 4 wires; SDA, SCL, GND, VDD (= 3V via two AA’s local to minIMU); no change to Step 3
In none of the above cases will the utility minimu9-ahrs detect the giro for some reason…
I tested an IMU with a Raspberry Pi here using some wires about 0.7 m long; it worked as expected with all 4 wires (with power coming from the RPi), but not without VDD connected, so your results seem strange to me. In Step 3, what do you mean by “no change to Step 3”? Was it supposed to be the same as Step 2?
Given that your original prototype setup seemed to work, but your current one doesn’t, I think a good way to determine whether it’s a power or signal issue would be to test the two separately. Could you try various combinations like:
- connecting VDD with a shorter wire but keeping SCL, SDA, and GND on the 3 m UTP cable
- connecting SCL and SDA with shorter wires but keeping VDD and GND on UTP
- connecting SCL, SDA, and GND with shorter wires but keeping VDD on UTP
You could also try lowering the clock speed of the I2C bus to see if it makes any difference.
Note that one of the limiting factors on the maximum length of an I2C bus is the bus capacitance, and you might be approaching or exceeding the limit with a 3 m cable. If you really need to separate the IMU and Raspberry Pi by that much, the differential extenders Jon linked to might help: they convert I2C into a set of differential signals and back, which lets you avoid problems with excessive capacitance and interference.
Many thanks for your suggestions, will further debug. Yes, I was already thinking about that solution of using an extender, but curiosity kind of wants me to figure this out in more detail .
Thanks again for you help, I will update this thread if I have any news for further reference to others.