This page covers the most common issues encountered when setting up and running luma.oled displays. Each section describes a symptom, explains the likely cause, and provides steps to resolve it.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.
Always verify that VCC and GND are connected to the correct pins before debugging software issues. Reversed polarity can permanently damage your display.
Corrupted display due to wrong driver
Corrupted display due to wrong driver
Using the
ssd1306 driver on a display that has an SH1106 controller results in a small section of the expected output appearing correctly, while the rest of the display shows semi-random pixels (uninitialized memory). This is caused by differences in the required initialization sequences and how memory is mapped in the two controllers.To fix this, use the sh1106 device class instead:Display shows nothing
Display shows nothing
A blank display is most commonly caused by one of the following:Pass the detected address explicitly when creating the device:
- Wrong I2C address — the default address is
0x3C, but some displays use0x3D. Runi2cdetect -y 1to confirm the address your display is responding on. - I2C not enabled — on Raspberry Pi, I2C must be enabled via
raspi-configunder Interface Options. - Wiring issue — double-check that SDA, SCL, VCC, and GND are all connected securely to the correct GPIO pins.
Program ends before image is visible
Program ends before image is visible
When a Python script exits, the display is cleared. If your script draws to the display and then returns immediately, the output disappears before you can see it. Add a
sleep() call to keep the program running long enough to observe the output:I2C not detected
I2C not detected
If
i2cdetect shows no devices, work through the following checks:- Confirm I2C is enabled in
raspi-configunder Interface Options → I2C. - Reboot after enabling I2C for the change to take effect.
- Check
dmesgfor I2C-related errors:
- Verify your wiring — SDA to GPIO 2 (pin 3), SCL to GPIO 3 (pin 5) on a Raspberry Pi.
- Try a lower I2C bus speed if the display is on long wires.
SPI permission denied
SPI permission denied
If you receive a permission error when opening Also confirm that SPI is enabled in
/dev/spidev*, your user account is not in the spi group. Add your user and log out and back in for the change to apply:raspi-config under Interface Options → SPI.ImportError for luma
ImportError for luma
If Python raises If you are using a virtual environment, make sure it is activated before installing or running your script:Avoid installing with
ImportError: No module named luma, the library is not installed in the active Python environment. Install it with pip:sudo pip when running scripts as a regular user, as this can cause environment mismatches.