{"id":21101162,"url":"https://github.com/crycode-de/attiny-i2c-fan-control","last_synced_at":"2025-10-24T01:57:34.485Z","repository":{"id":47137746,"uuid":"344848698","full_name":"crycode-de/attiny-i2c-fan-control","owner":"crycode-de","description":"Control a PWM fan over the I²C bus.","archived":false,"fork":false,"pushed_at":"2021-09-12T14:02:27.000Z","size":40,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T12:17:08.529Z","etag":null,"topics":["attiny","avr","fan-controller","i2c-bus","platformio"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crycode-de.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["crycode-de"],"custom":["https://www.paypal.me/petercrycode"]}},"created_at":"2021-03-05T15:15:12.000Z","updated_at":"2023-12-31T01:16:30.000Z","dependencies_parsed_at":"2022-09-03T04:43:02.683Z","dependency_job_id":null,"html_url":"https://github.com/crycode-de/attiny-i2c-fan-control","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fattiny-i2c-fan-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fattiny-i2c-fan-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fattiny-i2c-fan-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fattiny-i2c-fan-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crycode-de","download_url":"https://codeload.github.com/crycode-de/attiny-i2c-fan-control/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225444760,"owners_count":17475353,"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":["attiny","avr","fan-controller","i2c-bus","platformio"],"created_at":"2024-11-19T23:40:41.802Z","updated_at":"2025-10-24T01:57:29.440Z","avatar_url":"https://github.com/crycode-de.png","language":"C++","funding_links":["https://github.com/sponsors/crycode-de","https://www.paypal.me/petercrycode"],"categories":[],"sub_categories":[],"readme":"# ATtiny I²C Fan Control\r\n\r\nControl a PWM fan over the I²C bus.\r\n\r\n**Tests:** ![Test and Release](https://github.com/crycode-de/attiny85-fan-control/workflows/PlatformIO%20CI/badge.svg)\r\n\r\n*ATtiny I²C Fan Control* is made as a [PlatformIO](https://platformio.org/) project.\r\n\r\n## Supported features\r\n\r\n* Set fan speed by using a PWM signal\r\n* Set fan speed via I²C bus\r\n* Read the current fan RPM via I²C bus\r\n* Auto adjust PWM range by testing the connected fan at startup (can be re-triggered by I²C bus)\r\n* Override min PWM level by I²C bus\r\n\r\n## Currently supported AVR controllers\r\n\r\n* [ATtiny85](https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf)\r\n\r\nAdjustments for other AVR microcontrollers should be easy.\r\n\r\n## I²C registers\r\n\r\n| Register | Description |\r\n|---|---|\r\n| 0x00 | **Status** - By writing a 1 to bit 0 of this register you can trigger a re-calibration of the fan. |\r\n| 0x01 | **Fan speed** - By writing to this register you can set the fan speed. A value of `0` means \"fan off\" and `255` is full speed. |\r\n| 0x02 | **Minimal PWM level** - Read or write the minimal PWM level at which the fall will rotate when *fan speed* is set to `1`. This will be detected automatically at startup. |\r\n| 0x03 | **Current fan speed in revolutions per second (RPS)** - Read the current fan speed in RPS. This is calculated from the fan tacho signal. |\r\n| 0x04 and 0x05 | **Current fan speed in revolutions per minute (RPM)** - Read the current fan speed in RPM. This is calculated from the fan tacho signal. `0x04` is the low-byte and `0x05` the high-byte. |\r\n\r\n### Hint on I²C bus\r\n\r\nSince the ATtiny microcontrollers use a USI (Universal Serial Interface) to provide the I²C bus, there may be some problems reading or writing more than one byte at once.  \r\nTo overcome this issue you should read/write byte by byte, even if want to read the fan speed in RPM.\r\n\r\n## Wiring\r\n\r\n![Wiring](./doc/attiny-i2c-fan-control-wiring.png)\r\n\r\n## Projects using ATtiny I²C Fan Control\r\n\r\n* [Active cooling of the \"HomePi\"](https://crycode.de/homepi-kuehlung) (German)\r\n\r\n## Used Libraries\r\n\r\n* [Arduino Framework](https://platformio.org/frameworks/arduino)\r\n* [PinChangeInterrupt](https://platformio.org/lib/show/725/PinChangeInterrupt)\r\n* [TinyWireSio](https://platformio.org/lib/show/293/TinyWireSio)\r\n\r\n## License\r\n\r\n**CC BY-NC-SA 4.0**\r\n\r\n[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/)\r\n\r\nCopyright (C) 2020-2021 Peter Müller \u003cpeter@crycode.de\u003e [https://crycode.de](https://crycode.de)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrycode-de%2Fattiny-i2c-fan-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrycode-de%2Fattiny-i2c-fan-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrycode-de%2Fattiny-i2c-fan-control/lists"}