- Up to 8 digital temperature sensors (DS18B20).
- Automatically detects the presence of PWM control (4th fan wire).
- Operates in PWM or On/Off mode (in case if DC-DC converter or power MOSFET used).
- 19.5 kHz PWM.
- Rotation control with an attempt to restart in case of rotor stop.
- Step-down DC-DC converter for fan power supply (up to 38V input, up to 2A output).
- Linear voltage regulator for MCU power supply.
- Audio alerts.
The controller regulates the fan speed using PWM, and the full PWM range (0 - 100%) fits into the temperature range of 25°C - 40°C. Unlike the ATtiny10-based project, this device can poll up to 8 sensors and uses a single 12-38 volt power supply. ATtiny13 has 64 bytes of EEPROM on board, which we can use to store the serial numbers of the connected sensors. In the case of connecting a fan without PWM control or without a speed sensor (2- 3-wire fans), the control is carried out for a temperature threshold of 30°C: if the hottest sensor's temperature below this limit, then a logical 0 is set at the 2nd pin of the chip, and if higher, then 1. This pin is used to control the EN pin of the DC-DC converter. The controller also issues an audible alarm when the temperature of the hottest sensor exceeds the threshold of 50°C.
See the detailed review of the project on my YT-channel (English subtitles): https://youtu.be/DCnN7JbptWM
You can find the project schematic, PCB drawing and other materials here: https://oshwlab.com/sneer2sneer/attini13-fan-controllerFor your design you can use a minimum of elements (pullup resistors for the lines of the fan speed sensor and temperature sensor and a decoupling capacitor for power supply), but in my case the module schematic looks like this:
For MCU Flash ROM programming you will need a USBasp programmer (or any other that supports the TPI - Tiny Programming Interface), which is connected according to this schematic:
The programming itself is performed from the Arduino IDE, with the ATtiny13 core installed in it (see the links below).
Fuse programming (0xFE - set RSTDISBL bit):
avrdude -C ..\etc\avrdude.conf -c usbasp -P usb -B 32 -p attiny13 -v -U lock:w:0xFF:m -U hfuse:w:0xFE:m
Project - https://oshwlab.com/sneer2sneer/attini13-fan-controller
Datasheet ATtiny13 - https://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny13A-Data-Sheet-DS40002307A.pdf
Datasheet DS18B20 - https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Tips and Tricks to Optimize Code for 8-bit AVR - https://ww1.microchip.com/downloads/en/AppNotes/doc8453.pdf
1-Wire protocol (Book of iButton standards) - https://pdfserv.maximintegrated.com/en/an/AN937.pdf
USBasp firmware - https://www.fischl.de/usbasp/
USBasp firmware update guide - https://www.electronics-lab.com/project/usbasp-firmware-update-guide/
ATTinyCore Universal for Arduino IDE - https://github.com/SpenceKonde/ATTinyCore
AVR high-voltage serial programming for ATtiny - https://github.com/tsaarni/avr-high-voltage-serial-programming