OLED Display 128*64 I2C not working despite all measures taken

In which case, please copy-paste your edited lines.

You can also install U8g2lib. Select the appropriate constructor. Run the examples.

U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);


Edit. Your Adafruit edits are correct. It is worth trying U8g2.

I suspect that your display has a SSD1315 controller which is slightly different to SSD1306. People have reported problems with Adafruit but my genuine SSD1315 works ok with Adafruit.

1 Like

Thanks for the tip! I tried the U8g2 library and i was able to get outputs! however, the output wasn't consistent and the screen kept blacking out within 2 seconds if the output was extensive. I then tried using u8x8 library to print simple 8x8 texts and now the screen was displaying text properly. But then again, trying to display a lot of content on the screen results in the display blacking out. i believe this is related to some sort of power issue. Any advice regarding this?

using u8x8 library and only 4 lines of text.

This is when i try adding more than 4 lines of text to the code. the display blacks out within seconds after displaying everything

What code? You have to show us the code, we don't look at your computer screen.

It is just a modified example code found in the u8x8 library. And every other default u8g2 example code resulted in the same issue

HelloWorldu8x8.ino (23.9 KB)
this code works just fine as it only has 2 lines of text to display. but when i add more lines of text, the display shuts down within a few seconds

If you are compiling a library example:

It is only necessary to quote library by name and example by name.
Just copy-paste your edited constructor statement.

If you are compiling a custom sketch, copy-paste (or link) to the complete sketch.

I suspect that your screen is faulty. Library examples should work 100%.


p.s. the reason why I prefer to see "example name" is so that I can build exactly the same library example.
If you attach/paste the whole example, I have to check every single line to see if you have changed it.
Strangely enough, I don't want to spend that much effort.

okay so i used the u8g2 library and in that, i used the u8x8 sub-library(if you could call it that)
In that, I used the HelloWorld example first. Later I just added extra lines to the loop method to display more lines of text

the constructor i used:

U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 12, /* data=*/ 11, /* reset=*/ U8X8_PIN_NONE);

I just tried C:\Users\ .. \Documents\Arduino\libraries\U8g2\examples\u8x8\HelloWorld

and this constructor on a Uno.

U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ A5, /* data=*/ A4, /* reset=*/ U8X8_PIN_NONE); 	      // Digispark ATTiny85

Obviously HelloWorld is fairly trivial. So I then tried
C:\Users\ ... \Documents\Arduino\libraries\U8g2\examples\u8x8\GraphicsTest

If your display goes wrong it means that you should complain to the shop because it is faulty.


Yes that was my issue! With more intense graphics, the screen started dimming out and after a while it just totally blacked out. So i guess there's nothing else to do? :confused: