SSD1327 128x128 I2C oled display not working

I'm using the u8g2 library, and an arduino nano(with old bootloader).

I bought the display of ebay a few years ago, the original listing is no longer up, but the title was "1.5 Inch OLED Display Module 128x128 16 Gray Scale Spi/i2c Interface Ssd132 D7x7" and these look exactly the same: https://www.tinytronics.nl/shop/en/1.5-inch-oled-display-128*128-pixels-white-i2c
text and everything is identical, even the yellow pin spacer

These are the constructors I have tried, I found them both in the u8g2 docs and other forum posts with similar issues.

U8G2_SSD1327_MIDAS_128X128_1_HW_I2C u8g2 (U8G2_R0,/* reset = */U8X8_PIN_NONE);
U8G2_SSD1327_EA_W128128_1_HW_I2C u8g2 (U8G2_R0,/* reset = */U8X8_PIN_NONE);
U8G2_SSD1327_WS_128X128_1_HW_I2C u8g2 (U8G2_R0,/* reset = */U8X8_PIN_NONE);

For the code I've just used the page buffer example 'HelloWorld' and 'GraphicsTest' that come with the library.

wiring is just
GND to GND
VCC to 5V
SCL to A5
SDA to A4
like it should be

I have ran some I2C scanning code as well and the display is recognized, tho for some reason it's address is 0x3C instead of 0x78 or 0x7A like it should. I did disconnect it to make sure it was actually the display it picked up.

I have tried to set the address to 0x3C like this

  u8g2.setI2CAddress(0x3C);
  u8g2.begin(); 

as well as 0x78 and 0x7A, just in case, as well as not setting the address of course.

The exact same code did work for some different displays I had lying around.

I have 4 of these displays and have tried all 4 of them, none have worked.

Any ideas what might be wrong?

Without a data sheet, you have very little to go on. That the I2C address is so far off is a bad sign.

0x3C is 0x78 when you shift it one place to the left.
There are 7 bit I2C addresses and 8 bit addresses.

The difference being that with 8 bit addressing there are two addresses next to each other, one for read and the other for write. With 7 bit addressing the least significant bit is replaced buy 0 or 1 depending if it is a read or write operation.

It looks like your scanner is using 7 bit addressing and so is the Arduino. Then it looks like the place you were getting what the I2C address "should be" was assuming 8 bit addressing.

Is wrong, you should not have the first line in that code only the second. You use the I2C address only when talking to the device.
Posting you Full code is the way to get real help on this problem.

Hello world code, comes with the library, works perfectly well on another display I have.(tho with a different constructor of course)

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif


U8G2_SSD1327_MIDAS_128X128_1_HW_I2C u8g2 (U8G2_R0,/* reset = */U8X8_PIN_NONE);
//U8G2_SSD1327_EA_W128128_1_HW_I2C u8g2 (U8G2_R0,/* reset = */U8X8_PIN_NONE);
//U8G2_SSD1327_WS_128X128_1_HW_I2C u8g2 (U8G2_R0,/* reset = */U8X8_PIN_NONE);


void setup(void) {
  u8g2.begin();  
}

void loop(void) {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB10_tr);
    u8g2.drawStr(0,24,"Hello World!");
  } while ( u8g2.nextPage() );
  delay(1000);
}

I2C scanner, I found this online somewhere.

#include <Wire.h>

// Set I2C bus to use: Wire, Wire1, etc.
#define WIRE Wire

void setup() {
  WIRE.begin();

  Serial.begin(9600);
  while (!Serial)
     delay(10);
  Serial.println("\nI2C Scanner");
}


