NanoCtl is a CLI tool and daemon for managing Nano Cluster nodes (CM5). It handles power management via GPIO and intelligent fan control using PID algorithms.
- Power Management: Power On, Graceful Shutdown, Force Off, and Reset for CM5 nodes.
- Smart Fan Control: PID-based PWM fan control to maintain target temperatures.
- Metrics: Push fan & temp metrics to Prometheus/OpenTelemetry (OTLP) with Basic Auth support.
- Cluster Aware: Can read temperatures from a Prometheus server to control fans based on cluster-wide metrics.
- Native: Written in Go, single binary, no external runtime dependencies.
Run this command on your Raspberry Pi/CM5 to install NanoCtl and enable the fan service automatically:
curl -fsSL https://raw.githubusercontent.com/AlejandroPerez92/nanoctl/main/install.sh | sudo bash- Installation Guide - Manual installation & building from source.
- Configuration Guide -
fan.yamloptions, GPIO, and PID tuning. - Metrics & Prometheus - Setting up OTLP push and Prometheus pull.
- Command Reference - List of all CLI commands.
Power Control:
sudo nanoctl poweron 2 # Power on slot 2
sudo nanoctl poweroff 2 # Graceful shutdown slot 2
sudo nanoctl reset 2 # Reset slot 2Service Management:
sudo systemctl status nanoctl-fan # Check fan status
sudo journalctl -u nanoctl-fan -f # View logsNanoCtl supports hardware PWM via sysfs for CM5 fan control, including inverted PWM (high=0%, low=100%).
Edit the boot config file and add the overlays below:
sudo nano /boot/firmware/config.txtAdd:
dtoverlay=dwc2,dr_mode=host
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4Reboot after saving.
Use this fan.yaml snippet:
pwm:
mode: "hardware"
frequency_khz: 25
hardware:
chip: "pwmchip0"
channel: 1
inverted: trueNotes:
frequency_khzdefaults to 25 if omitted.inverted: truemaps high=0% and low=100% for inverted fans.channel: 1corresponds to/sys/class/pwm/pwmchip0/pwm1.
This tool is designed for the Sipeed Nano Cluster hardware.
- Manufacturer: Sipeed
- Hardware Wiki: Nano Cluster Wiki
MIT
