1.3 Inch OLED Display Arduino Library: Complete Guide (2025)
1.3 Inch OLED Display Arduino Library: Complete Guide (2025)
For Arduino makers and engineers working with 1.3 inch OLED displays, choosing the right library is the foundation of seamless project integration. Whether you’re building a wearable device, data logger, or DIY dashboard, compatible libraries simplify tasks like text rendering, graphics display, and touch interaction—without writing low-level driver code. This guide breaks down the best Arduino libraries for 1.3 inch OLEDs, step-by-step installation, usage examples, and how OPL’s displays optimize compatibility.
Key Background: 1.3 Inch OLED Drivers & Library Compatibility
- SH1106: The most common driver for 1.3 inch monochrome OLEDs (e.g., OPL-M130, 128×64 resolution). Requires libraries optimized for its 132-column memory layout (vs. 128 columns for smaller OLEDs).
- SSD1306: Used in some 1.3 inch models (less common, often 128×64). Shares libraries with 0.96 inch OLEDs but may need resolution adjustments.
- SSD1351: For 1.3 inch color OLEDs (e.g., OPL-C130, 128×128 resolution). Requires dedicated color OLED libraries.
All OPL 1.3 inch OLEDs are calibrated for industry-standard libraries, with custom-tweaked examples to eliminate common issues like display offset or flickering.
Top 3 Arduino Libraries for 1.3 Inch OLED Displays
Below are the most reliable libraries, tested with OPL’s 1.3 inch modules—no extra configuration needed for basic use.
1. Adafruit SH110X Library (Best for SH1106 Monochrome Displays)
Overview:
The official Adafruit library for SH1106/SH1107 drivers, optimized for 1.3 inch OLEDs (128×64). It supports I2C/SPI interfaces, graphics primitives (lines, circles), and text rendering—ideal for OPL-M130 (OPL’s flagship monochrome 1.3 inch model).
Key Features:
- Supports 128×64 resolution (native to 1.3 inch SH1106 displays)
- Built-in contrast/brightness control
- Compatible with Arduino Uno, Mega, Nano, ESP32, and STM32
- Integrates with Adafruit GFX for advanced graphics
Installation Steps:
- Open Arduino IDE → Go to Sketch > Include Library > Manage Libraries.
- Search for "Adafruit SH110X" (by Adafruit Industries).
- Click "Install" (installs dependencies like Adafruit BusIO automatically).
- For OPL displays, download the OPL-Specific Example Pack from www.opldisplaytec.com/support (pre-calibrated for 1.3 inch offset).
Basic Usage Example (OPL-M130, I2C Interface):
#include <Adafruit_SH110X.h>
#include <Wire.h>
// OPL-M130 I2C default address: 0x3C (check with I2C scanner if issues)
#define OLED_ADDR 0x3C
// 1.3 inch SH1106: 128 (width) × 64 (height)
Adafruit_SH1106G display(128, 64, &Wire, OLED_ADDR);
void setup() {
Serial.begin(9600);
// Initialize display (OPL-calibrated startup)
if (!display.begin(0x00)) { // 0x00 = reset pin not used (OPL modules have on-board reset)
Serial.println("Display initialization failed!");
while (1); // Halt if no display
}
display.clearDisplay(); // Clear buffer
display.setTextSize(1); // Text size (1-4)
display.setTextColor(SH110X_WHITE); // Monochrome: WHITE = on, BLACK = off
}
void loop() {
// Display static text
display.setCursor(10, 10); // X=10, Y=10 (OPL-tweaked for no offset)
display.print("OPL 1.3\" OLED");
display.setCursor(20, 30);
display.print("Arduino Test");
display.setCursor(30, 50);
display.print("SH110X Library");
display.display(); // Refresh screen to show buffer
delay(3000);
// Clear and display graphics
display.clearDisplay();
display.drawCircle(64, 32, 20, SH110X_WHITE); // Circle at center
display.drawLine(0, 32, 128, 32, SH110X_WHITE); // Horizontal line
display.display();
delay(3000);
}
2. U8g2 Library (Most Versatile: Multi-Driver & Multi-Resolution)
Overview:
A lightweight, universal library for monochrome OLED/LCD displays. It supports all 1.3 inch OLED drivers (SH1106, SSD1306) and works with 99% of Arduino boards. Perfect for makers who switch between display models or need advanced features like custom fonts.
Key Features:
- Supports 1.3 inch resolutions (128×64, 64×128 vertical)
- 1000+ built-in fonts (including CJK/non-Latin characters)
- Low memory usage (ideal for Arduino Uno/Nano)
- SPI/I2C support with configurable pins
Installation Steps:
- In Arduino Library Manager, search for "U8g2" (by Oliver Kraus).
- Install the "U8g2" library (not "U8glib"—the older version).
- For OPL displays, use the "SH1106_128X64_NONAME_F_SW_I2C" constructor (pre-tested).
Basic Usage Example (OPL-V130 Vertical 1.3 Inch OLED):
#include <U8g2lib.h>
#include <Wire.h>
// OPL-V130 (64×128 vertical 1.3 inch OLED, SH1106)
U8G2_SH1106_64X128_NONAME_F_SW_I2C u8g2(U8G2_R0, SCL, SDA, U8X8_PIN_NONE);
void setup() {
u8g2.begin();
u8g2.setContrast(128); // 0-255 (128 = default for OPL)
}
void loop() {
u8g2.firstPage();
do {
// Draw vertical text (optimized for OPL-V130)
u8g2.setFont(u8g2_font_ncenB14_tr); // 14pt font
u8g2.drawStr(5, 30, "OPL");
u8g2.setFont(u8g2_font_unifont_t_chinese2); // Chinese font
u8g2.drawStr(10, 60, "垂直屏测试");
u8g2.setFont(u8g2_font_6x10_tr);
u8g2.drawStr(15, 90, "U8g2 Library");
u8g2.drawFrame(2, 2, 60, 124); // Border around display
} while (u8g2.nextPage()); // Required for U8g2's buffered rendering
delay(5000);
}
3. Adafruit SSD1351 Library (For 1.3 Inch Color OLEDs)
Overview:
Key Features:
- 128×128 resolution (native to 1.3 inch color OLEDs)
- 24-bit color support (RGB)
- Brightness and gamma correction
- Compatible with Adafruit GFX for 2D graphics
Installation Steps:
- Install "Adafruit SSD1351" via Arduino Library Manager.
- Install dependencies: "Adafruit GFX Library" and "Adafruit BusIO".
- Download OPL-C130 color calibration files from www.opldisplaytec.com/color-oled (fixes color accuracy issues).
Basic Usage Example (OPL-C130 Color OLED):
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1351.h>
#include <SPI.h>
// OPL-C130 SPI Wiring (Arduino Uno):
#define OLED_CS 10
#define OLED_DC 9
#define OLED_RST 8
Adafruit_SSD1351 display(OLED_CS, OLED_DC, OLED_RST);
void setup() {
Serial.begin(9600);
display.begin();
display.setRotation(0); // 0=default, 1=90°, 2=180°, 3=270°
display.fillScreen(BLACK); // Clear to black
}
void loop() {
// Display color text
display.setTextSize(2);
display.setTextColor(RED);
display.setCursor(10, 20);
display.print("OPL Color OLED");
display.setTextColor(GREEN);
display.setCursor(20, 50);
display.print("1.3 Inch");
display.setTextColor(BLUE);
display.setCursor(30, 80);
display.print("SSD1351 Lib");
// Draw color rectangle
display.fillRect(10, 100, 100, 20, YELLOW);
display.display();
delay(4000);
display.fillScreen(BLACK); // Clear screen
}
OPL’s Custom Arduino Library & Resources
- Zero display offset (critical for 1.3 inch SH1106 models)
- Reduced power consumption (ideal for battery-powered projects)
- Pre-configured pinouts for OPL modules
- Compatibility with OPL’s touch-enabled 1.3 inch OLEDs (e.g., OPL-T130)
How to Download OPL’s Library:
- Visit www.opldisplaytec.com/arduino-library.
- Select your OPL model (M130, V130, C130, T130).
- Download the ZIP file and extract it to your Arduino "libraries" folder (usually
Documents/Arduino/libraries). - Restart Arduino IDE—you’ll find OPL-specific examples under File > Examples > OPL_OLED_Library.
Common Library Issues & Fixes (For 1.3 Inch OLEDs)
1. Display Offset or Missing Pixels
- Cause: Generic libraries use 0.96 inch (128×64) memory mapping, which misaligns 1.3 inch SH1106 displays (132-column memory).
- Fix: Use OPL’s calibrated library or adjust the column offset in code:
// For Adafruit SH110X: Add 2px X-offset to cursor
display.setCursor(x + 2, y);
2. Library Compilation Errors
- Cause: Missing dependencies (e.g., Adafruit GFX for SH110X library).
- Fix: Install all required libraries via Library Manager (Arduino will prompt for dependencies, or check OPL’s datasheet for a full list).
3. I2C Communication Failure
- Cause: Incorrect I2C address or missing pull-up resistors.
- Fix:
- Use OPL’s I2C Scanner Sketch (download from www.opldisplaytec.com/support) to find your display’s address (usually 0x3C or 0x3D).
- Add 4.7kΩ pull-up resistors to SDA (A4) and SCL (A5) pins if using Arduino Uno/Nano.
4. Garbled Text or Graphics
- Cause: Wrong resolution or driver constructor (e.g., using SSD1306 library for SH1106 display).
- Fix: Confirm your OPL display’s driver (check datasheet) and use the matching library/constructor.
How to Choose the Right Library for Your Project
| Project Requirement | Recommended Library | OPL Model Compatibility |
|---|---|---|
| Monochrome 1.3 inch (SH1106) | Adafruit SH110X | OPL-M130, OPL-V130 |
| Multi-driver support (switch displays) | U8g2 | All OPL 1.3 inch monochrome |
| Color 1.3 inch OLED | Adafruit SSD1351 | OPL-C130 |
| Low power (wearables) | OPL Custom Library | All OPL 1.3 inch models |
| Non-Latin text (Chinese/Arabic) | U8g2 | All OPL 1.3 inch models |
Contact OPL for Library Support
Need help with library installation, code debugging, or custom project integration? OPL’s technical team specializes in Arduino-OLED compatibility:
- Website: www.opldisplaytec.com (download libraries, datasheets, and example sketches)
- Email: info@opldisplay.com (send your code snippet or project details for tailored support)
- Support Hours: 9 AM–6 PM (GMT+8), 24-hour response for critical issues
All OPL 1.3 inch OLED displays include a 2-year warranty and free lifetime library updates, ensuring long-term compatibility with future Arduino IDE versions.
This guide provides everything you need to get started with 1.3 inch OLED displays and Arduino libraries—no extra configuration or coding required. For commercial projects, OPL also offers custom library modifications and technical documentation to accelerate product development.
Ms.Josey
Ms.Josey