Installing a fan on a raspberry pi 3

Raspberry Pi 3 PC case assembly

You can start assembling your computer by attaching the heat sinks.

installing, raspberry

The radiators have an adhesive back surface, and it is easy to attach them, the size obviously shows where to attach each of the radiators. Then we assemble the case, which is just as easy and did not cause any problems for the author of the review.

Mount the fan on the lid of the case.

As you can see in the photo the lid of the case tilts sideways. Directly, the board itself is attached to the case with four screws, which are also included.

The fan can be connected to the corresponding pins [4-5]. Exactly these forty pins are used to connect to the board all possible peripherals, such widespread interfaces, like SPI, I2C, serial interface are realized here.

Generally the assembling of the computer should not cause serious problems. After that you need to worry about connecting the peripherals. For the first start-up you need a mouse and a keyboard. The author used a set of wireless keyboard Logitech K270 and mouse M185 and also a keyboard with a rapoo E2700 touchpad, no problems with it.

DIY Case with active cooling for Raspberry

I wrote recently about my experience with passive cooling for the RPi. The adventures of the little board did not end there. we had to make a case for it, the main “thing” of which is the built-in cooler. What came out of it?

Something like this, small and pretty, in my opinion (the photo shows the case still without the mount with the board).

The design of the case I have seen in a video on YouTube.

I like it very much. It’s not locked down (you can access the GPIO), it’s easy to make and very pretty. Ok, now we think what to do with cooling. From the GPIO connectors you can easily power a 5 volt (sometimes even 12 volt) cooler from some video card, netbook or any other small size.

The connection is very simple : we connect one wire of the cooler (usually red) to the 5V Power pin and the other to Ground. The main thing is not to mix things up, because it can kill the board. If everything is ok, the cooler starts.

I made a hole in the top for it and attached it to the top. It went something like this:

The case is almost done. All that’s left is to make a mount for the board on the bottom bar.I don’t have a picture of my mount unfortunately. Because I got not very aesthetically because of the superglue “out of control” 🙂 The most interesting. temperature measurements. Here is a table with the same measurements as I did last time. In brackets are measurements of previous experiments with passive cooling. The result speaks for itself.

Installing the heat sinks on the Raspberry Pi

The first thing to think about when getting your Raspberry Pi ready to go live is cooling.

After all, we have a computer with a processor and other chips, which tend to get hot when working.

The Chinese make and sell sets of radiators for micro computers. Heat sinks can be aluminum, copper or ceramic. I chose copper because copper heat sinks have higher thermal capacity than aluminum, but for me I don’t really understand ceramic as a passive cooling element.

Two big radiators are mounted on top of the board and a flat plate will be attached to the RAM chip on the bottom side.

Apparently the radiators are attached to the chips with the usual double sided adhesive tape. At least for the 3M tape this adhesive material looks way too thin.

Before sticking the heatsinks to the chips, you should degrease them with alcohol just in case. The large chip on the left is the heart of the microcomputer, a Broadcom BCM2837 single-chip system with an integrated processor and graphics adapter. It heats up to 100°C in synthetic tests, so there is no way to leave it without cooling.

On the right side near the USB ports there is a USB controller. This one also heats up, though not as much as the Broadcom BCM2837 SoC. The second heatsink from the kit will be attached to it.

The top 2 heatsinks are securely mounted in their places.

The copper plate is attached to the 1Gb LDDR2 memory module on the bottom side. The RAM does not get very hot, that is why a full-size heatsink is not needed. But it does need a copper plate. Just in case. At the very least, its presence can protect the chip from accidental mechanical damage.

Looking ahead: radiators turned out to be really useful thing, when the Raspberry processor is under load, the radiator mounted on it starts to burn your finger. So, you should not install them without thinking that if the manufacturer has not equipped the board with them, then it is not necessary.

Raspberry Pi

Often the Rapsberry family of mini PC CPUs are cooled by a small, and therefore noisy, five-volt fan. Many people solve this problem by hooking it up to 3.3 volt output, but this solution has the disadvantage that typical five volt fans consume 200 mA, so they cause a load on the regulator, which is not designed for such power 3.3В

In this article we will discuss how to reduce noise by adjusting the rpm of the cooler by adjusting the temperature tolerance of the processor.The difference of this work is that we will learn not only to switch on and off cooler, but also adjust its speed with the help of shim controller, just like on a standard computer.

