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.1.tar.gz (8.7 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.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: auto_temp_gpiod_ctrl-0.1.1.tar.gz
  • Upload date:
  • Size: 8.7 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.1.tar.gz
Algorithm Hash digest
SHA256 a7577e48e3434ed78a103dbdbc8f326c72fc1f319e25fc0204e61cd435d777bf
MD5 19bf5dfd602c4e93ce271870e7aee2a9
BLAKE2b-256 ca73621a18fd313f1f70eda2e7773593bdcae65392679e5b604096ff2a84b064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for auto_temp_gpiod_ctrl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f5bb034dff1f3768de52d79eccd990f4c873c02877a0e1d765a29e61dd2c239
MD5 7f5b735bfa14af99b16dbfcdf15f0215
BLAKE2b-256 2c3d19ab80a99c80656f0b4b1154db6adf9765a9c41af800aea31636708a500b

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