A compact USB-to-PWM fan controller built on the ATtiny45/85 and V-USB. It was created for GPU passthrough systems where the host (e.g., Proxmox) cannot read GPU temperature, but a VM can. The USB device is passed through to the VM, which then sets the fan speed based on GPU temperature.
When a GPU is passed through to a virtual machine, the host often has no access to the GPU sensors. That makes fan control on the host impossible. This project adds a small, low-cost USB fan controller so the VM can read the GPU temperature and drive the fan directly.
- The ATtiny enumerates as a USB CDC (virtual serial) device via V-USB.
- The VM sends a PWM percentage (0-100).
- The ATtiny outputs a 25 kHz PWM signal to a 4-pin fan. A value of 0 turns the fan off.
- Software-only USB stack (V-USB) with CDC serial interface.
- Simple serial protocol: send a number and a carriage return.
- Compatible with ATtiny45/85.
- Linux works out-of-the-box; Windows needs a driver.
| Signal | ATtiny pin | Notes |
|---|---|---|
| PWM | PB1 (D1) | 25 kHz PWM output to the fan |
| SWITCH | PB0 (D0) | Fan power gating |
| TACH | PB2 (D2) | Tach input (unused in current firmware) |
An adapter for NVIDIA Tesla cards is available as an STL: https://www.thingiverse.com/thing:5391731
Air duct adapter for NVIDIA Tesla cards.The firmware uses the VUSB-AVR board package for the Arduino IDE and the V-USB CDC library to implement a USB serial interface.
- Open Arduino IDE.
- Install VUSB-AVR.
- Select Tools -> Board -> VUSB AVR -> VUSB-AVR.
- Select Tools -> CPU -> ATtiny85 (16.5 MHz internal).
- Connect your ISP programmer to the ICSP header.
- Select Tools -> Programmer and choose your ISP programmer.
- Use Tools -> Burn Bootloader to set the fuses.
- Open
software/FanController.inoand click Upload.
If you build a hex file and want to flash it directly, use a command like:
avrdude -c usbasp -p t85 -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m -U flash:w:FanController.hexOn Linux the device usually appears as /dev/ttyACM0. Send a value from 0 to 100 and a carriage return:
printf "65\r" > /dev/ttyACM0Windows users need to install the Digistump drivers.
Any script can drive the controller by sending the desired PWM percentage over the serial device. For GPU passthrough setups, a small Python script in the VM typically reads GPU temperature (e.g., via nvidia-smi) and adjusts the fan speed accordingly.
- Tested on Linux only.
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. See LICENSE.




