Interfacing Oled Display with SPI (and use it with luma.oled)

Post Reply
User avatar
joerg
Posts: 1306
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 82 times
Been thanked: 180 times
Contact:

Interfacing Oled Display with SPI (and use it with luma.oled)

Post by joerg »

I haven't found detailed howto about it, so I write here how to interface a 7-pin oled display with spi interface. Most examples are using I2C interface, what means that the cheap oled displays need to be resoldered. Most of them come with spi interface as default.
Bildschirmfoto vom 2021-02-21 14-36-10.png
Bildschirmfoto vom 2021-02-21 14-36-10.png (25.85 KiB) Viewed 117 times
-Install luma.oled, some dependencies might missing, depending the on your system.
-Install RPI.GPIO for odroid !!after luma.oled, as the spi interface of luma.oled need the gpios RPI.24 and RPI.25, and with luma.oled will be installed the officially RPI.GPIO.
-Install the luma examples.
Here are some commandos I saved from my C1:

Code: Select all

//luma.oled and dependencies
sudo apt-get install python3-dev
sudo pip3 install psutil
sudo pip3 install feedparser
sudo pip3 install luma.oled

//RPi.GPIO-Odroid
git clone https://github.com/awesometic/RPi.GPIO-Odroid
cd RPi.GPIO-Odroid
sudo python3 setup.py build install
cd ..

//luma examples dependencies
sudo apt install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential
sudo apt install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev

//luma examples
git clone https://github.com/rm-hull/luma.examples.git
cd luma.examples
sudo pip3 install -e .
cd examples

//load spi kernel modules
sudo modprobe spidev
sudo modprobe spicc
Finally start a luma.oled example:

Code: Select all

sudo python3 font_awesome.py -i spi --display ssd1309 --spi-bus-speed 4000000
Last to say, that it should run on C1, C4 and N2. On XU4 only with level shifting. On C2 off course not, because missing spi interface.
These users thanked the author joerg for the post (total 2):
odroid (Mon Feb 22, 2021 9:10 am) • Luke.go (Mon Feb 22, 2021 12:01 pm)

User avatar
rooted
Posts: 8422
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 740 times
Been thanked: 329 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by rooted »

Very useful, thank you for the instructions.

fvolk
Posts: 571
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 61 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by fvolk »

joerg wrote:
Sun Feb 21, 2021 11:08 pm
I haven't found detailed howto about it, so I write here how to interface a 7-pin oled display with spi interface.
Thank you for posting this example, this helps a lot for non-hardware people....

Does this mean all the SPI based LCD displays available in the RPi world can be used similarly like this?

User avatar
odroid
Site Admin
Posts: 36919
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1593 times
Been thanked: 1069 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by odroid »

@fvolk,
If you stick to upstream kernel, you need to port the tiny-DRM driver as @tobetter did.

User avatar
joerg
Posts: 1306
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 82 times
Been thanked: 180 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by joerg »

@fvolk, typically this kind of oled displays are meant, that have a 7-pin interface, a ssd1306/1309 chip and they have in description spi/iic.
E.g. like this:
IMG_20210226_124431.jpg
IMG_20210226_124431.jpg (220.9 KiB) Viewed 57 times
This one I have is 2.42" and one color only. It's OLED not LCD.
There are a lot of them on AliExpress or Ebay.
I am planning to use it with Esp32, not with C1. With the C1 I made only a basic test, to see how it is looking.

fvolk
Posts: 571
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 61 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by fvolk »

odroid wrote:
Fri Feb 26, 2021 7:21 pm
If you stick to upstream kernel, you need to port the tiny-DRM driver as @tobetter did.
I have standardised on tobetter's 5.10.x tree on my C2/C4... :-)

fvolk
Posts: 571
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, C4, H2
Has thanked: 0
Been thanked: 61 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by fvolk »

I have a 1.5 OLED laying around, it is wired as SPI default, so this should work as first test?
oled15.jpg
oled15.jpg (68.98 KiB) Viewed 51 times

User avatar
joerg
Posts: 1306
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 82 times
Been thanked: 180 times
Contact:

Re: Interfacing Oled Display with SPI (and use it with luma.oled)

Post by joerg »

Yes, this one should work.

Post Reply

Return to “Ubuntu (All Linux'es)”

Who is online

Users browsing this forum: No registered users and 0 guests