{"id":19712234,"url":"https://github.com/jokerqyou/fanctl","last_synced_at":"2026-05-17T11:32:57.762Z","repository":{"id":70366516,"uuid":"268762045","full_name":"JokerQyou/fanctl","owner":"JokerQyou","description":"A simple thermal fan controller for Raspbian","archived":false,"fork":false,"pushed_at":"2020-07-03T06:55:47.000Z","size":16,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T04:33:11.726Z","etag":null,"topics":["c","fan","raspberry-pi","raspbian","temperature-control"],"latest_commit_sha":null,"homepage":"https://blog.mynook.info/post/rpi-gpio-thermal-fan/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JokerQyou.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":"2020-06-02T09:48:04.000Z","updated_at":"2021-01-20T11:30:16.000Z","dependencies_parsed_at":"2023-02-27T12:46:21.453Z","dependency_job_id":null,"html_url":"https://github.com/JokerQyou/fanctl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JokerQyou/fanctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JokerQyou%2Ffanctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JokerQyou%2Ffanctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JokerQyou%2Ffanctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JokerQyou%2Ffanctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JokerQyou","download_url":"https://codeload.github.com/JokerQyou/fanctl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JokerQyou%2Ffanctl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33136737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","fan","raspberry-pi","raspbian","temperature-control"],"created_at":"2024-11-11T22:16:14.891Z","updated_at":"2026-05-17T11:32:57.741Z","avatar_url":"https://github.com/JokerQyou.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fanctl\n\nA simple thermal fan controller for Raspbian.\n\n[中文文档](https://blog.mynook.info/post/rpi-gpio-thermal-fan/)\n\n# Hardware\n\n## Required parts\n\n- 5V DC fan x1, 3mm / 4mm or any other size suitable for your Raspberry Pi.\n- 2N2222 NPN transistor x1.\n- 680ohm resistor x1.\n- (Optional) small piece of PCB. If you don't have one, it is also possible to solder all parts directly to the fan wires..\n\n## The circuit\n\n![the circuit](https://i.imgur.com/jw3qqDq.png)\n\nOr you could reference to [this post](https://howchoo.com/g/ote2mjkzzta/control-raspberry-pi-fan-temperature-python#a-explanation-of-the-circuit) for connecting your parts together.\n\nChoose any GND / VCC (5V) pin to supply power. For the controller pin, use [GPIO 8 (AKA BCM 14)](https://pinout.xyz/pinout/pin8_gpio14).\n\n# Software\n\n## Install dependencies\n\n- First of all update apt cache: `sudo apt update`.\n- Install `cmake`, `gcc` and `git`, as you would do for all other C projects: `sudo apt install cmake build-essential gcc git`.\n- Install the [MRAA lilbrary](https://github.com/eclipse/mraa) for accessing GPIO:\n  - Clone MRAA project: `git clone https://github.com/eclipse/mraa.git`\n  - Enter the cloned repository: `cd mraa`\n  - Prepare to build: `mkdir build \u0026\u0026 cd build`\n  - Generate makefiles: `cmake ..`\n  - Build: `make`\n  - Install the built tools: `sudo make install`\n  - Refresh linker related stuff so MRAA library can be located by gcc: `sudo ldconfig -v`\n  - To verify you have correctly installed the MRAA library, run `mraa-gpio version`, it should print the model of your Raspberry Pi\n\n## Build this project\n\n- Clone this project: `git clone https://github.com/JokerQyou/fanctl.git`\n- Enter the cloned repository: `cd fanctl`\n- Prepare to build: `mkdir build \u0026\u0026 cd build`\n- Generate makefiles: `cmake ..`\n- Build: `make`\n- Install: `sudo make install`\n\n## Start service\n\n- Reload systemd units: `sudo systemctl daemon-reload`\n- To verify you have correctly installed the service, run `sudo systemctl status fanctl`, it should print some information about this tool\n- To start the service: `sudo systemctl start fanctl`\n\nWhen the chip temperature reaches 60°C, the fan will be started by pulling `FAN_VCC_PIN` to high (causing the transistor to close). When the chip temperature drops to 45°C or below, the fan will be stopped by pulling `FAN_VCC_PIN` to low. When the fan is started or stopped, the corresponding temperature value will be written to journald logs, to follow the log: `sudo journalctl -u fanctl -f`.\n\n## Configure\n\nEdit the installed service file (in `/etc/systemd/system`), use `THRESHOLD_ON` and `THRESHOLD_OFF` to set temperature limits. ON is the upper limit, fan starts when chip temperature reaches above it; OFF is the lower limit, fan stops when chip temperature drops below it.\n\n```systemd service\n[Service]\n# ...\nEnvironment=THRESHOLD_ON=50\nEnvironment=THRESHOLD_OFF=30\n```\n\nYou'll need to reload the daemon before restarting the service:\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl restart fanctl\n```\n\nTo use a different pin for controlling the fan, modify `FAN_VCC_PIN` (Notice: MRAA library uses the **physical pin number**). Then rebuild and reinstall again. Service will need to be restarted.\n\n## Why C\n\nWell, I've actually written a Python script and installed that as a service, it kept working for almost 6 months. But I don't think such a simple job is worth using 15MB of memory. The memory footprint dropped under 400KB after transforming to C.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjokerqyou%2Ffanctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjokerqyou%2Ffanctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjokerqyou%2Ffanctl/lists"}