Automatic temperature-based GPIO control for any libgpiod 2.x device.
Project description
Auto Temp GPIOd Control
Automatic temperature-based GPIO control for any device with libgpiod 2.x support.
Features
- Monitors all available temperature sensors using
psutil - Controls a GPIO pin based on user-defined temperature thresholds
- Displays a live, aligned temperature table in the terminal
- Optional test mode to simulate CPU load for thermal testing
- Clean startup/shutdown: always resets GPIO to OFF on exit
Requirements
- Python 3.7+
- libgpiod 2.x and its Python bindings
- psutil
Installation
Install via pip (recommended):
pip install auto-temp-gpiod-ctrl
Or from source:
git clone https://github.com/Anthony-s-Personal-Projects/orange-pi-zero-auto-temp-ctrl.git
cd orange-pi-zero-auto-temp-ctrl
pip install .
Usage
Run the controller with your desired parameters:
python -m auto_temp_gpiod_ctrl --on-temp 50 --off-temp 45 --soc-pin PH2
Or, if installed as a script:
auto-temp-gpiod-ctrl --on-temp 50 --off-temp 45 --soc-pin PH2
Parameters
-i,--interval: Seconds between temperature checks and table refresh (default: 5.0)--soc-pin: SoC pin spec to control (e.g. H2, PH2)-c,--chip: GPIO chip device (e.g. gpiochip0 or /dev/gpiochip1, default: gpiochip0)--on-temp: Threshold to turn ON GPIO (≥ this temperature, required)--off-temp: Threshold to turn OFF GPIO (≤ this temperature, required)--test-mode: Enable heavy calculation simulation (for testing only)
Example
python -m auto_temp_gpiod_ctrl --on-temp 60 --off-temp 50 --soc-pin PH2 --test-mode
How it works
- Reads all temperature sensors and displays a live table
- Monitors the maximum temperature
- Sends GPIO output HIGH when max_temp ≥ on_temp, LOW when max_temp ≤ off_temp
- Optionally simulates CPU load if
--test-modeis enabled - Always resets GPIO to OFF on exit
License
MIT
Author: Anthony (anthonyma24.development@gmail.com)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auto_temp_gpiod_ctrl-0.1.2.tar.gz.
File metadata
- Download URL: auto_temp_gpiod_ctrl-0.1.2.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32128c729a095f7abbe3de3188cd47de34d3bf890f776010a263b58a00bd2727
|
|
| MD5 |
ee917ef7ce093e163cda88f580a0cd01
|
|
| BLAKE2b-256 |
042309e25f9db13758a9e666bec0395a591b50f1006147f717ff80f5c0cb88a5
|
File details
Details for the file auto_temp_gpiod_ctrl-0.1.2-py3-none-any.whl.
File metadata
- Download URL: auto_temp_gpiod_ctrl-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3aafc34493ee0a5aed5c00486c4c33e4fd3b41b4786d2842edbe4d77d05b33
|
|
| MD5 |
c0061652db3836e5ad72cde7f390875c
|
|
| BLAKE2b-256 |
74d4d9e3c2a5d01765da94760a85dc8b78d4f5854c9abade7794a995a9b5e9b6
|