Skip to content

Drive an 4 pin PWM Fan using an ATtiny45 or ATTiny85 which was harder than I thought

Notifications You must be signed in to change notification settings

heresiarch/ATtinyFanControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temperature regulated PWM Fan Control with ATTiny 45/85

This is a simple circuit to drive an 4-Pin PWM Fan using an ATtiny 45. With an Arduino Uno the first code was running after 30 minutes, but I would like to use a very small circuit in my gaming PC, so I tried to adopt it to some left over ATTinys. It was not as easy as I thought, because fast PWM on ATtiny needs special setup of some registers. The best description I found was on this website, which sets the PWM to 32 kHz, with 8Mhz F_CPU and no CKLDIV, which is a little bit higher than 25 kHz needed for the PWM of the Fan, but it worked with full duty cycle.

https://blog.podkalicki.com/attiny13-hardware-pwm/

The second challenge was that Arduiono analogread() did not work on the ATtiny at all. I found an alternative way on the following page:

http://www.hilltop-cottage.info/blogs/adam/avr-adc-1-basic-examples-attiny85/

https://github.com/arc12/AVR-Experiments-and-Examples/blob/master/ADC%20Tiny85/ADC%20Tiny85/ADC%20Tiny85.cpp

The NTC conversion/correction to °C from 10bit ADC output was generated with this page: https://www.sebulli.com/ntc/index.php

The circuit and code should be self explanatory. Alt text

Example screenshots of changing pulse width on NTC with different temperatures and the frequency of about 32kHz. PWM1

PWM2

About

Drive an 4 pin PWM Fan using an ATtiny45 or ATTiny85 which was harder than I thought

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published