OLED SSD1306 rightmost pixels problem - SOLVED

My sketch includes an OLED as follows (U8g2lib):

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

This works OK except that the two rightmost columns of pixels always end up filled with a seemingly random, but almost 100% white, pattern, no matter what I try to write into them. Would anyone know what is the matter?

Please post a link to the actual display.
1.3 inch OLED are generally SH1106 and not SSD1306.


Thank you very much. I just rewrote the line as

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

and that fixed it.

There was no marking on the display as to type (SH1106/SSD1306). I just tried different u8g2 definitions until I got something displayed, and stopped before finding the 100% correct one.

Please post a link to the actual Display that you bought. e.g. Ebay sale page.

Otherwise we can only guess.

0.96 inch are generally SSD1306
1.3 inch are generally SH1106
Some 1.3 inch are SSD1315
1.54 inch are generally SSD1309
2.42 inch are generally SSD1309

Size is not everything !!
We can post a sketch that will behave differently for SH1106, SSD1306, SSD1315, SSD1309

Post a link or photo of the pcb and we can recognise the likely controller.


The colour dithering settings are best chosen by trial and error depending on the image being converted although turning off dithering entirely is often best for images of solid colour blocks!

Perhaps I did not make it clear - the display works perfectly well now that I changed the definition to SH1106.

(I don't have a link for the display, sorry. I have bought a number of these over the last few years, at various places. They all look the same, except sometimes the contacts are labelled GND VCC SCL SDA, and sometimes VCC GND SCL SDA.)

I understand that you have forgotten the sale details.

However it is the pcb side that is "of interest".
You have the pcb on your desk. You can compare your pcb with similar items on Ebay, AliExpress, ...

Then post a link to the identical item (if you can find it)
with a note to say that the pcb "looks the same" as yours.

I did give a good guide to identification by screen size.

I will bet you a virtual beer that your screen is 1.3 inch.


Here is a photo of the PCB. But... As far as I'm concerned, the problem here was already solved (by yourself.)

Thanks for the photo.
This display https://www.ebay.co.uk/itm/133454355899
image#4 in the link looks like your photo.

Other similar 1.3 inch displays omit the 1.3' OLED IIC printed on your pcb. They appear to have the same components and copper traces.