Skip to content
Free Delivery on Orders Above Rs 999/- Pan-India
Cash on Delivery Available for Orders above Rs.500/- and Upto Rs 3000/-
SAVE more when you BUY more. Upto 30% Off on BULK PURCHASE
GST Invoices for Your Business
Dedicated Technical Support Team
Safely Delivering Genuine Products PAN INDIA

How to Interface 0.96-inch OLED with Arduino & ESP32 (Beginner's Guide)

How to Interface 0.96-inch OLED with Arduino & ESP32 (Beginner's Guide)
-
Written By - Robocraze -
๐Ÿ“… Updated on 08 Oct 2026
โœจ Summarize with AI
โœ… Prompt copied

Summary

A 0.96-inch OLED is a simple way to add a small graphical display to an Arduino or ESP32 project. The Robocraze 0.96 Inch OLED Display 128x64 Blue for Arduino uses a 128 ร— 64 pixel OLED panel and a 4-pin I2C interface, so only four connections are needed: VCC, GND, SCL, and SDA. The product page specifies a 3.3V to 5V supply range and identifies the display controller as SSD1315 in its main description.

This guide covers the exact wiring, Arduino code, ESP32 code, library installation, I2C address checking, and common problems when the display does not turn on.

How to Interface 0.96-inch OLED with Arduino & ESP32 (Beginner's Guide)

What You Need

For the basic test, you need:

Component Quantity
0.96-inch OLED Display 128 ร— 64, 4-pin 1
Arduino Uno or Compatible Board 1
ESP32 Development Board 1
Male-to-Female Jumper Wires 4
USB Cable 1

You do not need separate resistors or a backlight for this OLED module.

The display measures approximately 2.7 cm ร— 2.8 cm and weighs about 5 grams. Its OLED pixels are self-emitting, so the module does not require a separate backlight.

Components and Supplies

0.96 Inch OLED Display Module SPI/I2C 4pin Blue Color -Displays -OLED Display -Robocraze0.96 Inch OLED Display Module SPI/I2C 4pin Blue Color -Displays -OLED Display -Robocraze

    0.96 Inch OLED Display Module SPI/I2C 4pin Blue Color

    0.96 Inch OLED Display Module SPI/I2C - 4pinย Blue Color This is the 0.96" OLED display module 4 pin, it is made of 128x64 individual blue OLED pixels, and each one is turned on or off by the controller chip. It works without a backlight,...
    Rs 225/-
    Rs 225/-
    Rs 299/-
    Save Rs 74/-
    Arduino Uno R3 Board compatibleArduino Uno R3 Board compatible

      Arduino Uno R3 Board compatible

      Arduinoย Uno R3 Compatible Boardย  The Arduino Uno R3 ATMEGA328P Development Board is more than just a microcontroller board; it's a gateway to endless possibilities in the world of electronics and programming. For hobbyists, students, and makers, it stands out as the best Arduino Uno...
      Rs 429/-
      Rs 429/-
      Rs 699/-
      Save Rs 270/-
      Jumper Wire Set - M2M, M2F, F2F (40 pcs each) โ€“ Ideal for Arduino & prototyping. Electronic Components - RobocrazeJumper Wire Set - M2M, M2F, F2F (40 pcs each) โ€“ Ideal for Arduino & prototyping. Electronic Components - Robocraze

        Jumper Wire Set - M2M, M2F, F2F (40 pcs each)

        Jumper Wire Set - M2M, M2F, F2F (40 pcs each) These DuPont jumper wires for electronics are premium quality wire manufactured by using quality assured material and advanced techniques, which make them up to the standard in this highly challenging field. This 120pcs Dupont...
        Rs 164/-
        Rs 164/-
        Rs 169/-
        Save Rs 5/-
        ๐Ÿ”ฅ Trending
        ESP32 NodeMCU (38-Pin) WiFi + BLE โ€“ Ideal for IoT. -Nodemcu ESP Board -RobocrazeESP32 NodeMCU (38-Pin) WiFi + BLE โ€“ Ideal for IoT. -Nodemcu ESP Board -Robocraze

          ESP32 38-Pin WiFi + Bluetooth NodeMCU Development Board

          ESP32 38-Pin WiFi + Bluetooth NodeMCU Development Board The ESP32 38-Pin WiFi + Bluetooth NodeMCU Development Board is a versatile microcontroller development board designed for IoT, home automation, robotics, embedded systems, and wireless electronics projects. Built around the ESP-WROOM-32 module, it combines a powerful...
          Rs 422/-
          Rs 422/-
          Rs 599/-
          Save Rs 177/-
          3M USB to Micro USB Cable Black3M USB to Micro USB Cable Black โ€“ High-quality Arduino USB Cable for fast charging & data transfer. -Robocraze

            3M USB to Micro USB Cable Black

            3M USB to Micro USB Cable Black - (Compatible with Smart Phones, Tablets, Power Bank, Black) Tired of short cables that limit where you can use your devices? The 3M USB to Micro USB Cable in Black is here to help. Itโ€™s 3 meters...
            Rs 138/-
            Rs 138/-
            Rs 199/-
            Save Rs 61/-

            What Are the 4 Pins on the OLED?

            The module uses four connections for I2C communication:

            OLED Pin Function Arduino Uno ESP32
            VCC Power 5V 3.3V
            GND Ground GND GND
            SCL I2C Clock A5 GPIO 22
            SDA I2C Data A4 GPIO 21

            The Robocraze product specifies a 3.3V to 5V operating range. For the ESP32, using 3.3V for VCC is the straightforward choice.

            On an Arduino Uno, A4 and A5 are the hardware I2C pins. On a generic ESP32, GPIO21 is the default SDA pin and GPIO22 is the default SCL pin.

            How to Connect the OLED to Arduino Uno

            Connect the four OLED pins to the Arduino Uno as follows:

            OLED Arduino Uno
            VCC 5V
            GND GND
            SCL A5
            SDA A4

            Wiring

            0.96" OLED Arduino Uno
            VCC 5V
            GND GND
            SCL A5
            SDA A4

            That's all the hardware wiring required.

            The 4-pin version uses I2C, which means the Arduino communicates with the display using the SDA data line and SCL clock line. The product page specifically describes this module as an IIC/I2C display.

            Install the Arduino OLED Libraries

            For a beginner-friendly setup, you can use the U8g2 library.ย 

            In Arduino IDE:ย 

            1. Open Sketch. ย 
            2. Select Include Library. ย 
            3. Select Manage Libraries. ย 
            4. Search for U8g2. ย 
            5. Install the library by olikraus. ย 

            U8g2 supports SSD1315 displays and provides an I2C constructor specifically for 128 ร— 64 SSD1315 displays. ย 

            Arduino Uno OLED Example Codeย 

            Use this code to display text on the 0.96-inch OLED:

            
            #include <Wire.h> 
            #include <U8g2lib.h>
             
            U8G2_SSD1315_128X64_NONAME_F_HW_I2C oled( 
              U8G2_R0, 
              U8X8_PIN_NONE 
            ); 
             
            void setup() { 
              oled.begin(); 
             
              oled.clearBuffer(); 
             
              oled.setFont(u8g2_font_ncenB08_tr); 
              oled.drawStr(0, 15, "Hello World!"); 
             
              oled.setFont(u8g2_font_ncenB08_tr); 
              oled.drawStr(0, 35, "Arduino + OLED"); 
             
              oled.drawStr(0, 55, "Robocraze"); 
             
              oled.sendBuffer(); 
            } 
             
            void loop() { 
            }
            

            The U8g2 library's hardware I2C mode uses the Arduino Wire interface, while the SSD1315 128 ร— 64 display has a dedicated I2C constructor.

            What Does the Code Do?

            #include <Wire.h> enables I2C communication.

            #include <U8g2lib.h>

            This loads the U8g2 graphics library.

            U8G2_SSD1315_128X64_NONAME_F_HW_I2C oled(

            
            U8G2_SSD1315_128X64_NONAME_F_HW_I2C oled(
              U8G2_R0,
              U8X8_PIN_NONE
            );
            

            This creates the OLED object for a 128 ร— 64 SSD1315 display using hardware I2C.

            oled.begin();

            Initializes the display.

            oled.clearBuffer();

            Clears the display buffer before drawing new content.

            oled.drawStr(0, 15, "Hello World!");

            Writes text starting at the specified screen coordinates.

            oled.sendBuffer();

            Sends the content from the microcontroller to the OLED.

            How to Connect the OLED to ESP32ย 

            The ESP32 uses different default I2C pins from the Arduino Uno.ย 

            Connect the OLED like this:

            OLED ESP32
            VCC 3.3V
            GND GND
            SCL GPIO 22
            SDA GPIO 21

            Wiring

            0.96" OLED ESP32
            VCC 3.3V
            GND GND
            SCL GPIO 22
            SDA GPIO 21

            GPIO21 is the default SDA pin and GPIO22 is the default SCL pin on a generic ESP32. The Arduino ESP32 documentation also allows I2C pins to be changed when required.

            ESP32 OLED Example Code

            The same U8g2 library can be used with the ESP32.

            
            #include <Wire.h> 
            #include <U8g2lib.h>
             
            U8G2_SSD1315_128X64_NONAME_F_HW_I2C oled( 
              U8G2_R0, 
              U8X8_PIN_NONE 
            ); 
             
            void setup() { 
              Wire.begin(21, 22); 
             
              oled.begin(); 
             
              oled.clearBuffer(); 
             
              oled.setFont(u8g2_font_ncenB08_tr); 
              oled.drawStr(0, 15, "Hello ESP32!"); 
             
              oled.drawStr(0, 35, "0.96 inch OLED"); 
             
              oled.drawStr(0, 55, "Robocraze"); 
             
              oled.sendBuffer(); 
            } 
             
            void loop() { 
            }
            

            Here:

            Wire.begin(21, 22);

            sets GPIO21 as SDA and GPIO22 as SCL.

            The ESP32 Arduino documentation supports configuring the I2C SDA and SCL pins before starting the I2C interface.

            How to Display Sensor Values on the OLED

            Once the basic text example works, you can use the OLED to display values from sensors.

            For example, you can display a temperature reading:

            
            #include  
            #include  
             
            U8G2_SSD1315_128X64_NONAME_F_HW_I2C oled( 
              U8G2_R0, 
              U8X8_PIN_NONE 
            ); 
             
            void setup() { 
              Wire.begin(21, 22); 
              oled.begin(); 
            } 
             
            void loop() { 
              float temperature = 28.5; 
             
              oled.clearBuffer(); 
             
              oled.setFont(u8g2_font_ncenB10_tr); 
              oled.drawStr(0, 18, "Temperature:"); 
             
              oled.setCursor(0, 45); 
              oled.print(temperature); 
              oled.print(" C"); 
             
              oled.sendBuffer(); 
             
              delay(1000); 
            } 
            

            The same approach can be used for humidity, distance, light level, battery voltage, motor status, Wi-Fi information, or other project data.

            The 128 ร— 64 resolution gives enough space for text, icons, simple graphics, sensor readings, and small dashboards.

            How to Display Numbers and Variables

            You can use setCursor() and print() when you want to display changing values.;

            For example:

            
            int distance = 125; 
             
            oled.clearBuffer(); 
             
            oled.setFont(u8g2_font_ncenB10_tr); 
             
            oled.setCursor(0, 20); 
            oled.print("Distance:"); 
             
            oled.setCursor(0, 45); 
            oled.print(distance); 
            oled.print(" cm"); 
             
            oled.sendBuffer();
            

            This is useful for robotics projects where sensor readings change continuously.

            How to Draw Shapes on the OLED

            The display is not limited to text. U8g2 also supports graphics such as lines, rectangles and circles.

            For example:

            
            oled.clearBuffer(); 
             
            oled.drawFrame(0, 0, 128, 64); 
            oled.drawLine(0, 32, 127, 32); 
            oled.drawCircle(64, 32, 20); 
             
            oled.sendBuffer();
            

            This draws a border, a horizontal line and a circle.

            You can use these functions to create:

            • Sensor dashboards
            • Robot status screens
            • Battery indicators
            • Menus
            • Simple animations
            • Progress bars
            • Graphs
            • Custom icons

            How to Change the OLED Font

            U8g2 includes many fonts.

            For example:

            
            oled.setFont(u8g2_font_ncenB08_tr); 
            
            You can change it to: 
            
            oled.setFont(u8g2_font_ncenB10_tr); 
            
            or: 
            
            oled.setFont(u8g2_font_ncenB14_tr);
            

            Larger fonts are useful for displaying one important value, while smaller fonts work better when showing several sensor readings on the same screen.

            How to Find the OLED I2C Address

            If the display is powered but nothing appears, checking the I2C address is a useful troubleshooting step.

            Upload this I2C scanner to the Arduino or ESP32:

            
            #include <Wire.h> 
             
            void setup() { 
              Wire.begin(); 
              Serial.begin(115200); 
             
              Serial.println("I2C Scanner"); 
            } 
             
            void loop() { 
              byte error; 
              byte address; 
             
              int devices = 0; 
             
              for (address = 1; address < 127; address++) { 
             
                Wire.beginTransmission(address); 
                error = Wire.endTransmission(); 
             
                if (error == 0) { 
                  Serial.print("I2C device found at 0x"); 
                   
                  if (address < 16) { 
                    Serial.print("0"); 
                  } 
             
                  Serial.println(address, HEX); 
             
                  devices++; 
                } 
              } 
             
              if (devices == 0) { 
                Serial.println("No I2C devices found."); 
              } 
             
              delay(3000); 
            }
            

            Open the Serial Monitor and set the baud rate to 115200.

            If the OLED responds, the scanner will report its I2C address.ย 

            Do not assume an address without checking when troubleshooting. Many small OLED modules commonly use addresses such as 0x3C or 0x3D, but the actual address depends on the module configuration.

            What If the OLED Is Blank?

            Check the following points in order.ย 

            1. Check VCC and GNDย 

            Make sure:ย 

            OLED VCC โ†’ Board powerย 
            OLED GND โ†’ Board GNDย 

            For the ESP32, use the 3.3V pin.ย 

            The Robocraze product specifies a 3.3V to 5V supply range. ย 

            2. Check SDA and SCLย 

            For Arduino Uno:ย 

            SDA โ†’ A4ย 
            SCL โ†’ A5ย 

            For ESP32:ย 

            SDA โ†’ GPIO21ย 
            SCL โ†’ GPIO22ย 

            The Arduino Uno's I2C pins are A4 and A5, while the generic ESP32 defaults are GPIO21 and GPIO22. ย 

            3. Run the I2C Scannerย 

            If the scanner finds no device, check the four wires and make sure the jumper wires are properly seated.ย 

            4. Check the Display Driverย 

            There is an important detail with this particular product page. The main product description identifies the controller as SSD1315, while the FAQ section refers to it as SSD1306. ย 

            For this reason, the code above uses the SSD1315 U8g2 constructor, which directly supports a 128 ร— 64 SSD1315 I2C display. U8g2's documentation lists an SSD1315 128 ร— 64 I2C constructor. ย 

            If your specific unit does not initialize with the SSD1315 constructor, verify the controller marking on the module and test the appropriate U8g2 constructor.ย 

            5. Check the Resolutionย 

            This module is a 128 ร— 64 display. ย 

            Your library configuration should therefore use a 128 ร— 64 constructor.

            Arduino vs ESP32: Which One Should You Use With This OLED?ย 

            Both boards can interface with this 4-pin OLED using I2C.ย 

            Feature Arduino Uno ESP32
            OLED Interface I2C I2C
            SDA A4 GPIO21
            SCL A5 GPIO22
            OLED VCC 5V 3.3V
            Wi-Fi No Yes
            Bluetooth No Yes
            Best Suited For Basic electronics projects IoT and connected projects

            The OLED itself does not require a different display connection method between the two boards. The main difference is the I2C pin assignment and the power connection used in the setup above.

            What Can You Build With This 0.96-inch OLED?ย 

            The compact 128 ร— 64 display works well when a project needs a small visual interface.ย 

            Some practical applications include:ย 

            • Temperature monitor: Display live temperature and humidity. ย 
            • Distance meter: Show ultrasonic sensor measurements. ย 
            • Robot dashboard: Display battery level, motor status and sensor readings. ย 
            • IoT monitor: Show Wi-Fi status, sensor data or device information. ย 
            • Digital clock: Display time and date. ย 
            • Battery monitor: Show voltage and battery percentage. ย 
            • Mini menu: Create buttons and a simple user interface. ย 
            • Debug display: Show variable values without opening the Serial Monitor. ย 

            Robocraze also lists applications such as watches, head-mounted displays, meters and intelligent instruments for this type of OLED module. ย 

            Key Points to Rememberย 

            The wiring for the Robocraze 0.96-inch OLED 128 ร— 64 4-pin module is straightforward:ย 

            Arduino Unoย 

            • VCC โ†’ 5V
            • GND โ†’ GND
            • SCL โ†’ A5
            • SDA โ†’ A4ย 

            ESP32ย 

            • VCC โ†’ 3.3V
            • GND โ†’ GND
            • SCL โ†’ GPIO22
            • SDA โ†’ GPIO21ย 

            The module uses a 128 ร— 64 OLED panel, I2C communication and a 3.3V to 5V supply range. ย 

            Once the basic text example works, you can use the same display to show sensor readings, graphics, menus and project status information.ย 

            Final Thoughtsย 

            The 0.96-inch OLED Display 128 ร— 64 Blue for Arduino is a practical display for Arduino and ESP32 projects because the 4-pin I2C interface keeps the wiring simple. Start with the text example, confirm that the display communicates correctly, and then add sensor values or graphics to your project.ย 

            Excerpt

            Step-by-step guide to connecting a 0.96" 128x64 OLED to Arduino & ESP32. Discover I2C wiring, U8g2 code, I2C address troubleshooting, and more!
            Prev Post
            Next Post

            Leave a comment

            Please note, comments need to be approved before they are published.

            Thanks for subscribing!

            This email has been registered!

            Shop the look

            Choose Options

            Edit Option
            Back In Stock Notification
            Compare
            Product SKU Description Collection Availability Product Type Other Details

            Choose Options

            this is just a warning
            Login
            Shopping Cart
            0 items
            FREE SHIPPING!
            โ‚น100 OFF
            โ‚น200 OFF
            โ‚น999
            โ‚น2500
            โ‚น4900
            WhatsApp Chat Chat