1. Shim. What it is and what it’s for?2. Speed control with bipolar NPN transistor 2.1. Cooler Connection Diagram 3. Speed control with MOSFET transistor 3.1. Cooler Connection Diagram 3.2. Logically controlled N-channel mosfets4. How to read processor temperature5. Activating the cooler at a specified temperature 5.1. Compiling and running a program6. PWM control. Option I 6.1. Compiling with assembly and running the program7. PWM control. Option II 7.1. Compiling and running a program8. Putting the program in the system autostart9. Check10. Removing the program from the system autoload

See also  How to add a vacuum cleaner Xiaomi in homekit

Shim. What it is and what it’s for?

Abbreviation stands for pulse-width modulation (or PWM. pulse-width modulation). is a process of regulating power by pulsing on and off. PWM is found in binary, ternary, as well as analog and digital forms. The main purpose of PWM. Increase efficiency when building power supplies for electronics, including brightness control of various screen backlights.

Speed control with bipolar NPN transistor

First of all we need a good bipolar NPN transistor. Our cooler uses 200mA, so we need a transistor with collector current of more than 200mA. In foreign datasheets this parameter is marked as Ic, in our country Ik. Compatible transistors: 2N2222A, 2N5550, 2N5551, and so on. First we clarify the purpose of the pins of the transistor. We need to determine the dislocation of its emitter, collector and base. The easiest way is to check all this from a reference book or datasheet.

2.1. Cooler wiring diagram

The transistor is connected according to the following diagram:

Now when you connect “1” to the input of the circuit, the current will flow through resistor R1, then the base and emitter to ground. In this case the transistor will open and the current will go through the collector-emitter junction and therefore through the load (cooler).

R1. The key resistor, its purpose is to limit the current through the base. emitter junction. If it is missing, the current will not be limited and will ruin the control chip, because it connects the transistor to the power line).

In addition we must not forget that the load is inductive and a protection diode (D1) is needed. The problem is that the energy stored in the magnetic field will not allow the current to drop instantly to zero when the switch opens. This means that the load terminals will have voltage of reverse polarity, which can easily prevent the controller from working or even damage it.

Speed regulation with the help of a mosfet

In addition to the bipolar transistor, it is also possible to use a field effect transistor, or as it is otherwise called. MOSFET, insulated gate transistor (also MOS or TIR). Their convenience is that the control is realized only by voltage. if the gate voltage is higher than the threshold value, the transistor opens. As long as the transistor is open or closed, the control current through it. As for bipolar transistors, current flows as long as the transistor is open and this is a significant disadvantage as compared to field effect transistors.

In the following we use only n-channel motsfsets, because they are cheaper, have better characteristics, and to regulate N-channel motsfet it is necessary to apply positive voltage to the gate relative to the source.

3.1. Cooler connection diagram

Note! Connect the load only “from above” (to the drain). Otherwise the circuit will not work. The reason is that the transistor will open if the voltage exceeds the threshold between the gate and the source. If you put a load underneath, it will lower the voltage, so the transistor will not be able to open fully or partially.R2. resistor (10 kOhm), in an undefined state “pulling down” the potential to ground.R1. a resistor (100 ohm) limiting the charge/discharge currentDon’t forget that the load has an inductance and a protection diode (D1) is needed.

3.2. Logically controlled N-channel mosfets

Disadvantage of mosfets. threshold gate voltages higher than 3.3 volts. However, there are also variations of control logic level mosfets, like: IRL520NPBF, IRL2505, NTZD3155C FDN337N, 2N7000, ZVN4306A, and others.

How to read processor temperature

There are several options to get an instantaneous CPU temperature.In case you are using Armbian, use the command:

this command outputs the frequency, the duration of the system session and the CPU temperature at intervals of 6 seconds.There is also a second command that returns the CPU temperature:

The two temperature sensors inside the processor (SoC) provide values that can be used to find the average temperature. To find out the temperature of the Raspberry Pi CPU, use the console to enter the following command:

Please note that the temperature of Raspberry Pi is represented in milligrades and to get real degrees you have to divide the given value by one thousand.

Activate cooler at specified temperature

The following are methods that use WiringPi and require the installation of libraries, which can be installed using the instructions at the links here: WiringPi, WiringOP, BPI-WiringPi.

The most affordable way to control the cooler is to turn it on and off when the temperature reaches a threshold that you can set. This way is good for those who don’t mind the hum of the fan

static int getTemperature static fstream myfile; int temperature = 0; myfile.open(“/sys/devices/virtual/thermal/thermal_zone0/temp”, ios_base::in); myfile temperature; myfile.close; return temperature;

int main int temperature; int pinState = 0; try if (wiringPiSetup 0) pinMode(PIN, OUTPUT);

