Having made the decision to design an ATtiny-based multi-speed fan controller for the DPS3005C housing, I set out to create the schematic. I envisioned only a handful of parts required; NTC thermistor, matching resistor, MOSFET driver for the fan, an ATtiny13 and a few more capacitors and resistors as needed.
Design criteria: For the software controller, I needed a means to proportionally drive the fan as well as a means to measure the thermistor’s resistance as it varied with temperature. I wanted at least three (3) intermediate fan speeds between “off” and “full on”. The fan supplied was not a 4-wire 12 volt “PWM computer fan” but I knew that it could still be controlled either by varying its power supply or by using a pulse-width modulation (PWM) scheme. I figured that the fan was designed to run on 5 volts and I should therefore run it off 5 volts, so the only “proper” way to go was to use PWM. The ATtiny13 has a built-in 8-bit timer with two PWM outputs and a 4-channel 10-bit analog to digital converter (ADC).
I built a solderless breadboard with an ATtiny13 on it. I added the nMOSFET and a 10KΩ pot to simulate the NTC thermistor. Using AVR Studio and an AVR Dragon, I could manipulate the internal registers (Timer 0) of the ATtiny13 in-circuit and adjust the PWM duty cycle and frequency “on the fly”.
Driving the Fan: One thing I noticed in particular was that unless I set the PWM register to “255” (full-on), the fan wouldn’t even spin. I could see that it wasn’t the MOSFET driver. I thought this very odd, so looking for hints, I decided to research to see if others had posted PWM fan controllers on the Internet. I found a few but nothing glared me in the eye as to what was causing the problem with driving the FAN. What was particularly helpful though, was MAXIM’s “Tutorial 1784” entitled “Fan Speed Control Is Cool!” (APP1784 pdf). The application note states that “useful [PWM] frequencies range from 20Hz to 160Hz” for driving “standard” brushless fans. Aha! I had set the PWM frequency to 4.687 KHz, which was far too high! I was planning to run the ATtiny at 1.2 MHz (internal 9.6 MHz oscillator divided by 8), so the only PWM frequencies I had available were 4687.5 Hz, 585.9 Hz, 73.2 Hz and 18.3 Hz. Looks like 73.2 Hz and 18.3 Hz are the only two viable candidates. Once I changed to the 18.3 Hz PWM frequency, the fan started operating properly and I could adjust it’s speed by adjusting the PWM values in the ATtiny13’s OCR0B register. Upon further testing, I found that 73.2 Hz did not work as well as 18.3 Hz and even that frequency was a little low but did work reasonably well.
I had wondered why the higher PWM frequencies didn’t drive the fan properly then I realize that it was “electrical momentum”. In other words, the EMF “pushes” against the mechanical weight of the fan rotor were too short and had too little”electrical momentum” to “push” the fan rotor in any manner, thus no mechanical rotational momentum could be created. Slowing the PWM frequency down gave the fan rotor “stronger” pushes for a longer period of time, so some mechanical rotational momentum could be created, just enough to move the rotor until the next “push”.
Fan Vibration: In working with the fan at full-speed, I noticed that it vibrated slightly while holding it in my hand. I realized that part of the perceivable noise was coming from an imbalance in the fan rotor. Mounting on the back panel of the case tends to amplify the vibrational imbalance thus making it even noisier.
I didn’t have any tools to assist me in finding the proper counter-balance weight nor the optimum position on the fan rotor but using several layers of masking tape applied on top of each other (for weight), I tried some empirical testing to see if I could minimize the mechanical vibration by sequentially locating the optimum “counter-balance” point. I was mostly successful and was able to reduce the fan’s vibration to minimum. Once I had balanced the fan rotor, I remounted it inside the case to see how it sounded and was fairly pleased with the results. but there was still some noticeable vibrational noise.
I started to think about adding something to dampen the vibration of the fan in a manner that would isolate it from the case. I came up with some small circular felt feet that I never did apply to my mini-quadcopter. I had four (4) of them and was able to place them between the fan’s housing and the case. I suppose even a thin layer of rubber sheeting might have been used but had I none in my possession.
I wish I had a way to measure sound pressure level (SPL) so that I could see the actual difference in each of the two mechanical methods of vibration reduction that I used. For now, even though it is a highly subjective means, my ears did the measurements.
For those wishing to improve the fan noise, I would suggest starting out with balancing the fan rotor and mechanically insulating the fan from the case.
NTC thermistor: I have a small stock of Murata NCP18XH103F03RB NTC thermistors, which are 0603 size surface mount components. I didn’t think I’d have a problem soldering two AWG 30 “Kynar” wires to it in order to use them. These are “typical” 10KΩ @ 25ºC thermistors. The β is 3455 for 25ºC to 100ºC but rather than using the “Steinhart equation” to calculate the resistance at any given temperature, I used the table in the datasheet, which I imported to a spreadsheet.
Selecting temperature set-points: Once I had the data in the spreadsheet, I started to pick temperature set-points to use in the software. As a starting point, I initially picked 35ºC, which is 95ºF, and picked three more temperatures that were 15ºC apart. I ended up with set points of 25ºC, 50ºC, 65ºC, and 80ºC. Since the thermistor had a resistance of 10KΩ @ 25ºC, I thought it best to use a 10KΩ “matching” resistor. This way, I had resistance range of 10KΩ @25ºC down to 1.669KΩ @80ºC. When converted to a voltage, the range was 2.500 down to 0.715 volts, which is well within the equivalent voltage detection range of the ATtiny13’s ADC. I didn’t need great accuracy but with at ATtiny13 using it’s 5 volt power rail as an “external reference”, I had about 5 millivolts per bit resolution (±1 or 2 bits) or about ±0.1ºC resolution. I would have been happy with ±1ºC resolution but ±0.1ºC resolution is certainly acceptable.
Selecting PWM values: Initially, I decided to use PWM duty cycles of 50%, 58%, 79% and 100% to see how they sounded to my ears.
In the next post, I’ll review the software functionality. In the next post, I’ll review testing the sound level of the fan noise.