void loop() {
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    WIRE.beginTransmission(address);
    error = WIRE.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

Welcome to the forum.

I think that you do (almost) everything right.
Here is the explanation in the Wiki: https://github.com/olikraus/u8g2/wiki/u8g2reference#seti2caddress

Use it before the u8g2.begin(); :white_check_mark:
Try shifting the address to the left: u8g2.setI2CAddress(0x3C << 1); :warning:

I have never tried that function, but I have tested the function with the shifting in the Wokwi simulator and that seems to work. Wokwi project for test: menu test.ino - Wokwi Arduino and ESP32 Simulator

This is not your problem :astonished: The real problem is that the Arduino Nano has not enough memory. You should only use the 8x8 mode or else use an other Arduino board or "compatible" board (such as the ESP32 or the Raspberry Pi Pico).

This shows that the scanner is working with 7 bit addressing.

No.
That will give you 8 bit addressing and the Arduino uses 7 bit addressing.

It looks like this is the problem, because when I compile the code in post #4 for a Uno / Nano classic, I get:-

Global variables use 522 bytes (25%) of dynamic memory, leaving 1526 bytes for local variables. Maximum is 2048 bytes.

For a 128 by 128, 16 Gray scale display each pixel will need 4 bits to define it. So to run this display you need the free memory to be :-
4 *(128 * 128) / 8 bytes of memory which comes to 8192 bytes, which is way more than you have available.

Hello world code, comes with the library, works perfectly well on another display
[/quote]
Would that other display be smaller and monochrome by any chance?
A 128 by 64 monochrome display would only require a much smaller amount of free memory, that would need 1024 bytes, which would fit in what you have available on a Uno / Nano classic.

Yes. Read the explanation in the Wiki and I tried it in a simulation.

That would be the same as just setting the address to 0x78, which I have tried.

Wouldn't that be for a full buffer? In my case of a page buffer, isn't just one line of pixels held in memory at a time? So 4 * 128 / 8 bytes, which comes to 64. The nano should have plenty memory for that.
The other display was indeed a 128x64 monochromatic display.
I'll try a microcontroller with more memory when I get home later either way.

Then you have tried about everything.

I checked it once more in the Wokwi example, to be sure.
This works in the simulation with a normal OLED display:

  display.setI2CAddress(0x78);
  display.begin();

and any other value does not work.

The full buffer is too much for the Nano, and the reduced memory option uses more memory than the previous u8glib or the 8x8 mode. But I assume that at least something should show on the display.

All the displays could be rejected in the factory and could all be bad. It happens.
Have you used the I2C pins of the Nano before ? Maybe the Nano board has troubles. You could try software I2C on other pins.
There are other OLED libraries, but the u8g2 supports the most displays.

Only if you define your page as such. I can't see where that is.

One way to check the amount of free memory you have is to use the free memory function in the code after you think you have initialized the 64 bytes you think you have.

If you see the free memory go down by only 16 bytes, it means there is no allocation of the 4 bits per pixel requirement.

Are you really sure that the the U8g2lib.h library can handle a multi bit pixel display?

I found this SSD1327 on eBay:-

And it has no mention of it being a gray scale display.

I did find this gray scale display,
Gray scale display
but the description was in German so I put it through a translation but it was not very helpful:-

Overview: This is a general OLED display module, 1.5 inch diagonal, 128x128 pixels, 16 shades of gray, with embedded controller,
communication via SPI or I2C interface.
Specifications: 128x128 high resolution 16 shades of gray, better display effect
Supports SPI or I2C interface, configured via onboard resistor Comes with development resources and manual (examples for Raspberry Pi/Arduino/STM32)

Driver: SSD1327 Interface: SPI / I2C Display Color: White Viewing angle: >160° Operating voltage: 3.3V / 5V Dimensions: 44.5 x 37 (mm) Package List: 1x 1.5inch OLED module 1x PH2.0 7Pin

The U8g2 library allocates the buffer at compile-time, and as such the buffer is included in the dynamic memory shown by the compiler, so it does not appear to be a memory problem.
Trying the constructor for the full buffer, I get a memory usage of 2620 bytes, which would indicate a single bit per pixel with the SSD1327_MIDAS constructor. The SSD1327_WS constructor shows a full buffer memory usage of 9712, which would be in line with four bits per pixel.

From the LCD supplier page they give 2 options for the Construct , did you try both?

Do you prefer to use the (slower) software implementation of I2C because you maybe don't have I2C pins? Then use these initializations (SCL on pin 9, SDA on pin 8):
full_buffer:  U8G2_SSD1327_MIDAS_128X128_F_SW_I2C u8g2 (U8G2_R0,/* clock = */9,/* data = */8,/* reset = */U8X8_PIN_NONE);
page_buffer:  U8G2_SSD1327_MIDAS_128X128_1_SW_I2C u8g2 (U8G2_R0,/* clock = */9,/* data = */8,/* reset = */U8X8_PIN_NONE);

With the software implementation of I2C you can use any available GPIO pin as SDA or SCL pin. This can be useful if you want to be able to use multiple displays.

Note: The hardware I2C does not work with the Arduino Due. (Error in OLED library or Due I2C library)

I thought we had not yet ascertained who the supplier is. All the OP said was

Which is not to say that they are exactly the same. The main difference is that link not saying anything about having a Gray scale. Which is rather important hear don't you think?

This is a grayscale 1.5" display, along with some driver code.
Note that the code does not work on Arduinos with 8K of SRAM or less.

Please note that the U8G2 library is for monochrome displays only. It will not work with a grayscale display.
See this link about the library:-
Home · olikraus/u8g2 Wiki · GitHub

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