Skip to main content

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

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-mode is enabled
  • Always resets GPIO to OFF on exit

License

MIT


Author: Anthony (anthonyma24.development@gmail.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_temp_gpiod_ctrl-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_temp_gpiod_ctrl-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file auto_temp_gpiod_ctrl-0.1.0.tar.gz.

File metadata

  • Download URL: auto_temp_gpiod_ctrl-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for auto_temp_gpiod_ctrl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b65d458883c91a59ecdab6ad568f8cdc2fa0e645e5fbea4acf35f99603b808f4
MD5 6948e6dff94ffc8f375807971e9e81aa
BLAKE2b-256 978c22073faf67516570615e191cdb37e73cbbff21fd7273e723a3b6c214b3d5

See more details on using hashes here.

File details

Details for the file auto_temp_gpiod_ctrl-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_temp_gpiod_ctrl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fad86a596a2f6d16d208ff23e76b9a8af31fc65aa8f95c548c1962ecae992de3
MD5 a0570c155cd9bdc60d80bbc8c943a0cf
BLAKE2b-256 5ebfe134f3081e8a24b53107dbe0e2838faf2e0c8c8a7042afca69aa03e28208

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page