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. The following are some points you should go through.

Check Pinout

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

OLED Dsiplay PinsNode MCU PinsArduino UNO PinsArduino Nano Pins
SCLD1A5A2
SDAD2A4A3
VCC3V3.3V/5 V3.3V/5 V
GNDGNDGNDGND

Check for display type

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

Check the 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.

Check 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

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.

5 2 votes
Article Rating

Subscribe
Notify of
guest
4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Deepti
Deepti
8 months ago

Really helped a lot. Saved my day.

Ayuti Algur
Ayuti Algur
8 months ago

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