SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By MikePL
#194661
Hi,

I have a small project where I am controlling the speed of a 4 wire PWM fan.

I had problems using the Arduino Uno at first where when the fan was running slower I was getting a high pitch sound from the fan. After some research I added the following code and then the sound was gone, Great! :)
Code: Select all

TCCR2B |= _BV(CS20);
TCCR2B |= _BV(CS21);

Everything is working how I wanted it to from the Uno..

The problem I have now is my intention was to run the fan from an Attiny85 micro controller, I am now pulling my hair out trying to change the frequency the same for the tiny85. Can anybody help me?

I had some help and have tried this code to change timer 1 to 32x prescaler but it's not working for me and doesn't seem to be doing anything at all, Am I doing it correctly?
Code: Select all

TCCR1 |= _BV(CS12);
TCCR1 |= _BV(CS11);

Thanks for you help

Mike