{"id":15931643,"url":"https://github.com/snapstromegon/fan_control","last_synced_at":"2026-05-17T18:03:31.858Z","repository":{"id":101603809,"uuid":"419053750","full_name":"Snapstromegon/fan_control","owner":"Snapstromegon","description":"SysFS fan control written in Rust, primarily for Raspberry Pis.","archived":false,"fork":false,"pushed_at":"2021-11-01T15:56:19.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T14:26:36.567Z","etag":null,"topics":["fan-control","raspberry-pi","raspberry-pi-4","rust","rust-lang","sysfs","sysfs-gpio"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Snapstromegon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-19T18:52:37.000Z","updated_at":"2021-11-01T15:56:22.000Z","dependencies_parsed_at":"2023-06-06T11:00:14.948Z","dependency_job_id":null,"html_url":"https://github.com/Snapstromegon/fan_control","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"f2a0c60b03ce9d64fac68b41b296926e9419228b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Snapstromegon/fan_control","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapstromegon%2Ffan_control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapstromegon%2Ffan_control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapstromegon%2Ffan_control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapstromegon%2Ffan_control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snapstromegon","download_url":"https://codeload.github.com/Snapstromegon/fan_control/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapstromegon%2Ffan_control/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264637708,"owners_count":23642038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fan-control","raspberry-pi","raspberry-pi-4","rust","rust-lang","sysfs","sysfs-gpio"],"created_at":"2024-10-07T01:21:49.920Z","updated_at":"2026-05-17T18:03:26.822Z","avatar_url":"https://github.com/Snapstromegon.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fan Control\r\n\r\nThis is a fan control for a Raspberry PI based on the SYSFS interface.\r\nIt should be compatible with any SYSFS compatible system which exposes the GPIO pins and thermal zones.\r\n\r\n## Hardware Setup\r\n\r\n![Raspberry Pi Board Pin Overview](https://www.raspberrypi.com/documentation/computers/images/GPIO-Pinout-Diagram-2.png)\r\n\r\n![Raspberry Pi 40 Pin GPIO Pinout](https://www.raspberrypi.com/documentation/computers/images/GPIO.png)\r\n\r\nI'm using these fan heatsinks for my Pis: [Amazon](https://www.amazon.de/dp/B07VD6NC8P/ref=cm_sw_em_r_mt_dp_THBAEA29Y04XN7V86SXB) / [Reichelt](https://www.reichelt.de/gehaeuse-fuer-raspberry-pi-4-alu-luefter-schwarz-rpi-case-alu07f-p261678.html?)\r\n\r\nYou connect the red wires from the fans to one of the two red pins from the Pi.\r\nThe black wire from the fan gets cut in the middle and the part connected to the fan gets soldered to the _emitter_ pin of a transistor and the part leading to the Pi to the _collector_ pin of the transistor.\r\nFinally connect the _base_ pin of the transistor to any GPIO pin (I used 23 and grabbed ground from the one next to it) with a resistor in between (I used a 1k Ohm one).\r\n\r\n## Software Setup\r\n\r\n### Get Binary\r\n\r\n#### Download Release for your system\r\n\r\nI currently publish 64 Bit Arm binarys, since I'm developing this for my Pi 4s.\r\n\r\n| System              | Release Binary                                                                                           |\r\n| :------------------ | :------------------------------------------------------------------------------------------------------- |\r\n| Raspberry Pi 64 Bit | [fan_control](https://github.com/Snapstromegon/fan_control/releases/latest/download/fan_control) |\r\n\r\n#### Self Compile\r\n\r\n##### Install Rust (with rustup)\r\n\r\n```sh\r\n$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\r\n```\r\n\r\n##### Download or clone Sourcecode\r\n\r\nDownload the source from either the release, or the master of this repo.\r\n\r\n```sh\r\n$ git clone git@github.com:Snapstromegon/fan_control.git\r\n$ cd fan_control\r\n```\r\n\r\n##### Compile\r\n\r\nInside of the project folder run:\r\n\r\n```sh\r\n$ cargo build --release\r\n```\r\n\r\n(Resulting binary will be $pwd/target/aarch64-unknown-linux-gnu/release/fan_control)\r\n\r\n### Copy Binary and Systemd service\r\n\r\nCopy the fan*control bin to */opt/fan*control* and the _fan_control.service_ (example in this repo) to _/etc/systemd/system/fan_control.service_.\r\n\r\n### Configure\r\n\r\nYou can either configure the program via anfironment variables or command line arguments (for both, check `fan_control --help`).\r\n\r\nYou can configure:\r\n\r\n- **GPIO Pin:** The pin which is used to turn the fan on/off\r\n- **Thermometer Path:** SysFS path of the thermometer (should result in °C\\*1000 - so 40000 = 40°C)\r\n- **Fan On Temperature:** When should the fan kick in\r\n- **Fan Off Temperature:** When should the fan turn off again\r\n- **Log Level:** Use the _RUST_LOG_ environment variable to change the log level. The default is \"info\".\r\n\r\n### Enable Systemd service\r\n\r\n```sh\r\n$ systemctl enable --now fan_control\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapstromegon%2Ffan_control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnapstromegon%2Ffan_control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapstromegon%2Ffan_control/lists"}