Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwillikers/pwm-fan-controller
A simple program for controlling a PWM fan from a microcontroller with Rust
https://github.com/jwillikers/pwm-fan-controller
arm attiny attiny85 avr ch32v203 fan nostd pwm pwm-fan-control pwm-fan-controller qt-py risc-v rp2040 rust
Last synced: about 2 months ago
JSON representation
A simple program for controlling a PWM fan from a microcontroller with Rust
- Host: GitHub
- URL: https://github.com/jwillikers/pwm-fan-controller
- Owner: jwillikers
- License: apache-2.0
- Created: 2022-05-07T21:38:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T22:14:20.000Z (2 months ago)
- Last Synced: 2024-10-24T10:55:00.391Z (2 months ago)
- Topics: arm, attiny, attiny85, avr, ch32v203, fan, nostd, pwm, pwm-fan-control, pwm-fan-controller, qt-py, risc-v, rp2040, rust
- Language: Nix
- Homepage:
- Size: 102 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.adoc
Awesome Lists containing this project
README
= PWM Fan Controller
Jordan Williams
:experimental:
:icons: font
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:Asciidoctor-link: https://asciidoctor.org[Asciidoctor]
:direnv: https://direnv.net/[direnv]
:Git: https://git-scm.com/[Git]
:just: https://just.systems/[just]
:Linux: https://www.linuxfoundation.org/[Linux]
:nix: https://nixos.org/[Nix]
:nix-direnv: https://github.com/nix-community/nix-direnv[nix-direnv]
:Noctua-NF-P12-redux-1700-PWM-Fan: https://noctua.at/en/nf-p12-redux-1700-pwm[Noctua NF-P12 redux-1700 PWM Fan]
:Rust: https://www.rust-lang.org/[Rust]image:https://github.com/jwillikers/pwm-fan-controller/actions/workflows/build-attiny85.yaml/badge.svg[ATtiny85 Build, link=https://github.com/jwillikers/pwm-fan-controller/actions/workflows/build-attiny85.yaml]
image:https://github.com/jwillikers/pwm-fan-controller/actions/workflows/build-pico.yaml/badge.svg[Pico Build, link=https://github.com/jwillikers/pwm-fan-controller/actions/workflows/build-pico.yaml]
image:https://github.com/jwillikers/pwm-fan-controller/actions/workflows/build-qt-py-ch32v203.yaml/badge.svg[QT Py CH32V203 Build, link=https://github.com/jwillikers/pwm-fan-controller/actions/workflows/build-qt-py-ch32v203.yaml]PWM fan controller written in {Rust} targeting different microcontrollers.
Currently, these are basic examples for setting the {Noctua-NF-P12-redux-1700-PWM-Fan} to a quiescent 40% speed.
Implementations for specific boards can be found in the `boards` directory.
The implementations include boards targeting the Arm, AVR, and RISC-V architectures.ifdef::env-github[]
++++
++++
endif::[]ifndef::env-github[]
image::boards/attiny85/pics/attiny85-pwm-fan-controller-protoboard-top.jpg[ATTiny85 PWM Fan Controller Protoboard Top View, align=center]
image::boards/attiny85/pics/attiny85-pwm-fan-controller-breadboard-top-1.jpg[ATTiny85 PWM Fan Controller Breadboard Top View 1, align=center]
image::boards/pico/pics/pico-pwm-fan-controller-breadboard-top-1.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Top View 1, align=center]
image::boards/qt-py-ch32v203/pics/qt-py-ch32v203-pwm-fan-controller-breadboard-top-1.jpg[QT Py CH32V203 PWM Fan Controller Breadboard Top View 1, align=center]
endif::[]== Develop
{Nix} is used to manage dependencies, toolchains, and development environments for each board.
This makes it possible to develop locally in an environment that is consistent with CI.
The `nix develop` command can be used to enter or run commands in an environment with all of the necessary dependencies.
For convenience, direnv can be used to automatically load this environment when entering the project's directory.
The https://marketplace.visualstudio.com/items?itemName=mkhl.direnv[mkhl.direnv VSCode extension] integrates this environment in VSCode for development.
Nix also generates the configuration for https://pre-commit.com/[pre-commit], which automates formatting and various checks when committing changes.
Follow the instructions here to set up your development environment.. Install an implementation of {Nix}, such as https://lix.systems[Lix] used here.
+
[,sh]
----
curl -sSf -L https://install.lix.systems/lix | sh -s -- install
----. Install direnv for your system according to the https://direnv.net/docs/installation.html[direnv installation instructions].
+
[,sh]
----
sudo rpm-ostree install direnv
sudo systemctl reboot
----. Integrate direnv with your shell by following the instructions on the https://direnv.net/docs/hook.html[direnv Setup page].
. Clone the repository.
+
[,sh]
----
git clone https://github.com/jwillikers/pwm-fan-controller.git
----. Permit the direnv configuration for the desired board or boards in the repository.
The following command allows loading the environments for all boards.
+
[,sh]
----
direnv allow boards/*
----. Run `pre-commit install` to configure pre-commit hooks in the repository.
+
[,sh]
----
pre-commit install
----. The {just} command runner can be used to perform common tasks, such as building the and flashing the firmware for a particular board.
The commands do not automatically use or assume a Nix environment.
When in the directory for a particular board, this shouldn't be a problem as direnv automatically loads the Nix environment.
However, the top-level directory does not load any environment, so use `nix develop` as required to execute the `just commands`.
+
[,sh]
----
nix develop '.#attiny85' --command just flash attiny85
----=== Serial Port Permissions
On Linux, most distributions require the user to be in a particular group to access serial ports.
Here, I document the particular steps required to permit access to serial ports on Fedora Atomic variants.. On Fedora Atomic, the _dialout_ group does not exist in the `/etc/group`, so it must be added there.
+
[,sh]
----
echo (getent group dialout) | sudo tee -a /etc/group
----. Add the user to the _dialout_ group to access USB without requiring superuser privileges.
+
[,sh]
----
sudo usermod --append --groups dialout $USER
----. Log out and back in for the group change to take effect.
== Boards
* link:boards/attiny85/README.adoc[ATtiny85]
* link:boards/pico/README.adoc[Raspberry Pi Pico]
* link:boards/qt-py-ch32v203/README.adoc[Adafruit QT Py CH32V203]== Contributing
Contributions in the form of issues, feedback, and even pull requests are welcome.
Make sure to adhere to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct].== Open Source Software
This project is built on the hard work of countless open source contributors.
Several of these projects are enumerated below.* {Asciidoctor-link}
* {direnv}
* {Git}
* {Linux}
* {Nix}
* {nix-direnv}
* {Rust}== Code of Conduct
Refer to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct] for details.
== License
Licensed under either of
* Apache License, Version 2.0 (link:LICENSE-APACHE[LICENSE-APACHE] or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license (link:LICENSE-MIT[LICENSE-MIT] or https://opensource.org/licenses/MIT)at your option.
© 2022-2024 Jordan Williams
== Authors
mailto:{email}[{author}]