PWM fan controller for the Adafruit QT Py CH32V203 RISC-V board 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.
The Adafruit QT Py CH32V203 uses the CH32V203G8 RISC-V microcontroller. 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 require a USB-C cable and a computer. If you don’t already have one, you’ll probably want a fan, too. This circuit is meant for a 12V fan. I use this controller for the Noctua NF-P12 redux-1700 PWM Fan.
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. The fan setup might evolve in the future to take into account temperature sensing and dynamic speed adjustment.
The 3.3V QT Py CH32V203 requires a logic level shifter to boost the PWM signal up to 5V for the fan.
I use the 74AHCT125 to perform the logic level conversion, using pin #40, VBUS
, to provide the 5V reference voltage.
The QT Py CH32V203 draws only 1.11 mA of current in this particular configuration.
The 74AHCT125 is wired as shown in the [74AHCT125 Wiring] table. All pins omitted from the table are connected to ground.
74AHCT125 Pin |
Signal |
Connection |
2 |
3.3V logic level input |
QT Py CH32V203 pin #5 (SDA) |
3 |
5V logic level output |
1N4001 to fan header pin #4 (Control) |
8 |
5V |
QT Py CH32V203 pin #14 (5V) |
The output signal from the logic level shifter is sent through the 1N4001 power blocking diode to the fan header. The pins on the 4-pin fan header are classified in the [4-pin Fan Header Pinout] table. The pins are numbered one through four from left to right with the pins reaching upwards and the overhang positioned between the viewer and the pins.
Fan Header Pin |
Signal |
1 |
GND |
2 |
+12VDC |
3 |
Sense |
4 |
Control |
-
Change to the board’s directory.
cd pwm-fan-controller/boards/qt-py-ch32v203
-
Add a udev rule to be able to access the QT Py CH32V203 as a non-root user.
/etc/udev/rules.d/60-qt-py-ch32v203.rulesSUBSYSTEM=="usb", ATTRS{idVendor}=="4348", ATTRS{idProduct}=="55e0", TAG+="uaccess"
-
While holding the
BOOT
button, attach the QT Py CH32V203 to your computer via the USB-C port. -
Flash the board using the
nix run
command with theqt-py-ch32v203.flash.wchisp
target.nix run ../..#qt-py-ch32v203.flash.wchisp
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 https://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
© 2024 Jordan Williams