Uživatelské nástroje

Nástroje pro tento web


raspberry-pi-4b

Rozdíly

Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.

Odkaz na výstup diff

Obě strany předchozí revizePředchozí verze
Následující verze
Předchozí verze
raspberry-pi-4b [2020/01/05 16:06] – [Fan PWM] blazekraspberry-pi-4b [2023/12/26 19:13] (aktuální) – upraveno mimo DokuWiki 127.0.0.1
Řádek 8: Řádek 8:
   * https://www.thingiverse.com/thing:3774560   * https://www.thingiverse.com/thing:3774560
  
-===== Fan PWM =====+===== FAN PWM Noctua NF-A4x10 5V =====
  
-  * https://www.instructables.com/id/PWM-Regulated-Fan-Based-on-CPU-Temperature-for-Ras/ +Source: https://www.domoticz.com/wiki/Raspberry_pi_fan_control_and_monitoring_with_bash
-  * https://www.domoticz.com/wiki/Raspberry_pi_fan_control_and_monitoring_with_bash +
- +
-  * Noctua NF-A4x10 5V +
-  * NPN transistor 2N2222A +
-    * https://www.tme.eu/cz/details/2n2222a-dio/tranzistory-npn-tht/diotec-semiconductor/2n2222a/ +
-  * diode 1N4001 +
-    * https://www.tme.eu/cz/details/1n4001-dco/univerzalni-diody-tht/daco-semiconductor/1n4001/ +
-  * resistor 1K +
-    * https://www.tme.eu/cz/details/1w-1k-1%25/metalizovane-rezistory-tht-1w/royal-ohm/mf01sff1001a10/+
  
   * N-channel MOSFET (e.g. 2N7000/BS170)   * N-channel MOSFET (e.g. 2N7000/BS170)
Řádek 29: Řádek 20:
     * https://www.tme.eu/cz/details/1w-10k-1%25/metalizovane-rezistory-tht-1w/royal-ohm/mf01sff1002a10/     * https://www.tme.eu/cz/details/1w-10k-1%25/metalizovane-rezistory-tht-1w/royal-ohm/mf01sff1002a10/
  
-FAN PWM +{{::rpi4b-fan-regulator-01.jpg?450|}} 
 +{{::rpi4b-fan-regulator-02.jpg?450|}} 
 + 
 +{{::pwm_driver_stripboard.png?450|}} 
 + 
 +**PIN PWM:** BCM 18 (PWM 0) https://pinout.xyz/ 
 + 
 +**Specific fan speed and temperature breakpoints for Noctua NF-A4x10 5V** 
 + 
 +<file bash 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 
 +</file> 
 +===== FAN PWM ===== 
 + 
 +  * https://www.instructables.com/id/PWM-Regulated-Fan-Based-on-CPU-Temperature-for-Ras/ 
 + 
 +  * NPN transistor 2N2222A 
 +    * https://www.tme.eu/cz/details/2n2222a-dio/tranzistory-npn-tht/diotec-semiconductor/2n2222a/ 
 +  * diode 1N4001 
 +    * https://www.tme.eu/cz/details/1n4001-dco/univerzalni-diody-tht/daco-semiconductor/1n4001/ 
 +  * resistor 1K 
 +    * https://www.tme.eu/cz/details/1w-1k-1%25/metalizovane-rezistory-tht-1w/royal-ohm/mf01sff1001a10/ 
  
-Source: https://www.domoticz.com/wiki/Raspberry_pi_fan_control_and_monitoring_with_bash 
 ===== CPU Test ===== ===== CPU Test =====
  
raspberry-pi-4b.txt · Poslední úprava: 2023/12/26 19:13 autor: 127.0.0.1