Micro OLED displaying garbled pixels when trying to get example to run

I’m using a ESP32 Thing Plus-S3 and a Qwiic connector to get the Micro OLED breakout working. However, when I tried running the example sketch, the following displays.

I thought at first it was the random pixel function but after realizing nothing else was happening I commented it out and nothing changed. Then I stripped down the example code to just one example and it still shows the same; here’s the code for that.


#include <Wire.h>
#include <SFE_MicroOLED.h> 
#define PIN_RESET 4


MicroOLED oled(PIN_RESET); 

void setup()
{
  delay(100);
  Wire.begin(8, 9); 

  oled.begin(0x3D, Wire);    
  oled.clear(ALL); 
  oled.display();  

  delay(1000); 

  oled.clear(PAGE); 

}


void lineExample()
{
  int middleX = oled.getLCDWidth() / 2;
  int middleY = oled.getLCDHeight() / 2;
  int xEnd, yEnd;
  int lineWidth = min(middleX, middleY);

  printTitle("Lines!", 1);

  for (int i = 0; i < 3; i++)
  {
    for (int deg = 0; deg < 360; deg += 15)
    {
      xEnd = lineWidth * cos(deg * PI / 180.0);
      yEnd = lineWidth * sin(deg * PI / 180.0);

      oled.line(middleX, middleY, middleX + xEnd, middleY + yEnd);
      oled.display();
      delay(10);
    }
    for (int deg = 0; deg < 360; deg += 15)
    {
      xEnd = lineWidth * cos(deg * PI / 180.0);
      yEnd = lineWidth * sin(deg * PI / 180.0);

      oled.line(middleX, middleY, middleX + xEnd, middleY + yEnd, BLACK, NORM);
      oled.display();
      delay(10);
    }
  }
}


void loop()
{
  lineExample();  // Then the line example function


}


void printTitle(String title, int font)
{
  int middleX = oled.getLCDWidth() / 2;
  int middleY = oled.getLCDHeight() / 2;

  oled.clear(PAGE);
  oled.setFontType(font);
  // Try to set the cursor in the middle of the screen
  oled.setCursor(middleX - (oled.getFontWidth() * (title.length() / 2)),
                 middleY - (oled.getFontHeight() / 2));
  // Print the title:
  oled.print(title);
  oled.display();
  delay(1500);
  oled.clear(PAGE);
}

The random garbled pattern isn’t constant, sometimes it changes when I upload different code to the board.
Here’s what else I tried so far

  • Different Qwiic Cables (only have two, so maybe two are busted)
  • Did an I2C scan and got the address as 0x3D
  • Different USB cables, different ports
  • Basic sketch to just say hello, didn’t work

This is the first time I’m using an ESP32 and the Qwiic stuff so maybe there’s something simple I’m overlooking but I’ll appreciate any help.

The last thing you might try is disabling the pull-up resistors (you’d just de-solder that blob labeled “PU” and re-test)

If that doesn’t get it going, it is likely a defective module - Was it purchased from us? If so head over to Returns (contact vendor if purchased elsewhere) and we’ll get ya squared away

1 Like

Just commenting if anyone else runs into this problem - I haven’t desoldered and tested but I don’t necessarily need a screen for my project so I do plan to return it.

I did de-solder the jumper and tried. Still did not work. The Micro OLED works with an Uno red board. The ESP32 Thing Plus works with a 6dof board and does communicate with the Micro OLED. It response to the getLCDWidth() command. I have used multiple OLEDs and ESP32 Thing Plus boards. I am still at a loss.

What (if any) response/activity do you see on the screen? Does the OLED appear on i2c scan?

Thank you for getting back with me. My code looks like this;

void setup()
{
Serial.begin(115200);
Serial.println(“Running OLED example”);
delay(100); //Give display time to power on
Wire.begin(); //Setup I2C bus
Wire.setClock(400000); // Uncomment this line to increase the I2C bus speed to 400kHz

// Initalize the OLED device and related graphics system
if (oled.begin() == false) {
Serial.println(“Device begin failed. Freezing…”);
while (true)
;
}
Serial.println(“Begin success”);

width = oled.getLCDWidth();
height = oled.getLCDHeight();
Serial.print("width = ");
Serial.println(width);
Serial.print("height = ");
Serial.println(height);

// clear(ALL) will clear out the OLED’s graphic memory.
// clear(PAGE) will clear the Arduino’s display buffer.
oled.clear(ALL); // Clear the display’s memory (gets rid of artifacts)
// To actually draw anything on the display, you must call the
// display() function.
oled.display();

}
My serial response looks like this;


ets Jul 29 2019 12:21:46


rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)


configsip: 0, SPIWP:0xee


clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00


mode:DIO, clock div:1


load:0x3fff0030,len:4744


load:0x40078000,len:15672


load:0x40080400,len:3152


entry 0x4008059c


Running OLED example


Begin success


width = 64


height = 48

and the OLED looks like this;

Looks like a defective unit - Was it purchased from us? If so head over to Return Policy - SparkFun Electronics (contact vendor if purchased elsewhere) and we’ll get ya squared away

Two different OLED displays are working the same way on two different ESP32 boards. I switched both OLEDs to an Uno board and they both work just fine.

Ah - in that case it’s likely something going on with the i2c bus. Can you try a different i2c Hz in your code?

I will try that. The ESP 32 does work with other i2c devices. FYI

I did change the i2c clock from 400kHz back to 100kHz and then to 200kHz. No change.
I do have an Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout that does work with the ESP32.
I do have a functioning sketch that runs both the 9-DOF board and the OLED from the Uno.
The sketch works on the ESP32, the OLED just does not display correctly with the ESP32.

#include <SFE_MicroOLED.h>

Could it be that the sketch is not being assembled and transferred to the ESP32 correctly?
If so, how do we correct it and why does the 9-DOF board still work?

Thanks again for your help
Tom

Gotcha.

I’m going to locate a couple of my esp32’s and OLEDs and run some tests to see if I get the same thing

Any success yet or are you seeing the same thing as I have?
Thanks for looking into this.

I had to wait on them to arrive but should be able to test later today and update this thread when :slight_smile: