I am experimenting with the accelerometer MPU9250 (I know it's not just an accelerometer ;)).
The problem is the distance, which has to be 2 meters in my case. Which cables would you recommend? I found the topic about "twisted pairs", so that each pair results from one signal cable and one ground cable. But how do I have to connect them in my case? I have just Vcc, Gnd, SDA and SCL connected from arduino to the sensor. Where should I connect the ground cables from the twisted pairs to?
If you have SCL & SDA Gnds in addition to the Ardiuino to Device Gnd, connect them to Gnd at the Arduino side, and not to the device Gnd. That will give you shielded wires, but no chance for a Gnd loop with 3 Gnd wires.
You mean I can leave the Vcc and Gnd wires as they are now, and just have to replace the SDA and SCL wires with twisted wires so that each twisted wire connects one data line (e.g. SDA) from arduino to sensor and the Gnd part of that twisted wire just goes into arduino Gnd? So the Gnd really has no connection to the sensor at all? (beside the direct connection from Arduino Gnd to Sensor Gnd)
Wawa:
Try Cat-5/6 Ethernet cable.
One pair for SDA/ground and another pair for SCL/supply.
I read the data at 1000Hz. With a Savitzky Golay filter I allready get really good results, but the signal itself is very noisy tough.
I found a Cat6 cable and attached a photo of it. There are 4 pairs of cables inside and each pair is isolated again with an aluminium layer. On the outside there are many thin wires, I guess I can ignore them?
Do I have to leave the aluminium layers from each pair as they are or do I have to remove them?
As I understood, I have to take two pairs out of the whole ethernet cable and connect one pair to SDA and GND on aruino and sensor, and connect he other pair to SCL and VCC at both sides. Is this correct?
Shielded Cat-x has a higher wire capacitance (possible shorter distance for I2C data).
You could try.
Just twist the thin wires together at one end, and ground them only at the Arduino end.
The thin wires and the aluminium is just shielding (no I2C function).
Harder to connect/solder aluminium, hence the wires connected/shorted to the aluminium.
Use two pairs, as I explained, for the I2C.
Standard I2C data rate is 100kHz.
Leo..
Basically I2C is not designed for 2m cable runs, nothing will be ideal except mounting the Arduino with the sensor.
I2C stands for Inter-IC-Communication, and is intended for use on a single PCB to connect peripheral ICs
to the processor. Its a logic bus. Logic signals don't travel well, being highly sensitive to noise energy since
a few nanoseconds of transient is able to register at the receiver. Typical logic chips can't drive the
characteristic impedance of a transmission line (unless they use LVDS or similar), meaning fast
edges degrade rapidly with distance travelled, again leading to issues at the receiving end.
Use very strong pullups if you have to use I2C over distance, 2k2 or below, and 100 ohm series
resistors at each end of the signal wire to reduce reflected energy and ringing.
If you have a fast 'scope you can see how clean you signals are which will help instill confidence.
MarkT:
Use very strong pullups if you have to use I2C over distance, 2k2 or below, and 100 ohm series
resistors at each end of the signal wire to reduce reflected energy and ringing.
I am a litte bit confused with the pullup resistors. Aren't there already pullups built into the Leonardo? I thought that I2C connection does not even work at all without pullups? Furthermore I thought, that pullups are connected just once on each line (VCC--pullup1--SDA and VCC--pullup2--SCL), but you said at each end, or am I missunderstanding something?
I have two 2k2 resistors but stuck on how to connect them exactly.. Especially because I have a logic level shifter between my arduino(5V) and the sensor(3.3V)
At the moment my setup is as follows. Where do I have to connect the pullups to?
A level shifter breakout board has pull up resistors, usually 10k, on both the 3.3volt and 5volt sides.
Did you try the 2m cable?
Think about adding extra pull up if you have problems.
Leo..
Wawa:
Did you try the 2m cable?
Think about adding extra pull up if you have problems.
Leo..
I ordered a second sensor and am waiting for it now to try with the ethernet cable.
One more question: is it important at which side I install the level shifter? Near the arduino or near the sensor? Or does this not make a difference at all? I thougt maybe it's good for the signal if it's at 5V as long as possible and get shifted to 3.3V right before the sensor. Or the other way around