当前位置:网站首页>Raspberry pie realizes intelligent cooling by temperature control fan
Raspberry pie realizes intelligent cooling by temperature control fan
2022-06-28 01:56:00 【BluePROT】
Raspberry pie with shell , But he always makes a lot of noise , Then we can transform it , So that he can become a controllable fan , Realize a temperature control function
Materials needed
- triode S8550 PNP type : Two dollars more than fifty
- DuPont bus to bus
- DuPont line male to female
these tb You can buy , There is a shop with parcel post
Then introduce these things
The triode faces the plane towards itself , There are three pins , Left to right are E、B、C. Popular said E It's positive ,C Yes , Equivalent to diode , Base level B Low level is the only way to turn on the circuit .
Then there is the raspberry pie pin , There are forty pins , Here you can see that there are two kinds of codes , When writing code, you need to specify what kind of coding method is available , The corresponding pin is to put the network cable socket of raspberry pie downward , Corresponding pin sequence 
Wiring way
The red color of the fan is the positive pole , Connect to 5V,4 No. pin
Here, connect the triode to the negative pole of the fan , That is, the black line of the fan is connected to the... Of the triode C level
Transistor's E Level connection 6 Pin No , Grounding
Base stage of triode B Connect 8 Interface No , That is to say BCM Coded GPIO 14 Pin No
Start up after connecting , It seems that the fan will be powered on intermittently during startup , No big problem .
After power on , stay python Try to execute the command at the terminal , First, you need to install the library apt install RPi.GPIO
perform python
GPIO_OUT=14
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(GPIO_OUT,GPIO.OUT,initial=GPIO.HIGH)
self.Status=False
# start-up
GPIO.output(GPIO_OUT,GPIO.LOW)
# close
GPIO.output(GPIO_OUT,GPIO.HIGH)
Then you can execute the following command to check the temperature of raspberry pie , The output value is divided by 1000 Is the current temperature
cat /sys/class/thermal/thermal_zone0/temp
Last , This is a script , The fan can be controlled according to the temperature , The temperature exceeds 50 Open when , lower than 45 Close when , You can set it yourself , You can also set one here
import subprocess
import RPi.GPIO as GPIO
import time
class FanController:
def __init__(self,GPIO_PIN):
self.GPIO_OUT=GPIO_PIN
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(self.GPIO_OUT,GPIO.OUT,initial=GPIO.HIGH)
self.Status=False
def action(self,flag):
if flag=='start':
GPIO.output(self.GPIO_OUT,GPIO.LOW)
self.Status=True
elif flag=='stop':
GPIO.output(self.GPIO_OUT,GPIO.HIGH)
self.Status=False
def getTemp():
Temp=subprocess.getoutput('cat /sys/class/thermal/thermal_zone0/temp')
Temp=int(Temp)/1000
print(time.strftime('%Y-%m-%d %H:%M-%S')+'\ttemp is %s oC' % (str(Temp)))
return Temp
Fan=FanController(14)
print('start temp controller program')
while True:
Temp=getTemp()
if Temp>50 and not Fan.Status:
print('temp is higher than 50 , fan will start')
Fan.action('start')
elif Temp<45 and Fan.Status:
print('temp is less than 45 , fan will stop')
Fan.action('stop')
time.sleep(15)
Reference link
Raspberry pie — Use triode to control cooling fan
边栏推荐
- 药物发现综述-01-药物发现概述
- AI+临床试验患者招募|Massive Bio完成900万美元A轮融资
- TI AM3352/54/59 工业核心板硬件说明书
- Import the data table in MySQL into Excel
- 如何理解 Transformer 中的 Query、Key 与 Value
- 9. Openfeign service interface call
- 网络爬虫是什么
- 要搞清楚什么是同步,异步,串行,并行,并发,进程,线程,协程
- pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...
- Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
猜你喜欢

一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别

SQL Server 2016 detailed installation tutorial (with registration code and resources)

Web3 技术初体验以及相关学习资料

【牛客討論區】第四章:Redis

什么是数字化?什么是数字化转型?为什么企业选择数字化转型?

Deepmind | pre training of molecular property prediction through noise removal

Machine learning notes - time series as features

基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例

Review of drug discovery-02-prediction of molecular properties

药物发现综述-03-分子设计与优化
随机推荐
Import the data table in MySQL into Excel
PostgreSQL setting auto increment field
【嵌入式基础】内存(Cache,RAM,ROM,Flash)
What problems should be evaluated before implementing MES management system
Lefse analyzes the local implementation method with all installation files and details to ensure success.
基于可学习尺寸自适应分子亚结构的药物相互作用预测
Adobe Premiere Basics - general operations for editing material files (offline files, replacing materials, material labels and grouping, material enabling, convenient adjustment of opacity, project pa
零基礎多圖詳解圖神經網絡
如何理解 Transformer 中的 Query、Key 与 Value
PV操作原语
Solon 1.8.3 release, cloud native microservice development framework
LATEX 表格内容居左,中,右
网络爬虫是什么
Is there any risk in opening an account for flush stock? Is it safe for flush to open an account
Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
【嵌入式基础】串口通信
Intensive reading of transformer thesis paragraph by paragraph
ionic4实现半星评分
Can you open an account for stock trading in flush? Is it safe?
【牛客討論區】第四章:Redis