Alternative 'lite' utilities for Pironman 5 case

I absolutely love the Pironman 5 case for the RPi5, however the expansive set of heavy python scripts in a virtual environment with a public network facing port all running as root was something I was uncomfortable with.

So I ended up sitting down and writing some alternative utilities, one just to control the ‘LED strip’ on the IO expander, and another for rendering status updates on the OLED display.

This is very much a “v0.0.1” alpha release, however it’s minimally feature-complete, with the monitoring tool using lua scripting to specify what to render and where so you can change to a large degree what’s shown, and the ‘leds’ tool likewise works quite well to easily and quickly control the LEDs to call from other scripts to use as notification alerts or similar.

I need to add image loading support to allow changing the ‘image masks’ applied to the rendered OLED display, and more graphics primitives for the Lua scripting to be able to take advantage of, but I felt this had reached the point it was useful enough to share a link to the github repo for other Pironman 5 users.

https://github.com/WolfWings/pironman5-lite/

I’ll update this topic as I update the repo, but in the meantime I hope it’s useful to someone else as well.

So at this point I’ve finished updating the repository with enough additional features (including optional ‘sixel’ rendering of the OLED output on the console for easier remote testing of screen layouts) and the code has been cleaned up enough I’m bumping the ‘version’ from v0.0.1 to v0.1.0 and figured I’d update here.

screenshot

It now supports the following ‘sensors’ directly:

  • CPU temperature
  • CPU usage (calculated as ‘100% - idle’ every second over a 5-second window for simplicity)
  • Disk usage (broken down by every mounted filesystem from /dev based on statvfs() )
  • The current time, with the os.date() function enabled for time formatting

For rendering it is a little more limited there, but supports:

  • Text printing in 5x8, 8x16, 12x24, and 16x32 fonts.
  • Rectangle fill and erase commands.
  • Stripe-aligned Rectangle copy commands (to implement scrolling one frame to the next)
  • A static final ‘overlay’ which can have any pixels forced on, forced off, or left alone

The ‘overlay’ is implemented from a basic text file for simplicity, and the scripting built around Lua, specifically LuaJIT so the Lua 5.1 dialect that most are familiar with, as an example here is the default built-in script that generates the above rendering:

oled.print( 24,  0, string.format( '%4.1fC', sensors.temperature ), 3 )
oled.print( 24, 24, string.format( '%7.3fF', ( sensors.temperature * 1.8 ) + 32 ), 2 )
oled.print( 26, 40, string.format( '%3i%% CPU', sensors.cpu ), 1 )
oled.print( 26, 48, string.format( '%3i%% used /', ( sensors.disk[ '/' ].total - sensors.disk[ '/' ].free ) * 100 / sensors.disk[ '/' ].total ), 1 )
oled.print( 26, 56, os.date( '%d-%b %H:%M', sensors.time ), 1 )
oled.copyrect( 96, 0, 126, 63, -1, 0 )
oled.eraserect( 126, 0, 126, 63 )
oled.fillrect( 126, 64 - ( sensors.cpu * 0.60 ), 126, 63 )
oled.fillrect(   1, 84 - sensors.temperature, 23, 63 )

I’m working on a proper SystemD unit file next and installation scripts/packaging at this point, and if anyone can suggest additional ‘sensors’ to add I’m happy to do so but this is fairly complete and usable at this point including on more than just the Pironman 5 cases but anything that has one of these 128x64 SSD1306 based OLED screens.

1 Like