PI4-FAN-PWM

From Waveshare Wiki
Jump to: navigation, search
PI4-FAN-PWM
PI FAN 3007

Armor lite heatsink with pwm fan for Raspberry Pi 4B
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

This is a thin and lightweight heat sink, equipped with a 3510 ultra-quiet cooling fan, and the fan supports PWM speed regulation, which is perfectly compatible with Raspberry Pi OS. Other systems need to manually write python or C code to drive the fan speed through PWM.

NOTE: Supports Raspberry Pi 4B Only, Automatic speed control function only supports Raspberry Pi OS.

Features

  • Lightweight and silent
  • Support PWM control speed regulation
  • Compatible with official system configuration
  • Easy to install and fix
  • Good heat dissipation effect

Gallery

  • Product Outlook
精修风扇1.jpg
Zp0110back.jpg
Zp0110精修.jpg
  • Specifications
精修风扇1.jpg
Detailszp0110.jpg
降温.jpg

Package Includes

清单图1.jpg
  • 1 x Armor lite heatsink with pwm fan for Raspberry Pi 4B
  • 1 x Screw driver
  • 2 x M2.5x6mm Screws
  • 4 x Thermal Pad
  • 1 x Instructions


How to assemble

Zp0110安装1.jpg


Zp0110安装2.jpg


When used with FAN Adapter, the default PWM pin is D12 pin ,You can switch to TXD or D18 by modifying the 0R resistor

How to control fan speed

  • Controled by Raspberry Pi OS:
We assume you have a Raspberry Pi OS installed.

1.Connect the pins of the cooling fan to the Raspberry Pi or FAN Adapter.Make sure you have already connected the Red wire to 5V, Black wire to GND pin, and Blue Wire to PWM (GPIO 12).

FAN-Adapter-V2-PINS.png


2. Turn on Raspberry Pi and login, open a terminal and enable Fan control as following Steps: Typing following command in terminal:sudo raspi-config
3. Navigate to Performance options
4. Navigate to Fan
5. Select yes
6. Input 12 means using GPIO 12 as PWM output Pin.
7. Change threashold trigger temperature to 60 degrees.
8. Confirm it.
9. Navigate to Finish and reboot Raspberry Pi as it required to take effect.


In this case, the fan will be triggered to rotate only when the CPU temperature of the Raspberry Pi reaches 60 degrees, otherwise the fan will not spin.

How to enable it via Programming

  • Make sure RPi.GPIO library has been installed.
pip freeze |grep RPi.GPIO
If feedback is:
RPi.GPIO==0.7.0
means library is OK.
  • Open a terminal and create a file named: pwm-fan.py
  • Copy and paste following code into the file and save it.
import RPi.GPIO as GPIO
import time
import subprocess

GPIO.setmode(GPIO.BCM)
##Set to false, other processes occupying the pin will be ignored
GPIO.setwarnings(False)
GPIO.setup(12, GPIO.OUT)
pwm = GPIO.PWM(12,100)

print("\nPress Ctrl+C to quit \n")
dc = 0
pwm.start(dc)

def ReadTemp():
        # view CPU temperature 
        file = open("/sys/class/thermal/thermal_zone0/temp")
        cpu = float(file.read()) / 1000
        file.close()
        print('CPU temperature is: %2.2f' % cpu)
        time.sleep(5)

try:
    while True:
        temp = subprocess.getoutput("vcgencmd measure_temp|sed 's/[^0-9.]//g'")
        ReadTemp()
        if round(float(temp)) >= 40:
            dc = 100
            pwm.ChangeDutyCycle(dc)
            time.sleep(0.05)
        else:
            dc = 0
            pwm.ChangeDutyCycle(dc)
            time.sleep(0.05)
except KeyboardInterrupt:
    pwm.stop()
    GPIO.cleanup()
    print("Ctrl + C pressed -- Ending program")
  • Execute it by typing:
python3 pwm-fan.py
  • The fan will be turned on when the CPU temperature is reached to 65 degrees.