I2C is the simplest interface for connecting an OLED display. It requires only four connections — power, ground, clock (SCL), and data (SDA) — making it the easiest choice for most projects. Because the two signal lines are shared among all devices on the bus, you can attach multiple I2C devices without using additional GPIO pins.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rm-hull/luma.oled/llms.txt
Use this file to discover all available pages before exploring further.
Pin connections
Connect the display to the Raspberry Pi P1 header as follows:| Device Pin | Name | Remarks | RPi Pin | RPi Function |
|---|---|---|---|---|
| 1 | GND | Ground | P01-6 | GND |
| 2 | VCC | +3.3V Power | P01-1 | 3V3 |
| 3 | SCL | Clock | P01-5 | GPIO 3 (SCL) |
| 4 | SDA | Data | P01-3 | GPIO 2 (SDA) |
On rev.2 Raspberry Pi boards, there is also a bare P5 header next to the P1 header that exposes I2C channel 0 on GPIO 28 (SDA) and GPIO 29 (SCL). This channel is not enabled by default and may be reserved for the camera module.
Enable I2C on Raspberry Pi OS
The I2C kernel driver is not always enabled by default. Follow these steps to enable it:Enable I2C
Arrow down to I2C and select yes when asked to enable it. Also select yes when asked about automatically loading the kernel module.
Increase baudrate (optional)
By default, I2C runs at 100 KHz. To improve display update performance, increase the baudrate to 400 KHz by editing/boot/config.txt:
Add user to the i2c group
Find the device address
Usei2cdetect to confirm your display is connected and to find its I2C address (use bus 0 on rev.1 boards):
0x3c. If multiple addresses appear, check your display’s documentation to identify which one corresponds to it.
Initialize the interface in Python
Pass the bus port number and the address detected above to thei2c interface class: