PWM fan controller for the ATtiny85 written in Rust. This fan controller just sets the fan speed to 40% speed to reduce noise from the Noctua NF-P12 redux-1700 PWM Fan.
All the hardware components in my particular build are enumerated here.
-
12V DC 1000mA (1A) regulated switching power adapter - UL listed
-
Female DC Power adapter - 2.1mm jack to screw terminal block
-
USB-C power supply for the microcontroller
Programming will also require a USB-C cable and a computer.
This is a dead-simple PWM fan controller that simply lowers the speed of the Noctua NF-P12 redux-1700 PWM Fan to a quiescent 40% speed. The microcontroller simply sets the fan speed and then does nothing. Since the ATtiny85 is a 5V microcontroller and the Noctua fan uses 5V logic, no logic-level shifter is necessary. The ATtiny85 draws 2.17 mA of current in this particular configuration. The fan setup might evolve in the future to take into account temperature sensing and dynamic speed adjustment.
-
Gently place the ATtiny85 in the breadboard.
-
Connect pin #4 to ground.
-
Attach pin #8 to 5V.
-
Wire pin #5 on the ATtiny85 to the 4th pin on the Noctua fan header. This should be the pin opposite the one attached to ground on the fan header.
-
Connect the following pins on the ATtiny85 to the associated pins on the 6-pin ISP breakout.
ATtiny85 pin ISP Breakout pin 1
RST
4
GND
5
MOSI
6
MISO
7
SCK
8
VCC
-
Set the USB µISP’s slider to 5V to power the ATtiny85 microcontroller for testing.
-
Attach the USB µISP programmer to the 6-pin ISP breakout board.
-
Connect the 12V power supply to the 2nd pin in the fan header, the one immediately next to ground.
-
Install rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install the AVR GCC toolchain, AVR Libc, and avrdude.
sudo dnf -y install avr-gcc avr-libc avrdude
-
Install cargo-binutils.
cargo install cargo-binutils
-
Install the LLVM tools preview Rust component for cargo-binutils.
rustup component add llvm-tools-preview
-
Clone the repository.
git clone https://github.com/jwillikers/pwm-fan-controller.git
-
Change to the project’s directory.
cd pwm-fan-controller/boards/attiny85
-
Build the executable.
cargo build
-
Convert the executable to the file
pwm.hex
in the Intel hex format.cargo objcopy -- -O ihex pwm.hex
-
Flash the
pwm.hex
file on the ATtiny85 with avrdude.avrdude -c USBtiny -B 4 -p attiny85 -U flash:w:pwm.hex:i
-
Add GitHub CI actions.
-
Add pre-commit hooks?
-
Include pictures in README.
-
Add a wiring diagram.
-
Describe using the USB-C breakout.
-
Measure power consumption.
-
Investigate lowering power consumption.
Contributions in the form of issues, feedback, and even pull requests are welcome. Make sure to adhere to the project’s Code of Conduct.
This project is built on the hard work of countless open source contributors. Several of these projects are enumerated below.
Refer to the project’s Code of Conduct for details.
Licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
© 2022-2024 Jordan Williams