One beans place in space.

PWM to voltage controlled fan hub conversion

My aging home Xen server has a rather old mainboard. A Gigabyte Z68M-D2H. It has 2 fan headers, but only the CPU FAN supports PWM. The manual shows the SYS_FAN header Pin 4 as “Reserved” – which means no PWM signal. Instead, Pin 2 is marked as “+12V / Speed Control”. The system does this by either using PWM on the +12v line, or decreasing the voltage on it – and you can choose this in the BIOS.

Mainboard manual for SYS_FAN header

So, normally, we’d use a PWM fan hub to share the PWM signal to the other fans, and draw the power from a molex or SATA connector – so we don’t overload the mainboard header capacity. In this case however, we can’t do that – as we don’t get a signal on Pin 4.

What to do?

While mulling this over, I looked at how I could hook up my existing PWM hub – but generate a PWM signal elsewhere – and use the voltage output from the mainboard to control the PWM duty cycle – and hence the speed of as many fans that could fit on the hub.

Firstly, I had to make the voltage suitable to go an an analogue pin of the ATTiny85 – which can handle a maximum of 5v. I decided to use a simple voltage divider to split the voltage in a 2/3 and 1/3 split. This should give a maximum of 4v on the analogue pin – giving some headroom for …. interesting voltages to be handled. A voltage divider is pretty simple – and made up of two resistors.

I used a single 24K ohm resistor for R1, and a single 12K ohm resistor for R2. I used 1% tolerance resistors – just because I had them – but 5% are probably just as good. I tested by measuring the voltage at the junction of the two resistors while having the fan set for full speed – and measured 4.02v.

Now to the code for the Arduino – as this was probably the most complex part. The specification for PWM fans for PC shows that you need a 25Khz signal.

I’ve included the full code at the end of this post. It is a modification of this code on Github.

I needed to modify the cable included with the PWM hub to pass through pin 2 & 3 from the mainboard to the hub. This gives me the +12v / Speed Control wire – and the sense wire to feed back a speed to the mainboard.

The best part of all, the ATTiny85 fits inside the centre of the PWM hub as showed below.

Modified PWM hub with tags

The fan speeds reported back to the mainboard will reflect whatever the fan plugged into the orange fan header reports via the Sense pin.