Bug 1,3" Oled display

Hello all,

i have a 4 Pin Amoled screen connected to arduino and everything is working well in prototyping, but when i do use an longer câble to communicate SDA and SCL (about 1.5 meters) it do not work anymore.
Even if i "bypass" the long câble with a short one, it do not work. I have to remove the long and only use the short to make it work .

Thanjs for help :slight_smile:

I2C is sensitive to capacitance which will affect the rise time of the signals; longer cables form a higher capacitance. Putting a short one in parallel makes it even worse. You can try to add external pullup resistors on the SDA and SCL lines; I'm not sure of the values. There are also extenders that buffer the signal.

I2C stands for Inter IC and is meant for connection between components on a PCB, not for long distance !! And anything above approx. 25cm is long distance :smiley:

@sterretje is just barely touching the problems :wink:
See my notes for the I2C bus.

The OLED displays are trouble-makers on the I2C bus. Is there an other solution ?

Which Arduino board do you use ?
Is your GND from the Arduino board to the display connected to something else ?

The OP claims that the cable length is 1500mm.
Although unwise, I would expect it to work in a benign environment like your desk.

I suggest that you use stronger pullups and screen the cable. The screen will increase the capacitance but it should reduce noise pickup.


Thanks a lot all, i'm already happy to understand why it's not working :slight_smile:

So i reduced the cable's lenght and put stronger pullup (6.8k instead of 10k), and it's working now, still some bug sometimes but much much better.

Is it possible to code a function that will not crash the arduino code in case of I2C Bug ?

6k8 is extremely wimpy. I would choose 2k2 for 5V or perhaps 1k2 for a 3.3V system.

The OLED is probably running on a 400kHz bus.
Whereas a Slave I2C chip on the main pcb is only going to add 10-20pF any long cable might add 100pF or more. RC = 6k8 x 100pF = 680ns. A 400kHz bus is 1250ns per half-cycle.


I think maybe you are trying to solve the wrong problem. You can add as many capacitors as you wish, but the installation will remain prone to noise.
May I propose an alternative solution? How about putting a secondary Arduino right next to the OLED and drive it with very short I2C connections?
Then send the data from the primary arduino to the secondary arduino and offload the display handing to the secondary arduino. You can use software serial or other inter-arduino communications. rs485 perhaps for longer distances in a noisy environment?. Or a wireless link.
I appreciate it will need a big change of code and may not work if you need fast updates to the OLED (not that OLEDs tend to be very fast anyway).
But it would probably solve the I2C noise issue.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.