I got the Pironman 5 OLED working on Android 16 using Termux with a Python system monitor (CPU, RAM, Disk bars).
Install Termux from the play store or aptoid
!Some commands may or may not need to be ran as sudo!
SETUP:
pkg update -y
pkg upgrade -y
pkg install -y python
pkg install -y clang
pkg install -y libjpeg-turbo
pkg install -y libpng
pkg install -y zlib
pip install pillow
pip install luma.oled
pip install psutil
CREATE SCRIPT:
sudo nano /data/data/com.termux/files/home/oled_test.py
PASTE THIS: use all of it to where it ends at the line of asterisks*
import psutil
import time
from luma.oled.device import ssd1306
from luma.core.interface.serial import i2c
from PIL import Image, ImageDraw, ImageFont
# OLED setup
serial = i2c(port=1, address=0x3C)
device = ssd1306(serial)
# Display layout
WIDTH = 128
HEIGHT = 64
BAR_X = 72
BAR_WIDTH = 50
BAR_HEIGHT = 8
font = ImageFont.load_default()
last_values = None
# Prime CPU reading
psutil.cpu_percent(interval=None)
# Get CPU temperature
def get_cpu_temp():
try:
with open("/sys/devices/virtual/thermal/thermal_zone0/temp", "r") as f:
temp = int(f.read()) / 1000.0
return temp
except:
return 0.0
# Draw bar function
def draw_bar(draw, label, value, y, display_value=None, unit=“%”):
percent = max(0, min(int(value), 100))
filled = int((percent / 100) \* BAR_WIDTH)
filled = max(filled, 1)
\# Text display
if display_value is None:
text = f"{label} {percent}{unit}"
else:
text = f"{label} {display_value}{unit}"
draw.text((0, y), text, font=font, fill=255)
\# Bar outline
draw.rectangle((BAR_X, y, BAR_X + BAR_WIDTH, y + BAR_HEIGHT), outline=255, fill=0)
\# Bar fill
right_edge = max(BAR_X + filled - 1, BAR_X + 1)
draw.rectangle((BAR_X + 1, y + 1, right_edge, y + BAR_HEIGHT - 1), fill=255)
# Main loop
while True:
cpu = int(psutil.cpu_percent(interval=None))
ram = int(psutil.virtual_memory().percent)
disk = int(psutil.disk_usage('/storage/emulated/0').percent)
\# Temperature
temp_c = get_cpu_temp()
THROTTLE_TEMP = 80
temp_percent = int(max(0, min((temp_c / THROTTLE_TEMP) \* 100, 100)))
values = (cpu, ram, disk, temp_percent)
if values != last_values:
image = Image.new("1", (WIDTH, HEIGHT), 0)
draw = ImageDraw.Draw(image)
draw_bar(draw, "CPU", cpu, 2)
draw_bar(draw, "RAM", ram, 18)
draw_bar(draw, "DSK", disk, 34)
draw_bar(draw, "TMP", temp_percent, 50, int(temp_c), "C")
device.display(image)
last_values = values
time.sleep(2)
**********************************************************************
RUN:
sudo python /data/data/com.termux/files/home/oled_test.py
AUTO START ON BOOT:
pkg install -y termux-api
mkdir -p ~/.termux/boot
sudo nano ~/.termux/boot/oled.sh
PASTE:
#!/data/data/com.termux/files/usr/bin/bash
sleep 10
sudo python /data/data/com.termux/files/home/oled_test.py
MAKE EXECUTABLE:
chmod +x ~/.termux/boot/oled.sh
NOTES:
-
Disk is using /storage/emulated/0
-
Temp is placeholder (0 for now)
-
sleep 10 helps prevent startup conflicts
-
I have found that if the OLED is flashing or acting weird after editing it the script for it, usually restarting android itself helps
-
Some commands may or may not need to be ran as sudo
-
My next project is to get the LED’s working
This is a generated pic of what it will look like, the temperature bar is from 0-80c and 100% represents thermal throttling.
