In this guide, we’ll walk you through the process of connecting the 0.96 OLED display to the Arduino Nano, uploading a sample code to demonstrate its capabilities, and customizing the display with simple text using the I2C communication protocol. Let’s dive in!
About the OLED Display:
OLED displays are available in various sizes and colours. In this tutorial, we’re using a white-coloured 0.96” OLED display with a resolution of 128×64 pixels. This display is perfect for showing text, graphics, and even small animations!
Components You’ll Need:
Before getting started, ensure you have the following components:
• Arduino Nano
• 0.96” I2C OLED Display Module
• Breadboard
• Jumper wires
Step 1: Connecting the OLED Display
We’ll be using the Arduino Nano, a compact and versatile microcontroller, to control the OLED display. You may use any Microcontroller including all other Arduino or ESP boards.
Here’s how to connect it with Nano Board:
1. OLED VCC to Arduino 5V
2. OLED Ground to Arduino Ground
3. OLED SDA to Arduino A4
4. OLED SCL to Arduino A5

Step 2: Setting Up the Arduino IDE
Next, let’s move to the programming part. Open your Arduino IDE and install the necessary libraries for the OLED display.
1. Go to ‘Sketch’ > ‘Include Library’ > ‘Manage Libraries’.
2. In the Library Manager, search for ‘Adafruit_SSD1306’ and click ‘Install’.
3. Similarly, search for ‘Adafruit_GFX’ and install it.
You may also simply download the zip files from below and include zip library in Arduino IDE
Note: If you’re new to using the Arduino Nano, we recommend checking out our Beginner’s Tutorial first. You can check the following getting started with Nano Video:
Step 3: Running the Example Code
Now, let’s start with an example code. In the Arduino IDE, go to:
‘File’ > ‘Examples’ > ‘Adafruit SSD1306’ > ‘ssd1306_128X64_i2c’

This will open the sample code. Depending on your specific microcontroller and OLED display model, you might need to adjust the code slightly:
1. Simply replace the Screen Address to 0X3C from current 0X3D
After making these changes, upload the code to your Arduino Nano to see the OLED display in action!

With the code successfully uploaded you should see the display initializing with Adafruit logo and then demonstrating all its capabilities, now we can head to customizing the display and printing a custom text on our OLED
Step 4: Customizing the Display
Let’s customize the code to display a personalized message:
1. Include the necessary libraries for I2C communication and graphics like before.
2. Define the screen width and height of the OLED display.
3. Initialize the OLED display in the ‘setup()’ function and verify that it’s working correctly.
4. Clear the display buffer, set the text size, and colour the text in white.
5. Display the text ‘Hello OLED!’ at position (0, 0) on the screen.
6. Finally, render the content on the OLED display using ‘display.display()’.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// Clear the buffer
display.clearDisplay();
// Set text size to 2
display.setTextSize(2);
// Set text color to white
display.setTextColor(SSD1306_WHITE);
// Set cursor to top-left corner (0,0)
display.setCursor(0, 0);
// Print "Hello OLED" to the screen
display.println(F("Hello OLED"));
// Show the display buffer on the screen
display.display();
}
void loop() {
// Nothing to do in loop
}
Upload the updated code (refer above) to your Arduino Nano, and voilà! You should see the text “Hello OLED!” displayed on the screen.

Conclusion:
With this setup, you can easily integrate the OLED display into your Microcontrollers projects and add visual feedback to your designs. The code is highly customizable, allowing you to display other text, graphics, or even create small animations—the possibilities are endless!
Thanks for following along with this tutorial on the 0.96” I2C OLED Display Module with Arduino Nano. If you have any questions or suggestions, feel free to leave them in the comments. Happy tinkering!