rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
367 stars 140 forks source link

SSD1306 on RPI3B+ does not display correctly #121

Closed Mausy5043 closed 4 years ago

Mausy5043 commented 4 years ago

I'm trying to use an SSD1306 on a Raspberry Pi 3B+ with Python3.

I think I've installed all the dependencies. When I run python3 sys_info.py I get this info on the terminal:

Version: luma.oled 3.5.0 (luma.core 1.15.0)
Display: ssd1306
Interface: i2c
Dimensions: 128 x 64
------------------------------------------------------------

The display then flashes a line of static at the top and a couple of pixellines at the bottom every 5 seconds. If I look really hard I think it looks like text. But it's gone in a second.

What might I have missed?

Some version info:

$ python3 
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux

$ python3 -m pip freeze
Adafruit-bitfield==1.5.1
Adafruit-Blinka==5.3.0
Adafruit-BMP==1.5.4
Adafruit-CCS811==0.2.1
adafruit-circuitpython-bmp280==3.2.3
adafruit-circuitpython-busdevice==5.0.1
adafruit-circuitpython-ccs811==1.3.0
adafruit-circuitpython-register==1.9.0
adafruit-circuitpython-sht31d==2.3.2
Adafruit-GPIO==1.0.3
Adafruit-PlatformDetect==2.15.0
Adafruit-PureIO==1.1.5
Adafruit-SHT31==1.0.2
argcomplete==1.12.0
asn1crypto==0.24.0
certifi==2020.6.20
click==7.1.2
cryptography==2.6.1
cycler==0.10.0
entrypoints==0.3
Flask==1.1.2
importlib-metadata==1.7.0
itsdangerous==1.1.0
Jinja2==2.11.2
keyring==17.1.1
keyrings.alt==3.1.1
kiwisolver==1.2.0
luma.core==1.15.0
luma.emulator==1.3.0
-e git+https://github.com/rm-hull/luma.examples.git@5be97797b75c6545ab8ad72cb401e3691e7a3295#egg=luma.examples
luma.lcd==2.4.0
luma.led-matrix==1.5.0
luma.oled==3.5.0
MarkupSafe==1.1.1
matplotlib==3.3.1
mausy5043-common-python==0.6.0
numpy==1.19.1
Pillow==7.2.0
psutil==5.7.2
pycrypto==2.6.1
pyftdi==0.51.2
pygame==1.9.6
PyGObject==3.30.4
pyparsing==2.4.7
pyserial==3.4
python-dateutil==2.8.1
python-dotenv==0.14.0
pyusb==1.0.2
pyxdg==0.25
PyYAML==3.13
rpi-ws281x==4.2.4
RPi.GPIO==0.7.0
SecretStorage==2.3.1
six==1.12.0
smbus2==0.3.0
spidev==3.4
sysv-ipc==1.0.1
uWSGI==2.0.19.1
Werkzeug==1.0.1
ws2812==1.0.0
zipp==3.1.0

$ dmesg |head
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.51-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1333 SMP Mon Aug 10 16:45:19 BST 2020
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Plus Rev 1.3
rm-hull commented 4 years ago

Could you try the demo.py example script? If you see something on the screen and can take a photo please do.

I take it you are connecting via I2C ? Do you have a url link to the device you bought ?

Mausy5043 commented 4 years ago

Could you try the demo.py example script? If you see something on the screen and can take a photo please do.

Photo is here

I take it you are connecting via I2C ?

correct.

 $ python3 demo.py
Version: luma.oled 3.5.0 (luma.core 1.15.0)
Display: ssd1306
Interface: i2c
Dimensions: 128 x 64
------------------------------------------------------------
Testing basic canvas graphics...
Testing contrast (dim/bright cycles)...
Testing display ON/OFF...
Testing clear display...
Testing screen updates...

Do you have a url link to the device you bought ?

This is the device i bought

rm-hull commented 4 years ago

That oled is 128x96 pixels. Try adding --height=96 --width=128 when you run the script

Mausy5043 commented 4 years ago

That oled is 128x96 pixels. Try adding --height=96 --width=128 when you run the script

I don't think so: demo.py: error: Unsupported display mode: 128 x 96

Mausy5043 commented 4 years ago

This led me to try this:

$ python3 demo.py -d sh1106
Version: luma.oled 3.5.0 (luma.core 1.15.0)
Display: sh1106
Interface: i2c
Dimensions: 128 x 64
------------------------------------------------------------
Testing basic canvas graphics...
Testing contrast (dim/bright cycles)...
Testing display ON/OFF...
Testing clear display...
Testing screen updates...

Which produces this picture

Thanks for your fast support.