raspberry-pi-4b
Raspberry Pi 4B
Box
FAN PWM Noctua NF-A4x10 5V
Source: https://www.domoticz.com/wiki/Raspberry_pi_fan_control_and_monitoring_with_bash
- N-channel MOSFET (e.g. 2N7000/BS170)
- 0.1 uF electrolytic capacitor
- 10K resistor
PIN PWM: BCM 18 (PWM 0) https://pinout.xyz/
Specific fan speed and temperature breakpoints for Noctua NF-A4x10 5V
- fan-noctua.sh
#!/bin/bash # Device references dev_temp=/sys/class/thermal/thermal_zone0/temp dev_pwm=/sys/class/pwm/pwmchip0/pwm0 dev_enable=$dev_pwm/enable dev_duty=$dev_pwm/duty_cycle dev_period=$dev_pwm/period # Export pwm0 if it's not available if [ ! -e $dev_pwm ]; then echo 0 > /sys/class/pwm/pwmchip0/export sleep 2 fi # PWM frequency (nanoseconds) period=1000000 # temperature breakpoints (millidegrees) off_low=45000 low_off=40000 low_high=52000 high_low=48000 # fan-speed (nanoseconds) low=930000 high=999999 # on/off values off=0 on=1 # update interval (seconds) interval=10 # initialise the fan next=($off $low) echo $period > $dev_period echo ${next[0]} > $dev_enable echo ${next[1]} > $dev_duty update_status() { if [[ $(cat $dev_enable) == 1 ]]; then if [[ $(cat $dev_duty) == $high ]]; then nvalue=3 svalue="High" else nvalue=2 svalue="Low" fi else nvalue=1 svalue="Off" fi logger "Fan $svalue" } while [ : ] do temp=$(cat $dev_temp) current=($(cat $dev_enable) $(cat $dev_duty)) if [ $temp -gt $off_low ]; then next[0]=$on if [ $temp -gt $low_high ]; then next[1]=$high elif [ $temp -lt $high_low ]; then next[1]=$low fi elif [ $temp -lt $low_off ]; then next[0]=$off fi if [ "${next[*]}" != "${current[*]}" ]; then echo ${next[1]} > $dev_duty echo ${next[0]} > $dev_enable update_status fi sleep $interval done
FAN PWM
- NPN transistor 2N2222A
- diode 1N4001
- resistor 1K
CPU Test
Install sysbench
shell# apt-get install sysbench
CPU stress test
shell# sysbench --test=cpu --cpu-max-prime=1000000 --num-threads=4 run
Without Fan
shell# vcgencmd measure_temp shell# temp=78.0'C
With Fan
shell# vcgencmd measure_temp shell# temp=54.0'C
raspberry-pi-4b.txt · Poslední úprava: 2023/12/26 19:13 autor: 127.0.0.1