by

PC Fan Control with an AtTiny85

I have a computer desk that I like quite well. It it was designed to be used with a desktop computer, and has all the attributes that are common with computer desks, such as keyboard trays and so on. One thing that may be a bit less common however, is that there is a cabinet complete with door to house the actual computer tower. This is great in some ways, and less so in others. Great in the fact that it hides all of your computer cords, as well as the computer tower itself. Less than great, in that to access the rear of the computer to perform work or make changes, great difficulty is required. Another consequence of having your computer in an enclosure is that ventilation is quite limited. Good ventilation is required if there is a lot of load on the computer, where a consequence of load is heat.

To combat this heat, I decided to use some PC fans. I built a boost converter circuit so I could power the 12V computer fans with 5 volts from USB. This worked quite well, except for the USB on the rear of the computer remained powered when the computer was off, so I would have to use a switch to power them when I used the computer. Sometimes I’d forget, and things would get quite hot.

2016-02-02-14-59-58

This led me to design a new system of powering the fans, one where a microcontroller would be used and power them based on the temperature of the interior of the cabinet vs the exterior ambient temperature. In this way, I would not have to remember to turn the fans on or off, it would all be automatic. Because of the small amount of inputs and outputs required for the project, I decided on using the AtTiny85 microcontroller. It comes in a DIP-8 package, which would also cut down on the size of the controller board. I decided that I would use a boost converter as I had before, so I could continue to power the fans via USB.

2017-04-28-21-38-39 2017-04-29-14-23-25

For reading the temperature, I decided to use some one wire devices: DS18b20 temperature sensors. I like these sensors, and it would allow me to use just one input for both of them. Again, I chose the MC34063 buck/boots converter for switching the 5v to 12 and a NPN transistor to switch the power. I decided to use PWM to control the fan speed, as I could use more than just a simple on and off when using a microcontroller and speed up, or slow down the fan depending on the difference in temperature between outside and inside the enclosure. I added a few different color LEDs to indicate the disparity in temperature as well as fan speed. Using Kicad, a layout was done, and single sided PCB etching with ferric chloride gave me a nice circuit board. I built a panel to mount the fans and the controller on, which I could insert into one of the two back vent areas of the cabinet, and presto, no more worrying about overheating my computer.

2016-02-06-17-24-27

Schematic


Code