if (temperature = TEMPERATURE_MIN pinState 0) digitalWrite(PIN, HIGH); pinState = 1; else if (temperature

This script will work like this: when the temperature reaches 54 degrees, the cooler will be activated, and it will stop only when the temperature drops more than 10 degrees from the upper limit (44 degrees)

The temperature data is obtained with the function static int getTemperature. Don’t forget, that the Raspberry Pi temperature is counted in milligrays, and to get a whole number you have to divide the number you’re looking for by a thousand, which means you need to make a couple of changes to the code, instead:

5.1. Compiling, assembling and running the program

Create FanPiOnOff file.cpp and paste the code written above into it:

In case you want to run the program in the background:

PWM control. variant I

The logic of the program is to turn on the fan (with a certain fill factor) when the set temperatures are reached and turn off when they fall below.

#include #include #include

Raspberry Pi 3 Heatsink & Fan Installation

#define PWM_VALUE1 35#define PWM_VALUE2 50#define PWM_VALUE3 75#define PWM_VALUE4 100

#define TEMPERATURE_1 45#define TEMPERATURE_2 50#define TEMPERATURE_3 60#define TEMPERATURE_4 70

static int getTemperature static fstream myfile; int temperature = 0; myfile.open(“/sys/devices/virtual/thermal/thermal_zone0/temp”, ios_base::in); myfile temperature; myfile.close; return temperature;

int main int temperature; bool pwmStopped = true;

try if (wiringPiSetup 0) while (1) temperature = getTemperature;

if (temperature TEMPERATURE_4) if (pwmStopped) softPwmCreate(PIN, ((PWM_VALUE4 RANGE) / 100), RANGE); pwmStopped = false; else softPwmWrite(PIN, ((PWM_VALUE4 RANGE) / 100)); else if (temperature TEMPERATURE_3) if (pwmStopped) softPwmCreate(PIN, ((PWM_VALUE3 RANGE) / 100), RANGE); pwmStopped = false; else softPwmWrite(PIN, ((PWM_VALUE3 RANGE) / 100)); else if (temperature TEMPERATURE_2) if (pwmStopped) softPwmCreate(PIN, ((PWM_VALUE2 RANGE) / 100), RANGE); pwmStopped = false; else softPwmWrite(PIN, ((PWM_VALUE2 RANGE) / 100)); else if (temperature TEMPERATURE_1) if (pwmStopped) softPwmCreate(PIN, ((PWM_VALUE1 RANGE) / 100), RANGE); pwmStopped = false; else softPwmWrite(PIN, ((PWM_VALUE1 RANGE) / 100)); else softPwmStop(PIN); pwmStopped = true;

See also  How to decorate the fridge at home

usleep(1000 1000); catch (exception e) cerr

6.1. Компиляция со сборкой и запуском программы

Создаём файл FanPiPWM.cpp and paste in it the code written above:

In case you want to run the program in the background:

PWM control: Example 2

Besides, it is possible to change fill factor smoothly. In this case, for the fan triggering and the filling factor we bind the minimum parameters (say, 45 degrees and 35% respectively), and to the maximum temperature (say, 70 degrees) we bind the filling factor of 100%. The functions static int map(int x, int inMin, int inMax, int outMin, int outMax) will help you calculate the fill factor;.

#include #include #include #include #include

#define RANGE_MAX 100#define RANGE_MIN 35

#define TEMPERATURE_MAX 70#define TEMPERATURE_MIN 45

static int getTemperature static fstream myfile; int temperature = 0; myfile.open(“/sys/devices/virtual/thermal/thermal_zone0/temp”, ios_base::in); myfile temperature; myfile.close; return temperature;

static int map(int x, int inMin, int inMax, int outMin, int outMax) if (x inMax) return outMax; return (x. (inMin) (outMax. outMin) / (inMax. inMin) outMin;

int main int temperature; int pwmValue; bool pwmStopped = true;

try if (wiringPiSetup 0) while (1) temperature = getTemperature; pwmValue = map(temperature, TEMPERATURE_MIN, TEMPERATURE_MAX, RANGE_MIN, RANGE_MAX);

usleep(1000 1000); catch (exception e) cerr

7.1. Compiling and running the program

Create file FanPiPwmLinear.cpp file and paste the code we wrote above into it:

in case we want to run it in the background:

Add this program to the system autorun

All that remains is to automate the launch of the program we created, which is responsible for regulating the speed of the cooler, when the system starts up.To do this, we need to put at the end of the file /etc/rc.local:

Place script start command before exit 0 line:

Now after rebooting the system the program is started automatically each time and the fan will start only if the conditions are fulfilled.To find out if a program is running after rebooting the system, you need to check if the process is present in the terminal:

Checking

In order to test the functionality of the application, you need to load the processor so that its temperature rises to the right mark and make sure that the cooler reacts to this event. Apps like sysbench or stress can help warm up your processor. These can be installed with aptitude:

Running an application using four cores:

When these utilities are running, the processor temperature will start to increase.You can force the shutdown of both sysbench and sysbench utilities by pressing the CtrlC key combination.

Making Raspberry Pi 4 cooler automatic control

The recently released new Raspberry Pi 4 single-board computer has a cooler connected directly to 5V, so it runs non-stop, consumes almost 0.5A and makes a lot of noise.

My son asked me to help automate the process of turning on the fans, depending on the temperature of the processor. I’ll give him the “iron”, and he will write the control script (will it be PWM or just on/off from the set temperature) himself. I just need to carefully solder the control key. The scheme is elementary, I am not going to draw it, I can find it on the Internet.

The main thing is to choose the right current transistor. Measured, two coolers draw almost 450 mA. I soldered out the D965T transistor and the diode IN4004 from old PSU boards.Just soldered everything at first with a hinged assembly to test.

Connect it to a pin (BSM 14), there will be a “1” when the temperature reaches 35 ° C. The script so far is simple.

In 20 minutes the fans started to work and in a minute and a half they switched off.

Now it is also possible to do a compact assembly. Also for the convenience of connection, re-soldered the connection of fans with each other.

Well, now you can exercise writing a script 🙂

Комментарии и мнения владельцев 7

if you take a 12 volt fan, and connect it to a constant 5 volts, it will spin constantly, but quietly.

Almost noiseless ) I have one from Intel. I hear it at night. During the day no. But I powered it with USB. And this article I came across, when I was looking for how to control the speed of the GPIO with the third pin.

I have a 12 volt fan that runs so fast that you can’t even hear it a meter away from the room noises. temperature, according to the gauges, 52-53 degrees.

it is true, there is a small problem ). if you unplug the Raspberry Pi, there is a chance that the fan won’t start spinning until the blades are manually spun, not enough voltage to move the impeller. but this seems to me to be a problem with my particular instance of the cardboard fan

