ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
1.99k stars 637 forks source link

Function to set I2C-clock? #272

Closed Elmi77 closed 4 years ago

Elmi77 commented 4 years ago

Hi, is there a function to specify the I2C clock to be used? Explanation: I have a somewhat long cable from ESP32 to the display which causes troubles with a too high I2C frequency, so it would be good to run it at slower speeds. Thanks!

codebeat-nl commented 4 years ago

It is not the frequency, it is the capacitance because the cable is too long and probably not shielded and because it is not shielded it acts like an antenna and receives outside noise. Also possible is that the resistance of the cable reduces the HIGH state of the signal, a voltage drop because of the length and quality of the cable, it is not high enough to determine the high and low state, it starts to malfunction. To change the clockspeed, take a look at I2C object itself. If you are using arduino, take look here: https://www.arduino.cc/en/Reference/WireSetClock

Remember that this effects ALL of the connected I2C pheripherials.

Elmi77 commented 4 years ago

The cable is shielded. And yes, it is the capacity AND the inductivity of the cable - which have an as stronger effect as higher the frequency is, thus transmitting data with a lower frequency helps.

Thanks for the hint with the setClock()-function, that solved my issue!