I2C OLED Display troubleshoot Guide min

I2C OLED Display not working? Try this troubleshoot guide


Your brand new I2C OLED display not working? Don’t worry. Previously, we studied the interfacing of an OLED display with NodeMCU in the post mentioned here. Now, sometimes it may happen that due to some basic errors, the display may not work. Here, in this guide, I will describe the maximum possible issues that can lead to the failure of OLED Display. If you have bought a display like this, then the following tutorial will help you.

Why my OLED Display is not working?

You bought a OLED display, made connections, uploaded a demo code, BUT display not light up! You try a lot, different things but no luck? Then you are at right place. Whether you interface OLED with Arduino, NodeMCU or any other board, there are some common checks you should do before thinking your OLED is dead.

Possible reasons behind non-working OLED display

Pin Connection of OLED Display

Check the proper pin-out. If you have wrong connections, then display will not even start! So following is pin connection for some popular development boards.

OLED Display PinsNode MCU PinsArduino UNO PinsArduino Nano Pins
SCLD1A5A5
SDAD2A4A4
VCC3V3.3V/5 V3.3V/5 V
GNDGNDGNDGND
OLED Display pin connection with different boards

Type of OLED display

As mentioned in the previous post, I2C OLED comes with different variants. In one of the variants, it comes with a reset pin and another one is without reset pin. 

Code statement for displays without Reset pin:

#define OLED_RESET -1 

Code statement for displays with Reset pin:

#define OLED_RESET 4     //if reset pin is connected to pin 4

Address of your I2C OLED display

Most of the time, the address may be the main cause of the failure of your OLED display. Before programming, make sure the address of your I2C display is proper. Here, address I2C address is different for different resolution of display. Following are the two addresses for the OLED displays currently available in the market.

#define OLED_ADDR 0x3C // here address is 0x3C for 128x32 display
#define OLED_ADDR 0x3D // here address is 0x3D for 128x64 display

If both of above addresses won’t work, you should try using I2C device scanner program. It will find the address of connected peripheral.

Resolution of your display

Resolution is also defined in the library of the OLED display. Depending on the resolution of the OLED display, you may need to make necessary changes in the program. Following code snippet shows the block where we declare size and execute the command for OLED display.

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

In library file, you need to change header file. To make necessary changes, follow the steps below:

  1. Open “My Computer” > Documents > Arduino > libraries > Adafruit_SSD1306.
  2. From the library folder, open Adafruit_SSD1306.h file.
  3. You need to uncomment the statement which defines the resolution of your display and comment all other statements.
  1. Open “My Computer” > Documents > Arduino > libraries > Adafruit_SSD1306.
  2. From the library folder, open Adafruit_SSD1306.h file.
  3. You need to uncomment the statement which defines the resolution of your display and comment all other statements.
Resolution definitions in library file

Power source of your OLED Display

If you are powering your OLED display by onboard power source and board itself powered by Computer/Laptop USB, then try powering it with external power source. OLED display need input voltage around 3.7v to 6v. Here, 5v will be ideal source.

Check program for display.display() command

For programming of OLED display, display.display() is a necessary command in order to display the contents. This statement should be executed every time whenever changes are made in the display contents. Check for the missing command, if your display is not getting updated.

Inspect your code for invalid display instructions

Still, your I2C OLED display not working even after trying the above solutions? Then there are high possibilities that your program has some invalid instructions for OLED display. So better you recheck your program.

If you find any other problem or solution regarding the OLED display, do comment and share your contribution in this article.

OLED Display Troubleshoot Guide

Subscribe
Notify of
guest
9 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Deepti
Deepti
1 year ago

Really helped a lot. Saved my day.

Ayuti Algur
Ayuti Algur
1 year ago

I had searched for many solutions but this worked instantly. Thanks

Diego
Diego
10 months ago

You are master! My OLED was not work. On the label of my OLED is: “128×64” but after using I2C scanner I got adress 0x3C. It means I have 128×32! The supplier made a mistake. Now works perfectly. Thank you! But on my Arduino Nano works with pin A4-SDA and A5-SCI.

Last edited 10 months ago by Abhishek
Lennart
Lennart
9 months ago

Thank you so much! I had the same problem as Diego, I received a display that was mislabeled as 128×64 when it was acutally 128×32.

Also, just FYI for anyone else having trouble with their I2C Displays: At least on my computer, the USB ports weren’t powerful enough to supply both the ESP8266 and the display with enough current. When I connected it to an external power source, it worked flawless.

KevLis
KevLis
8 months ago

display.display() did the trick. Feel like a complete idiot... Thanks a lot!

9
0
Would love your thoughts, please comment.x
()
x