Installing the microSD card with NOOBS

You need to use a microSD card with NOOBS to start and configure the Raspberry Pi. NOOBS (New Out Of Box Software) is an operating system installation manager for RPi.

If you had a microSD card with NOOBS in it, it will be easier for you. Insert the card into the slot on the bottom of the computer. Don’t push hard, the card should go in smoothly.

If you don’t have a microSD card with NOOBS, you can format some of your card and install NOOBS on it.

The results

Four modes of thermal management were considered:

The Raspberry Pi 4 was outdoors on a lab bench.

When using the computer without cooling, the unloaded temperature is about 61C. When performing a task, the temperature rises to its maximum. About 85C, resulting in sustained thermal trotting after the CPU temperature rises above 81C. Inference time increases by an average of 119.1ms for each iteration. The total time to complete the task was just under 20 minutes.

When adding passive cooling, using a heatsink sized 20 × 20 mm for the processor, we see a 5C decrease in idle temperature, t.е. to about 56C and a 2C drop in maximum temperature during task execution (to 83C). In addition, it takes longer to reach maximum temperature. Thus, full computing power is available for a longer time, and the program execution time is reduced by about 200 seconds compared to operating in non-cooled mode, and the average time per iteration is reduced to 99.4 ms. The total running time of the calculations was about 16.5 minutes.

When adding constant active cooling using a fan mounted on top of the heatsink (the power of the 40mm fan is connected to the 5V and ground pins of the GPIO connector, see. figure above), we observe a significant drop in idle temperature, it dropped to 36C, and the maximum temperature was 52C.

In this case, the processor doesn’t go into thermal throttle mode, and the inference is another 200 seconds faster and the average time per iteration is reduced to 83.8 ms. The total turnaround time was less than 14 minutes.

See also  Installing underfloor heating mat under tile

The disadvantage of this solution. The fan is constantly on, which creates additional noise and wastes energy. These problems can be solved with active cooling control. In this case, apart from connecting the fan power to the 5 V and GND buses, you must additionally connect the fan control wire to the BCM18 terminal on the GPIO connector.

Let us use the GPIO Zero library to control the fan: turn it on when the processor temperature exceeds 75C, and turn it off when the temperature drops to 70C.

#!/usr/bin/env python3 import sys import OS import time import vcgencmd as vc from gpiozero import OutputDevice def main : fan = OutputDevice( 18 ) while True : temp = int (vc.measure_temp) print (temp) if temp = 75 : fan.on print (“fan.on”) elif temp = 70 : fan.off print (“fan.off”) time.sleep( 1 ) if name ‘ main ‘: main

