Raspberry 4B-DietPi-1,3" OLED Display

Guides and tutorials for various stuff. Posted by DietPi users.
Post Reply
joerg
Posts: 4
Joined: Fri Aug 06, 2021 3:53 pm

Raspberry 4B-DietPi-1,3" OLED Display

Post by joerg »

Hello,
I would like to control a 1.3" OLED display via the i2c interface of the Raspberry 4B.
It should be a status display of the Pi.
Can someone tell me how to proceed with the installation.
I have instructions for an installation, but I do not know how to load the files.
Where do I have to activate the interface and how can I use Sudo to load and install the files.
How can I run the following commands:

Code: Select all

sudo raspi-config
Now we select under "Interfacing Options" the item "I2C" and confirm with <Yes>.
After that we need some system programs:
sudo apt-get install -y python-dev python3-dev python-imaging python-smbus i2c-tools git python3-pip python-setuptools build-essential git-core libi2c-dev i2c-tools lm-sensors python-pip
With the command i2cdetect -y 1 we get the following output if the display was wired correctly:
If the display was successfully detected, we can now download and install the required libraries:
git clone git://github.com/rm-hull/ssd1306.git
cd ssd1306
sudo python setup.py install
cd examples
git clone https://github.com/rm-hull/luma.examples.git
cd luma.examples/examples
If all this is done now we can start different demos:
Analog clock with date python clock.py --display sh1106
Text and logo (animated) python crawl.py --display sh1106
3D animation python sprite_animation.py --display sh1106
gif (animated) player python animated_gif.py --display sh1106
To display system info we need psutil:
sudo pip install psutil
python sys_info.py --display sh1106
I look forward to your answers and greetings to all
Joerg
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by Joulinar »

Hi,

basically these are all commaned you need to enter into command line while connected via SSH or locally. Basically you should be able to simply copy/past them

But there is one limitation. The tool raspi-config did not exist on DietPi by default, because the package is simply not installed.
You could use dietpi-config > 4 : Advanced Options to activate I2C
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
joerg
Posts: 4
Joined: Fri Aug 06, 2021 3:53 pm

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by joerg »

Hello all,

how do I enter the commands then?
Whenever it wants to access Github I get an error message.
I would be very happy about more Hilse.
Thanks and many greetings
Joerg
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by Joulinar »

Can you be specific on the error you are facing?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
joerg
Posts: 4
Joined: Fri Aug 06, 2021 3:53 pm

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by joerg »

Hello all
I am one step further after entering all the commands one by one.

Now I am at a point where I should install the following:

sudo -H pip3 install luma.oled
I am logged in as root, so I don't need sudo.
But when i drag&drop the command i get an error

-bash: -H: command not found

Then in the folder oled ( is created) I have to use the command

git clone
https://github.com/rm-hull/luma.examples

root@Fileserver:~# git clone
fatal: You must specify a repository to clone.

usage: git clone [<options>] [--] <repo> [<dir>]

-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
--mirror create a mirror repository (implies bare)
-l, --local to clone from a local repository
--no-hardlinks don't use local hardlinks, always copy
-s, --shared setup as shared repository
--recurse-submodules[=<pathspec>]
initialize submodules in the clone
-j, --jobs <n> number of submodules cloned in parallel
--template <template-directory>
directory from which templates will be used
--reference <repo> reference repository
--reference-if-able <repo>
reference repository
--dissociate use --reference only while cloning
-o, --origin <name> use <name> instead of 'origin' to track upstream
-b, --branch <branch>
checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
path to git-upload-pack on the remote
--depth <depth> create a shallow clone of that depth
--shallow-since <time>
create a shallow clone since a specific time
--shallow-exclude <revision>
deepen history of shallow clone, excluding rev
--single-branch clone only one branch, HEAD or --branch
--no-tags don't clone any tags, and make later fetches not to follow them
--shallow-submodules any cloned submodules will be shallow
--separate-git-dir <gitdir>
separate git dir from working tree
-c, --config <key=value>
set config inside the new repository
-4, --ipv4 use IPv4 addresses only
-6, --ipv6 use IPv6 addresses only
--filter <args> object filtering

what am i doing wrong?
Thanks all
Joerg
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by Joulinar »

-H option is related to the use of sudo. Means you would need to use sudo as root user as well or you leave -H out.

To clone a git repository, you would need to put a .git at the end of the URL
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
joerg
Posts: 4
Joined: Fri Aug 06, 2021 3:53 pm

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by joerg »

hello all
first a thank you to Joulinar for the help so far.
I am a little further, but it still does not work as desired.

how can i delete a complete with content?
the command rmdir does not work:
rmdir: failed to remove '/pi': No such file or directory
My thought was to delete the created folders and then redo everything.

I attach the manual I got with my display. The display is recognized correctly.
Maybe you can help me.
Under the normal Raspian it worked.

Here are the instructions:
Python-library
For the display of shapes, text and images we will use a Pythonlibrary
to use. On the current Raspberry Pi OS Python3, pip3
and git are already preinstalled, but if this is not the case, you can
you can install it with the following commands:
sudo apt-get install python3-dev libffi-dev libssl-dev
python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev
liblcms2-dev libopenjp2-7 libtiff5 -y
sudo apt-get install python3-rpi.gpio python3-pip -y
sudo apt-get install git -y
As library we use the "luma.oled" this can be installed with the following
command to install it:
sudo -H pip3 install luma.oled
Python script
In the folder "pi" we now create a folder named "oled" and
go to this folder
sudo mkdir oled
cd oled
luma.oled offers many examples and we can download them with the following
command to download them:
sudo git clone
https://github.com/rm-hull/luma.examples
with:
cd luma.examples/examples/
we change to the folder where the examples are located.
with:
python3 demo.py
we can start one of the examples. If there is a white noise on the display
white noise on the display, we have to pass the correct controller.
this can be done with:
python3 demo.py --device [controller]
luma.oled takes the SSD1306 by default, if you have for example
SH1106 the start of the script would look like this:
python3 demo.py --device ssh1106
There are more examples in the folder.
With the command:
ls -a
you can see them.
Try more examples.
With:
sudo nano [example script]
you can edit the scripts.

Thanks a lot
Joerg
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: Raspberry 4B-DietPi-1,3" OLED Display

Post by Joulinar »

Not sure what you are trying to delete. Is this the cloned directory from GitHub? If yes, probably you stored it on the home directory of the user you are logged in.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply