u8g2 SSD1306 Horizontal offset [solved]

Hello,

I use a noname 1,3" SSD1306 I2C OLED display with u8g2 library on an ESP8266 NodeMCU board.

It works, except for a "horizontal offset" issue : columns with address 0 and 1 are not displayed.

code example :

u8g2.clearBuffer();
u8g2.drawFrame(0,0,128,19);
u8g2.drawFrame(1,22,127,19);
u8g2.drawFrame(2,44,126,19);
u8g2.sendBuffer();

result:

The left border of the first two frames is missing. It seems the buffer to display is shifted by two columns to the left.

Consequently, the two rightmost columns of the display are not reachable.

Unfortunately there are some pixels randomly turned on at poweron on the right and I found no way to clean them.
In my application, I can live with x axis starting at 2, but the pixels at the right are quite annoying.

I use the following u8g2 constructor :
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE, D7, D6);

I have tried to fix the offset by using straight SSD1306 commands with u8g2.sendF() with no success.

It seems the u8g2 buffer is wrongly mapped to the display internal RAM.

Is this a defective display ? Any suggestion ?
Thanks.

I use a noname 1,3" SSD1306 I2C OLED display with u8g2 library on an ESP8266 NodeMCU board.

Most 1.3 inch displays have SH1106 controller.

Use the appropriate SH1106 constructor and everything should work.

But first off, it is always wise to run all of the library examples.

David.

Thanks :slight_smile: That fixed the issue.

It was sold as an SSD1306 OLED, confirmed by many pictures on the web. And most of the code works with the wrong library. Seems they only "look" the same as mine !! This is really misleading.

It is always wise to post a link to the item that you bought. e.g. Ebay sale page.

Yes, electronic items are often sold by lingerie shops. They probably have little technical knowledge. But if your item matches the photos in the link, readers can identify what you have bought.

I would hope that these shops can sell the correct size of knickers.

David.

You're very right about some ebay vendors :smiley: :smiley:

This discussion made me look again at the item description of the one I bought : it does not mention any controller. My mistake.

On other projects, I use 0.96" oled SPI/I2C with 7 pins. These are SSD1306.

I now realize that there are 0.96" 4 pins, I2C only, SSD1306 that look almost identical on picture to my 1.3". That's where my mistake came from.

Here is a link for my 1.3" display, from another (better) vendor with better description:

I am quite surprised that the manufacturers don't mention the controller they use on the board itself.

BTW, SH1106 supports 132x64.
Do you know of a graphics library supporting the full resolution ?

Your link in #4 is "better".

SH1106 is actually 132x64 and not 128x64. However very few libraries use the full 132x64.

Yes, manufacturers could print SH1106 on the pcb. Or even print 132x64

These are "consumer products" being sold by lingerie shops, toy shops, ...
They just have to add the word "Arduino" to an advert. If they provide too much information it might frighten the customer. And they are writing stuff in a language that is foreign to them.

They make life easier for hobbyists. e.g. display mounted on a pcb with header pins ans associated electronics.
An OEM would buy the bare OLED panel to mount on the OEM's custom pcb with other surface mounted components.

David.

very true.

Actually, i found that my mistake is not new. Another example here

And olikraus has put it in the FAQ here. oops :roll_eyes:

Q: There is an x-offset on my SSD1306 128x64 OLED.
A: This is not a SSD1306 OLED, instead use the SH1106 constructor.

SH1106 can control a 132x64 panel.

However your panel is 128x64. So there is no point in trying to address non-visible pixels.

It is not unusual for a controller to be bigger than the panel.
e.g. 240x400 TFT panels often have a 240x432 ILI9327 controller
e.g. 128x160 TFT panel often has a 132x162 ST7735 controller

David.