Radxa Penta SATA HAT controller on ROCK 5C

Local ROCK 5C setup for the Radxa Penta SATA HAT Top Board.

It runs the existing Python OLED/fan controller as a systemd service and can export fan/temperature state through node_exporter's textfile collector.

ROCK 5C hardware setup

The current host uses these device-tree overlays:

  • rk3588-i2c8-m2
  • rk3588-pwm14-m1

The OLED is an SSD1306 on /dev/i2c-8 at address 0x3c. The HAT fan uses hardware PWM exposed as /sys/class/pwm/pwmchip1/pwm0.

Copy the board environment before starting the service:

cp .env.example .env

The service intentionally runs as root because the controller needs I2C, GPIO and PWM access.

Dependencies

Ubuntu packages:

sudo apt install python3-virtualenv python3-libgpiod gpiod

Create the virtualenv with system packages available and install Python dependencies:

virtualenv --system-site-packages .venv
.venv/bin/pip install -r requirements.txt

systemd

The unit currently assumes this repository is located at /home/ubuntu/radxa-hat.

sudo cp radxa-hat.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now radxa-hat.service
systemctl status radxa-hat.service

Prometheus / node_exporter

export-prometheus.sh writes /var/lib/node_exporter/textfile_collector/radxa_hat.prom.

The exported values include:

  • radxa_hat_service_up
  • radxa_hat_oled_i2c_present
  • radxa_hat_cpu_temperature_celsius
  • radxa_hat_pwm_duty_ratio — raw kernel PWM duty
  • radxa_hat_fan_command_ratio — effective fan command, corrected for the inverted HAT PWM mapping

Install the timer with:

sudo cp radxa-hat-metrics.service radxa-hat-metrics.timer /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now radxa-hat-metrics.timer

The timer refreshes metrics every 15 seconds.

Description
No description provided
Readme 971 KiB
Languages
Python 82.8%
Shell 17.2%