Electronic – i2c over 1m shielded multi-core cable with 0.5A load at the same cable is possible

i2cledled-driver

I'm using an I2c sensor (Time of flight, VL6180X breakout board with voltage regulator onboard) at the end of a 1M cable. An arduino controls it.

As I2c was not meant to be far away from the PCB and the MCU, I used a 6 core shielded wire to connect the sensor to the Arduino Leonardo. I grounded one side of the cable mesh to the sensor. I'm using an USB 8 pin plug to connect the cable to the arduino control box.

I also added two 10k Pull-ups from the SDA and SCL lines to 5V, close to the MCU.

But, in the same cable I use the two other cores for powering a 2W led, at 500-600mA max. (4 cores for the sensor – 5V, GND, SCL and SDA and 2 for the led driver).

The sensor works normally when the led is off, 100% of the times. But when I turn the led on, mostly when the pwm duty is close to med-max, it makes the sensor fail almost everytime.

Am I adding capacitance to the whole cable when the led is on? Why does it happen? I measured the 5V VIN to the sensor with a multimeter and it doesn't change with the led on or off.

Is there a workaround for it? Having I2c working normally in a cable where 0.5A load is applied? Is there another type of cable that would make it work?

I could make the cables separate, but it wouldn't be the best option for me, for I would need more connectors, and a bulkier setup.

Edit: For testing purposes, I separated the cables. One for the led and another one for the sensor, on the same connector. It works much better, but it's not a solution I'd like to use for good….

Thanks for reading!

Best Answer

The best solution to a problem like this would be to put a small MCU at the sensor, and then send back something like a UART data stream via a differential transmitter. Something like an ATtiny would work well.

Additionally, it would be good to do the PWM switching at the location of the LEDs, and to bypass the supply for that with plenty of capacitance there, to try to keep the current through the supply lines mostly DC - eg, the long wires would carry the average current while the current pulses would stay local. You could also consider using a higher voltage supply, and using a regulator at the point of load and/or putting your LEDs in series to reduce the overall current.

In terms of what you can do right now, in addition to the suggestions in comments, you could try much smaller pull-up resistor. 10K is marginally too large for even an on-board situation. Hopefully you are benefitting from pullups already on the Arduino. If you look with a scope, too weak a pull-up would mean an RC character to the signal rise, while too strong a pull-up would mean that the signal never really gets to ground.

Its unclear if your application would permit it, but if you could disable the LEDs while taking a reading that would likely solve your problem.