In this cooling mode, the initial temperature rise during the inference is the same as the passive cooling curve until the fan reaches 75C. Then the fan starts to maintain the temperature within the set limits and there is no thermal throttling. The program finished in 14 minutes with an average time of one iteration of 84.1 ms.

As you can see, the difference between the total operating time observed with active and controlled cooling is within a small margin of error.

NES4Pi NES

An upgraded model of retro housing, styled as the Nintendo Entertainment System game console. This system was made for Raspberry Pi 3 and was quite popular among the nostalgic gamers, building the emulator of retro consoles.

Of the interesting features is the cover that covers the USB and Ethernet ports. Comes with a set of heatsinks and a 35mm fan to blow hot air out.

You can buy NES4Pi together with a joystick kit that looks like the joysticks from the original NES.

Installing a Raspberry Pi in a NESPi Pro case. A new retro console outfit

Recently I published an article on this site, where I described in detail the process of “transforming” a single-board microcomputer Raspberry Pi into a retro console. In the Комментарии и мнения владельцев to the article, I mentioned an interesting option of installing Raspberry into the case, which strongly resembles the NES Classic Mini. Now I can implement this feature and share with readers information about the case. NESPi Pro.

Here’s the link to the article. Putting together a Retro Console based on the Raspberry Pi 3 Model B single-board microcomputer. The goal of the project was to create a retro console based on the popular Raspberry microcomputer. Let’s take a look at a pretty nice case we’ll install our Raspberry Pi in.

The NESPi Pro comes in a plain cardboard box. The package includes: the case itself; instructions for installing the Raspberry board; a small Phillips screwdriver; and a fastener kit for the board and case.

Enclosure dimensions are 120x94x46mm, weight without the board installed is 155g. The idea of the case, apart from giving a more presentable look to the retro console, is to transfer the USB2.0 port, RJ45 Ethernet port on the front side of the case. Also at the side of the case there are power LED and control buttons. power on / off, reset. The product is made of high quality plastic with excellent casting quality. There are no imperfections and burrs and foreign odors inherent in products from the Celestial Empire. There are two control buttons on the front panel. on/off switch and reset. Nearby you can observe the power indicator LED. On the left side are two USB ports. Under the hinged lid there are two more USB ports and an RJ45 Ethernet port. On the back, sockets: HDMI; 3.5 jack and micro USB connector for power supply. The slot for micro SD memory cards is on the side of the housing. On the bottom, besides the slots for ventilation, you can see a very interesting idea. a small lid-lockable compartment where the user can store memory cards. The lower and upper halves of the case are fastened with the self-tapping screws included in the set. On the top of the case there is a place to install a 20x20mm fan for active cooling. Inside the case there are boards used for port switching and power supply integration. To operate the USB ports, USB 2 is provided.0 HUB Controller based on GL850G chip. The DS1307Z serves as a real time clock, and a CR1220 (DL1220) lithium battery must be installed to keep it running. In the context of the project it is not required to install this element. The console works fine without a real time clock. The following models of Raspberry Pi 3 Model B / 3B / 2B / B / A can be installed inside the case. I’ve put more detailed photos of the “guts” under a spoiler.

There are no problems with integration of the product itself into NESPi Pro. Connect the adapters for RJ45 and USB to the Raspberry. Carefully put all the wires so that they do not interfere with closing the case and fix the board malinka two screws included in the kit. Connect the power for the Raspberry to the GPIO pins as shown in the picture. The power is now bypassed via the switch and the entire device is powered via a separate micro USB connector. Put the cooling fan in the lid of the case. it was left from the previous experiments with the Raspberry. To connect the fan, there is a fan connector on the board. Now it remains to close the case and fix its two halves. As we can see the HDMI port and 3.5 jacks, remained in their places, as they are soldered on the Raspberry board, and the other ports were moved. As in the previous acrylic case, to remove the memory card from the slot, you will need to use tweezers. Too small part of it sticking out of the case, no way to grab it with your fingers. Now it’s not a shame to put our retro console on a shelf under the TV. This case looks very stylish. Of convenience is the power button, now there is no need to plug the micro USB cable to the malinka every time to start it up. I did not notice any obvious disadvantages of the whole design. Taking into consideration that the case and its components are of high quality, I would take the liberty of recommending it for purchase to those who would like to build a Raspberry Pi based console by themselves.

Item provided by the store for this review. This review is published in accordance with p.18 Site Rules.

About the author

| Denial of responsibility | Contacts |RSS