Labs / Electronic modules

GraftSense - 1.3-inch OLED Module Based on SH1107 (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.1 · License: CC BY 4.0

Contents
SH1107 1.3
SH1107 1.3 64 128 LED1 C7 R5 U1 U2 V1.0.0

I. Module Introduction

Based on SH1107, this 1.3-inch OLED module adopts the SH1107 driver chip solution, is equipped with a 128×128 dot matrix monochrome OLED screen, supports 256-level contrast adjustment for clear and sharp display, and supports the standard I²C communication interface. Users can select between the two slave addresses ADDR1 via the short-circuit point: 0x3C and 0x3D. It has a built-in dual power supply circuit including a 5V-to-3.3V LDO and a dedicated 9V boost circuit for the OLED screen, as well as power filtering and indicator light circuits. It is compatible with 3.3V/5V levels, with a sleep mode current as low as 5μA. It is suitable for scenarios requiring low-power, high-contrast display such as embedded development, maker projects, and small instruments, providing stable and efficient visual interaction capabilities for the system.

II. Introduction to Main Chips

SH1107 / I²C / SPI /parallel interface compatible OLED driver chip that supports 128×128 dot matrix monochrome display, integrates built-in 256-level contrast adjustment and DC-DC boost circuit, operates with logic supply voltage of 1.65V~3.5V, and features a sleep current as low as 5μA. Leveraging its low power consumption and high contrast characteristics, it is widely used in small-sized portable low-power display devices.

2.1 Chip Overview

SH1107 1.3 1/128 64 128 17.1 35.8 1.43mm 14.7 29.42mm

Basic specifications of the SH1107 -based 1.3-inch OLED module: It adopts passive matrix monochrome white light display, with a resolution of 64×128 and a driving duty ratio of 1/128; the panel measures 17.1×35.8×1.43mm, the effective display area is 14.7×29.42mm, the pixel pitch is 0.17×0.17mm, and the pixel size is 0.15×0.15mm, making it suitable for monochrome display scenarios in compact spaces.

2.2 Pin Definition

SH1107 1.3 64 128 35.8 17.1mm 26.86 14.7mm IM1 A0
SH1107 1.3 1REF IM1 D0 D1

Mechanical dimensions and pinout of the 1.3-inch SH1107 -based OLED module: the screen features a 64×128 dot matrix, with a panel size of 35.8×17.1mm and an active display area of 26.86×14.7mm; pins are categorized into power supply, driving, and interface groups. The IM1 pin can be used to configure the I²C interface, the A0 pin serves as the slave address bit SA0, the D0 and D1 pins correspond to SCL and SDA respectively, and the IREF pin connects to an external resistor to set the brightness reference, delivering complete hardware control and power supply capabilities.

2.3 Functional Block Diagram

None.

2.4 Performance Parameters

SH1107 1.3 0.3V 3.6V 7V 16.5V 40 70 85 150cd/m

Absolute maximum ratings for the 1.3-inch SH1107 -based OLED module: The logic supply VDD ranges from -0.3V to 3.6V, the display driver supply VPP ranges from 7V to 16.5V, the operating temperature ranges from -40℃ to 70℃, the storage temperature ranges from -40℃ to 85℃, and the lifespan is 10000 hours at a brightness of 150cd/m²; exceeding the specified ranges will result in permanent device damage or reduced reliability.

SH1107 1.3 2.4

Optical and DC electrical characteristics of the 1.3-inch SH1107 -based OLED module: Under the conditions of VDD = 1.65V ~ 3.5V and VPP = 8.5V ~ 9.5V, it realizes monochromatic white light display with a brightness of 120~160cd/m² and a high contrast ratio of >10000:1, is compatible with 3.3V level, features extremely low operating current (typical IDD of 55μA, typical IPP of 24~29mA), and a sleep mode current as low as 0.1~5μA, making it suitable for small low-power display devices.

2.5 Reference Circuit

SH1107 1.3 Q1 Q2 R1 R2 R3 C1 C2 C3

SH1107 's I ² C interface reference circuit: through MOSFET electronic switch control screen drive VPP on and off to avoid leakage current, D0 / D1 are used as SCL / SDA and external 4.7kΩ pull-up resistor, IREF pin sets brightness reference through 560kΩ resistor, equipped with power filter capacitor, compatible with 3.3V level, can stably realize I ² C communication and OLED phased rollout display control.

2.6 Chip Configuration

None.

SH1107 1.65V 3.5V 25 400kHz 1.3

SH1107 's I ² C interface timing characteristics: under the condition of VDD = 1.65V~ 3.5V, supports up to 400kHz communication rate, SCL low-level pulse width ≥ 1.3μs, high-level pulse width ≥ 0.6μs, data establishment time ≥ 100ns, hold time ≥ 0μs, START / STOP condition timing is strict, bus load capacitance ≤ 400pF, can achieve stable and reliable I ² C communication.

2.8 PCB Routing Notes

None.

III. Circuit Engineering

3.1 Circuit Source Engineering

To obtain the circuit source project, please follow the official account [Freak Embedded].

3.2 Module Usage Instructions

The schematic diagram of this module is shown below:

SCH_1.3-inch OLED Module Based on SH1107-V1.0.0_2026-03-27.pdf 2.5 MB

SH1107 1.3 1.3-inch V1.0.0 ADDR1

This module provides a IIC communication interface: it supports standard I²C communication rates up to 400kHz, allows selection between the two slave addresses ADDR1 via the short contact point, supporting both 0x3C and 0x3D options, is compatible with 3.3V/5V logic levels, and enables stable transmission of commands and display data. Combined with the 256-level contrast adjustment of SH1107, it delivers delicate display effects. Suitable for low-power display scenarios such as embedded development, maker projects, and small instruments, it provides reliable and efficient visual interaction capabilities for the system.

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing, and the 1.3-inch OLED module based on SH1107 communicates with the main controller via the I2C interface.

Here, we first use the HY2.0-4P cable to connect the module to the GraftPort-RP2040 development board's I2C0 interface:

GraftPort-RP2040 SH1107 1.3 HY2.0-4P RP2040 I2C0 4 5

The module connections are shown in the following table:

Development Board Pins

Module Pins

Description

Pin 4

SDA

I2C data transmission line, corresponding to I2C0 's SDA

Pin 5

SCL

I2C clock signal line, corresponding to the I2C0 SCL

Here, we need to search for the relevant driver packages on uPyPI: https://upypi.net/zh/

106 Python3

Enter sh1107_driver to search, and the following will be displayed:

sh1107_driver 1.0.1 SH1107

Click to copy the local installation command:

sh1107_driver 1.0.1 2024 03 30 1 SH1107

Import the module driver library code via the mip tool. Below are the usage commands for the mpremote tool:

mpremote mip install https://upypi.net/pkgs/sh1107_driver/1.0.0

After importing the 1.3-inch OLED module based on SH1107 - MicroPython driver code, copy the following main.py code into our project:

# Python env   : MicroPython v1.23.0
# -*- coding: utf-8 -*-
# @Time    : 2026/3/16 2:00 PM
# @Author  : peter-l5
# @File    : main.py
# @Description : Drive the SH1107 128x64 OLED display with MicroPython, implementing text display, graphics drawing, contrast adjustment, display inversion, screen flip, scrolling, and power on/off functions

# ======================================== Import Modules =========================================
import sh1107
from machine import I2C, Pin
import time

# ======================================== Global Variables ============================================
# Core changes for 128x64 resolution
I2C_SCL_PIN = 5
I2C_SDA_PIN = 4
I2C_FREQ = 400000
TARGET_OLED_ADDRS = [0x3C, 0x3D]
OLED_WIDTH = 128
OLED_HEIGHT = 64

# ======================================== Initialization configuration ===========================================
time.sleep(3)
print("FreakStudio: SH1107 OLED Display Demo (128x64)")


# Initialize the I2C bus
i2c_bus = I2C(0, scl=Pin(I2C_SCL_PIN), sda=Pin(I2C_SDA_PIN), freq=I2C_FREQ)

# Scan I2C devices
devices_list: list[int] = i2c_bus.scan()
print("START I2C SCANNER")

if len(devices_list) == 0:
    print("No i2c device !")
    raise SystemExit("I2C scan found no devices, program exited")
else:
    print("i2c devices found:", len(devices_list))

# Initialize the OLED
oled = None
for device in devices_list:
    if device in TARGET_OLED_ADDRS:
        print("I2c hexadecimal address:", hex(device))
        try:
            oled = sh1107.SH1107_I2C(OLED_WIDTH, OLED_HEIGHT, i2c_bus, address=device, rotate=0)
            print("SH1107 OLED initialization successful")
            break
        except Exception as e:
            print(f"SH1107 OLED Initialization failed: {e}")
            continue
else:
    raise Exception("No SH1107 OLED device found in I2C bus (target addresses: 0x3c/0x3d)")

# ========================================  Main Program  ============================================
# 1. Initial screen clear
oled.fill(0)
oled.show()
time.sleep(0.5)

# 2. Display text (fit 128x64 coordinates, avoid going off-screen)
oled.fill(0)
oled.text("SH1107 Demo", 10, 10, 1)
oled.text("128x64 OLED", 10, 25, 1)
oled.text("MicroPython", 10, 40, 1)
oled.text("I2C @ 400kHz", 10, 45, 1)
oled.show()
time.sleep(2)

# 3. Draw graphics: fit 128x64 resolution
oled.fill(0)
for x in range(0, OLED_WIDTH, 10):
    for y in range(0, OLED_HEIGHT, 10):
        oled.pixel(x, y, 1)

oled.line(0, 0, OLED_WIDTH - 1, OLED_HEIGHT - 1, 1)  # Main diagonal (0,0)→(127,63)
oled.line(0, OLED_HEIGHT - 1, OLED_WIDTH - 1, 0, 1)  # Anti-diagonal (0,63)→(127,0)

oled.rect(20, 20, 88, 20, 1)  # Rectangle outline: (20,20) width 88 height 20
oled.fill_rect(30, 25, 68, 10, 1)  # Filled rectangle: (30,25) width 68 height 10
oled.text("Graphics", 35, 27, 0)  # Text coordinates fit the filled rectangle
oled.show()
time.sleep(2)

# 4. Adjust contrast (logic unchanged, fit 64-pixel-high screen)
oled.fill(0)
oled.text("Contrast: 255", 10, 10, 1)
oled.show()
oled.contrast(255)
time.sleep(1)

oled.fill(0)
oled.text("Contrast: 32", 10, 10, 1)
oled.show()
oled.contrast(32)
time.sleep(1)
oled.contrast(0x7F)

# 5. Invert display (logic unchanged)
oled.fill(0)
oled.text("Normal Mode", 10, 10, 1)
oled.show()
time.sleep(1)

oled.invert(True)
oled.text("Inverted Mode", 10, 30, 1)
oled.show()
time.sleep(1)
oled.invert(False)
time.sleep(1)

# 6. Flip/rotate display (initialization parameters fit 64 height)
oled.fill(0)
oled.text("Original (0)", 10, 10, 1)
oled.show()
time.sleep(1)

# Use 64 height when initializing rotation
oled = sh1107.SH1107_I2C(OLED_WIDTH, OLED_HEIGHT, i2c_bus, address=device, rotate=90)
oled.fill(0)
oled.text("Rotated 90°", 10, 10, 1)
oled.show()
time.sleep(1)

# Restore original orientation (64 height)

oled = sh1107.SH1107_I2C(OLED_WIDTH, OLED_HEIGHT, i2c_bus, address=device, rotate=0)
time.sleep(1)

# 7. Software scrolling (fit 64 height, scroll range adjusted)
oled.fill(0)
oled.text("Scroll Demo", 10, 30, 1)
oled.show()
time.sleep(1)

# Scroll down (30 iterations is more suitable at 64 height)
for i in range(0, 30):
    oled.scroll(0, 1)
    oled.show()
    time.sleep(0.05)

# Scroll up
for i in range(0, 30):
    oled.scroll(0, -1)
    oled.show()
    time.sleep(0.05)

# 8. Power off/on demo (logic unchanged)
oled.fill(0)
oled.text("Power Off...", 10, 30, 1)
oled.show()
time.sleep(1)

oled.poweroff()
time.sleep(2)

oled.poweron()
oled.fill(0)
oled.text("Power On!", 10, 30, 1)
oled.show()
time.sleep(2)

# Final screen clear
oled.fill(0)
oled.show()

print("SH1107 OLED Demo Completed!")

Burn the code, open the terminal, and the output is as follows:

SH1107 I2C

It can be seen that display functions such as text, graphics, scrolling, and inversion can be demonstrated normally.

IV. Drivers

sh1107_driver-1.0.1.zip 16 KB

None.

6. Revision History

Document Version

Date of Revision

Modifier

Modified Content

v1.0

2026-03-27

Ling Gaoxing

Initialize the document

v1.0.1

2026-04-05

Li Zisheng

The homepage photo has not been taken, the production files have not been exported yet, and all other items have been sorted out completely.

v1.0.2

2026-04-14

Li Zisheng

Modified main.py.

v1.0.3

2026-04-21

Li Zisheng

The production documents have not been exported yet, while all the others have been sorted out completely.

v1.1

2026-04-23

Xin Ruili

Create an open version of the document based on the internal document version v1.0.3.

VII. Relevant Materials

7.1 Chip Datasheet

GME64128-01 1.3-inch Vertical Single Screen Specification.pdf 991 KB

GME64128-02-13P Soldered Long Flex Cable SH1107.pdf 135 KB

7.2 Unique Icons for PCB Silk Screen

SH1107 1.3