Ventilation
Like many people here in The Netherlands, I keep my network stuff in the utility closet. This closet is the entry point of water, gas and electricity in the house and contains all the meters, switches, etc.
I noticed that especially my NAS (my network storage) would break down at the end of a very hot summer. The summer of 2017 was the last one where that happened. Since extremely hot summers are getting more common, I needed to address this.
I want some light airflow, but the stuff I could buy makes too much noise. And as always: If you cannot find what you want, you make it yourself. I decided to use two 150mm Noctua PC fans. They are near silent when running slowly.
Just as when the fans are placed in a PC, I want them to run slowly when it is cool and faster when it is warmer. So, besides some fans I also need a thermomether and I need some microcontroller I can use to read out the temperature and control the fans.
A chose a Raspberry Pi Pico as a microcontroller. It is cheap, small and has a build in temperature sensor. The temperature sensor is not super accurate, but more than efficient enough for this project. Another benefit of the Pico, is MicroPython support. I wanted to try this out and see if it is even easier then Arduino. It turns out, it is. Just hold a button while powering up, to let the Pico mount as a mass storage device to your computer (i.e. it looks like a USB stick), copy some image to it and reboot. After that you can edit a special Python file (code.py). Every time you save it, it will automatically reload the application. However, I decided to try CircuitPython as well. CircuitPython is a derivative ofMicroPython. I ended up using this one for the project.
Reading out the temperature is really easy. Import the microcontroller library and retrieve the temperature from the sensor integrated in the CPU. In the example below I output the temperature to the console.
import microcontroller import time while True: temp = microcontroller.cpu.temperature print("Temperature is {}c".format(temp)) time.sleep(5)
The next step is using the temperature to control the fans. The fans are so-called PWM fans. PWM stands for Pulse Width Modulation. Fan speeds are controlled by setting a block wave on an output pin with a certain frequency and duty cycle. In case of these fans, the output pins controlling the fans are initialised as PWM pins with a frequency of 22KHz. The speed is then controlled by changing the duty cycle (the ratio between a signal being high and a signal being low).
A dictionary of temperatures an duty cycles is defined to determine how fast the fans have to turn at a certain speed.
import microcontroller import pwmio # Fan fan1 = pwmio.PWMOut(board.GP28, frequency=22000) fan2 = pwmio.PWMOut(board.GP21, frequency=22000) fan_curve = [(0.0, 0x1fff), (25.0, 0x3fff), (30.0, 0x5fff), (40.0, 0x7fff), (45.0, 0xafff) ] while True: # Read temperature temp = microcontroller.cpu.temperature # Set fan speed d = 0xffff for (t, s) in fan_curve: if t > temp: break d = s fan1.duty_cycle = d fan2.duty_cycle = d
The block wave sent to the fans does not provide the power. It only defines the speed. The fans have a separate 12V pin for power. The Pico is powered with V5 coming from an USB power supply. A 5V to 12V DC/DC converter is connected to the VBUS pin of the Pico, essentially connecting the DC/DC converter to the USB power supply.
A 3D printed box keeps everything together. The box and fans are mounted on some multiplex board:
The board is placed on top of some wooden grill, which is kept in place above the closet using magnets. The end result is:
The fans have been running all summer. And even though we had high temperatures, the systems in the closet were able to maintain a decent temperature. The in-house temperature increased from 21 degrees celcius all the way to 30 degrees celsius. The sensors in the NAS and router only registered a 3 degree increase. And most important: The fans are silent.