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.2.tar.gz (9.0 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.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

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

Hashes for auto_temp_gpiod_ctrl-0.1.2.tar.gz
Algorithm Hash digest
SHA256 32128c729a095f7abbe3de3188cd47de34d3bf890f776010a263b58a00bd2727
MD5 ee917ef7ce093e163cda88f580a0cd01
BLAKE2b-256 042309e25f9db13758a9e666bec0395a591b50f1006147f717ff80f5c0cb88a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for auto_temp_gpiod_ctrl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c3aafc34493ee0a5aed5c00486c4c33e4fd3b41b4786d2842edbe4d77d05b33
MD5 c0061652db3836e5ad72cde7f390875c
BLAKE2b-256 74d4d9e3c2a5d01765da94760a85dc8b78d4f5854c9abade7794a995a9b5e9b6

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