OLED Stats Display Script For Raspberry Pi
Full setup instructions available on my blog - https://www.the-diy-life.com/add-an-oled-stats-display-to-raspberry-pi-os-bullseye/ Or my Youtube Channel - https://youtu.be/lRTQ0NsXMuw
The script is pre-configured for 128x64 I2C OLED Display, but can easily be modified to run on a 128x32 I2C OLED Display
stats.py | monitor.py |
---|---|
- Connect GND, VCC(3.3v), SCL, & SDA ports of the display according to the picture shown below:
- Upgrade your Raspberry Pi firmware and reboot:
$ sudo apt-get update
$ sudo apt-get full-upgrade
$ sudo reboot
- Install python3-pip & upgrade the setuptools
$ sudo apt-get install python3-pip
$ sudo pip3 install --upgrade setuptools
- Next, we’re going to install the Adafruit CircuitPython library using the following commands:
$ cd ~
$ sudo pip3 install --upgrade adafruit-python-shell
$ sudo reboot
$ wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/raspi-blinka.py
$ sudo python3 raspi-blinka.py
- Check the
I2C
status using the command:
$ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
- Next, we need to install the CircuitPython libraries specific to the display. Start by entering the following commands:
$ pip3 install adafruit-circuitpython-ssd1306
$ pip3 install psutil
$ pip3 install pillow
- Now we need to download the python script from out github:
$ git clone https://github.com/amphancm/OLED_Stats.git
$ source .venv/bin/activate
$ cd OLED_Stats
$ python3 stats.py
$ python3 psutilstats.py
$ python3 monitor.py
If your display shows jumbled pixels/symbols instead of actual text - you may have a display which supports the SH1106 driver instead of more common SSD1306 driver. This script ONLY works for SSD1306 displays. If you have this issue, follow this guide instead: https://www.youtube.com/watch?v=LdOKXUDw2NY