Cov txheej txheem:

Raspberry Pi CPU Qhov Ntsuas Kub: 11 Kauj Ruam (nrog Duab)
Raspberry Pi CPU Qhov Ntsuas Kub: 11 Kauj Ruam (nrog Duab)

Video: Raspberry Pi CPU Qhov Ntsuas Kub: 11 Kauj Ruam (nrog Duab)

Video: Raspberry Pi CPU Qhov Ntsuas Kub: 11 Kauj Ruam (nrog Duab)
Video: Начало → Изучайте английский → Освойте ВСЕ ОСНОВЫ АНГЛИЙСКОГО ЯЗЫКА, которые вам НУЖНО знать! 2024, Kaum ib hlis
Anonim
Raspberry Pi CPU Qhov Ntsuas Kub
Raspberry Pi CPU Qhov Ntsuas Kub

Yav dhau los kuv tau qhia txog raspberry pi yooj yim (hauv qab no raws li RPI) kev ua haujlwm raws qhov ntsuas qhov ntsuas hluav taws xob.

Lub sijhawm no, Kuv yuav piav qhia qee qhov txiaj ntsig qhia tau ntau ntxiv rau RPI ua haujlwm tsis muaj lub taub hau (tsis muaj tus saib xyuas).

Lub Circuit Court saum toj no qhia CPU kub rau hauv 4 qib sib txawv xws li:

- Ntsuab LED qhib thaum CPU kub nyob hauv 30 ~ 39 degree

- Daj LED qhia qhov kub tau nce ntxiv ntawm 40 txog 45 degree

- Peb Liab Liab qhia CPU ua rau kub me ntsis los txog 46 ~ 49 degree

- Lwm Liab LED yuav ntsais thaum kub ntau tshaj 50 degree

Qhov ntsuas kub ntawm CPU saum toj no yog kuv lub tswv yim tsim tus kheej (Lwm qhov kub thiab txias tuaj yeem tsim kho los ntawm kev hloov pauv cov xwm txheej ntawm nab hab sej program uas tswj qhov Circuit no).

Los ntawm kev siv lub voj voog no, koj tsis tas yuav ua tiav "vcgencmd measure_temp" hais kom nquag nquag ntawm lub davhlau ya nyob twg.

Lub voj voog no yuav tsum qhia CPU qhov kub tam sim no tsis tu ncua thiab yooj yim.

Kauj Ruam 1: Npaj Schematics

Npaj Schematics
Npaj Schematics

Txawm hais tias koj tuaj yeem tswj tau 4 LEDs ncaj qha los ntawm kev siv tsuas yog cov nab npawb nab npawb, tswj cov laj thawj ntawm qhov haujlwm yuav thauj RPI thiab vim li ntawd, CPU kub yuav nce ntxiv vim tias koj yuav tsum tau ua haujlwm me ntsis nyuaj sej code tsis tu ncua.

Yog li ntawd, kuv tab tom txo qis sej txoj cai nyuaj li yooj yim li sai tau thiab tawm-thau khoom LED tswj cov laj thawj rau sab nraud kho vajtse Circuit.

CPU ntsuas qhov ntsuas kub (tom ntej no INICATOR) Circuit muaj nrog cov ntu hauv qab no.

-Ob lub opto-couplers txuas nrog RPI GPIO pins kom tau txais cov ntaub ntawv ntsuas kub xws li 00-> LOW, 01-> Nruab Nrab, 10-> Siab, 11-> Xav tau txias.

-74LS139 (lossis 74HC139, 2-rau-4 decoder thiab de-multiplexer) tswj cov zis (Y0, Y1, Y2, Y3) raws li cov tswv yim (A, B)

- Thaum qhov kub nyob hauv 30 ~ 39 degree, nab nab tso tawm code 00 rau GPIO pins. Yog li ntawd, 74LS139 tau txais cov ntaub ntawv 00 (A-> 0, B-> 0)

- Raws li 00 nkag mus, Y0 cov zis dhau los LOW. (Thov xa cov lus tseeb ntawm 74LS139)

- Thaum Y0 cov zis dhau los qis, nws ua rau 2N3906 PNP transistor thiab vim li ntawd, Ntsuab LED tau qhib

- Zoo ib yam, Y1 (01 -> CPU kub nruab nrab) yuav tsum tig rau daj LED thiab ntxiv rau

- Thaum Y3 dhau los LOW, DB140 qhib NE555 LED ntsais muag Circuit (qhov no yog ib txwm 555 IC raws li LED ntsais muag) uas yog thauj ntawm BD140 PNP transistor

Qhov tseem ceeb tshaj plaws ntawm Circuit no yog 74LS139 uas txiav txim siab 2 tus lej nkag rau hauv 4 qhov sib txawv tso tawm raws li qhia hauv cov lus tseeb hauv qab no.

Tswv yim | Tso zis

G (Pab kom) | IB | Ib | Y0 | Y1 | Y2 | Y3 |

H | X | X | H | H | H | H |

L | ua L | ua L | ua L | ua H | H | H |

L | ua L | ua H | H | L | ua H | H |

L | ua H | L | ua H | H | L | ua H |

L | ua H | H | H | H | H | L | ua

Raws li 74LS139 cov zis dhau los qis, PNP hom transistor tuaj yeem ua kom yooj yim Circuit Court raws li PNP transistor tau qhib thaum lub hauv paus pib ua LOW. (Kuv yuav qhia NPN version ntawm qhov kawg ntawm zaj dab neeg no)

Raws li 100K lub zog ntsuas tau suav nrog NE555 LED ntsais muag Circuit Court, Liab LED ON/OFF lub sijhawm tuaj yeem hloov kho dawb raws li qhov xav tau.

Kauj Ruam 2: Ua PCB Teeb Duab

Ua PCB Teeb duab
Ua PCB Teeb duab

Raws li cov phiaj xwm kev ua haujlwm ntawm INDICATOR tau piav qhia, cia pib ua qhov Circuit.

Ua ntej yuav muag ib yam dab tsi ntawm lub rooj tsav xwm thoob ntiaj teb, npaj PCB daim duab uas tau hais los saud tau pab txo qis qhov ua yuam kev.

Kev kos duab yog tsim los ntawm kev siv lub zog taw tes txhawm rau nrhiav txhua ntu ntawm lub rooj tsav xwm thoob ntiaj teb thiab ua cov qauv thaiv ntawm ib feem nrog cov xov hlau.

Raws li IC thiab transistor tus pin-tawm cov duab tau nyob ua ke nrog PCB cov qauv thaiv, kev siv lub tshuab tuaj yeem ua tiav siv daim duab no.

Kauj ruam 3: Soldering

Soldering
Soldering

Txawm hais tias thawj daim duab PCB tau tsim los tsis siv ib lub xov hlau los txuas cov khoom sib txuas ntawm PCB, Kuv tau siv qhov sib txawv me ntsis.

Los ntawm kev siv ib tus neeg xyuas pib ntawm cov xov hlau (tsis yog xaim hlau), Kuv tab tom sim txo qis PCB qhov loj me uas muaj INDICATOR Circuit.

Tab sis raws li koj tuaj yeem pom ntawm sab laug ntawm PCB, Kuv tab tom siv hlau xaim kuj raws li cov qauv qhia hauv PCB daim duab.

Thaum txhua qhov kev sib txuas tau txuas nrog raws li tus qauv tsim ntawm PCB daim duab, ua kom tiav cov laug cam PCB suav nrog INDICATOR Circuit yuav ua haujlwm kom raug.

Kauj Ruam 4: Xeem Kev Npaj

Kev Npaj Xeem
Kev Npaj Xeem

Ua ntej mus rau RPI kev sib txuas, kev ua tiav Circuit Court xav tau kev sim.

Raws li txhua qhov ua yuam kev tuaj yeem tshwm sim, DC lub tshuab xa hluav taws xob tau siv los tiv thaiv kev puas tsuaj thaum luv lossis kab tsis raug tshwm sim.

Rau kev sim ntawm INDICATOR, ob txoj hlua txuas hluav taws xob txuas ntxiv txuas rau Circuit 5V lub zog txuas txuas.

Kauj Ruam 5: Xeem (CPU Kub Yog Qib Nruab Nrab)

Kev Xeem (CPU Kub Yog Qib Nruab Nrab)
Kev Xeem (CPU Kub Yog Qib Nruab Nrab)

Thaum tsis muaj 5V cov tswv yim siv ces 74LS139 txiav txim siab cov tswv yim thiab qhib lub zog Y0 li LOW (Ntsuab LED qhib).

Tab sis 5V tau thov rau cov tswv yim A, tso tawm Y1 ntawm 74LS139 qhib (LOW).

Yog li ntawd, Daj LED tau qhib raws li qhia hauv daim duab saum toj no.

Kauj Ruam 6: Kev Xeem (CPU Xav Tau Txias Qib)

Kev Xeem (CPU Xav Tau Txaus Siab)
Kev Xeem (CPU Xav Tau Txaus Siab)

Thaum 5V siv ob qho kev nkag (A thiab B) ntawm 74LS139, Plaub Liab LED tab tom ntsais muag.

Qhov kev ntsais muag tuaj yeem hloov pauv los ntawm kev kho 100K VR raws li qhia hauv daim duab saum toj no.

Thaum qhov kev xeem ua tiav, ob lub Molex 3 tus pin poj niam tuaj yeem tshem tawm tau.

Kauj Ruam 7: Lub Hwj Huam Fais Fab rau INDICATOR Circuit

Lub Hwj Huam Fais Fab rau INDICATOR Circuit
Lub Hwj Huam Fais Fab rau INDICATOR Circuit

Rau kev ua kom muaj zog INDICATOR Circuit, Kuv siv ntau lub xov tooj tes them uas tso tawm 5V thiab USB hom-B adapter raws li qhia hauv daim duab saum toj no.

Txhawm rau zam qhov teeb meem nrog RPI los ntawm kev txuas 3.3V GPIO thiab 5V siv INDICATOR Circuit, teeb liab cuam tshuam thiab lub zog siv hluav taws xob tau sib cais ib leeg.

Kauj Ruam 8: RPI Txuas

RPI Kev Txuas
RPI Kev Txuas

Txhawm rau cuam tshuam INDICATOR Circuit nrog RPI, ob lub GPIO pins yuav tsum tau mob siab rau nrog ob tus pin hauv av.

Tsis muaj qhov tshwj xeeb xav tau rau xaiv GPIO pins.

Koj tuaj yeem siv ib qho GPIO pins rau txuas INDICATOR.

Tab sis cov xov hlau txuas yuav tsum raug xaiv los ua tswv yim rau 74LS139 (piv txwv li A, B) hauv qhov kev pab cuam sej.

Kauj Ruam 9: Txoj Haujlwm Python

Python Program
Python Program

Raws li kev ua haujlwm tiav, ua kom muaj kev pab cuam nab nab yuav tsum siv INDICATOR ua haujlwm.

Thov saib daim ntawv qhia ntws saum toj no kom paub ntau ntxiv txog qhov program logic.

#-*-coding: utf-8-*-

ntshuam subprocess, teeb liab, sys

ntshuam lub sij hawm, re

ntshuam RPi. GPIO li g

A = 12 hli

IB = 16

g.setmode (g. BCM)

g.setup (A, g. OUT)

g.setup (B, g. OUT)

##

def signal_handler (sig, thav duab):

print ('Koj nias Ctrl+C!')

g.output (A, Cuav)

g.output (B, Cuav)

f.close ()

sys.exit (0)

signal.signal (signal. SIGINT, signal_handler)

##

thaum Muaj Tseeb:

f = qhib ('/home/pi/My_project/CPU_temperature_log.txt', 'a+')

temp_str = subprocess.check_output ('/opt/vc/bin/vcgencmd ntsuas_temp', plhaub = Tseeb)

temp_str = temp_str.decode (encoding = 'UTF-8', yuam kev = 'nruj')

CPU_temp = re.findall ("\ d+\. / D+", tem_str)

# rho tawm CPU kub tam sim no

current_temp = ntab (CPU_temp [0])

yog current_temp> 30 thiab current_temp <40:

# kub tsawg A = 0, B = 0

g.output (A, Cuav)

g.output (B, Cuav)

sijhawm.sleep (5)

elif current_temp> = 40 thiab current_temp <45:

# kub nruab nrab A = 0, B = 1

g.output (A, Cuav)

g. tawm (B, Tseeb)

sijhawm.sleep (5)

elif current_temp> = 45 thiab current_temp <50:

# kub siab A = 1, B = 0

g.output (A, Tseeb)

g.output (B, Cuav)

sijhawm.sleep (5)

elif current_temp> = 50:

# CPU txias yuav tsum tau siab A = 1, B = 1

g.output (A, Tseeb)

g. tawm (B, Tseeb)

sijhawm.sleep (5)

current_time = sijhawm.time ()

formated_time = time.strftime ("%H:%M:%S", time.gmtime (tam sim no_time))

f.write (str (formated_time)+'\ t'+str (current_temp)+'\ n')

f.close ()

Lub luag haujlwm tseem ceeb ntawm kev pab cuam nab nab yog zoo li hauv qab no.

- Ua ntej teeb tsa GPIO 12, 16 ua qhov chaw nres nkoj tso tawm

- Txheeb cais Ctrl+C cuam tshuam tus neeg tuav haujlwm rau kaw cov ntaub ntawv kaw thiab tua GPIO 12, 16

- Thaum nkag mus rau qhov tsis muaj qhov kawg, qhib cov ntaub ntawv teev cia ua hom ntxiv

- Nyeem CPU kub los ntawm kev ua "/opt/vc/bin/vcgencmd measure_temp" hais kom ua

- Thaum ntsuas kub nyob hauv thaj tsam 30 ~ 39 ces tso tawm 00 kom qhib Green LED

- Thaum ntsuas kub nyob hauv thaj tsam 40 ~ 44 tom qab ntawv tso tawm 01 kom tig daj daj

- Thaum ntsuas kub nyob hauv thaj tsam 45 ~ 49 tom qab ntawd tso tawm 10 kom qhib lub Liab LED

- Thaum ntsuas kub ntau dua 50 ces tso tawm 11 kom Red LED ntsais muag

- Sau lub sijhawm thwj cim thiab cov ntaub ntawv ntsuas kub mus rau hauv cov ntaub ntawv teev cia

Kauj Ruam 10: Qhia Tus Kheej

INDICATOR Kev Ua Haujlwm
INDICATOR Kev Ua Haujlwm

Thaum txhua yam zoo, koj tuaj yeem pom txhua lub LED tau qhib lossis ntsais muag raws li CPU kub.

Koj tsis tas yuav nkag mus rau lub plhaub hais kom ntsuas qhov ntsuas kub tam sim no.

Tom qab sau cov ntaub ntawv hauv cov ntaub ntawv teev tseg thiab xa cov ntaub ntawv cov ntaub ntawv rau hauv daim duab los ntawm kev siv Excel, qhov tshwm sim tau pom hauv daim duab saum toj no.

Thaum thov kev thauj khoom siab (Khiav ob lub Midori Browsers thiab ua yeeb yaj kiab Youtube), CPU kub nce mus txog 57.9C.

Kauj Ruam 11: Kev Ua Lwm Yam (Siv NPN Transistor) thiab Kev Txhim Kho Ntxiv

Kev Ua Lwm Yam (Siv NPN Transistor) thiab Kev Txhim Kho Ntxiv
Kev Ua Lwm Yam (Siv NPN Transistor) thiab Kev Txhim Kho Ntxiv

Qhov no yog qhov piv txwv yav dhau los qhov project piv txwv siv NPN transistors (2N3904 thiab BD139).

Raws li koj tuaj yeem pom ib qho ntxiv IC (74HC04, Quad invertors) yog qhov tsim nyog los tsav NPN transistor li HIGH qib hluav taws xob yuav tsum tau siv rau lub hauv paus ntawm NPN kom tig rau transistor.

Raws li cov ntsiab lus, siv NPN transistor ntxiv qhov nyuaj uas tsis tsim nyog los ua INDICATOR Circuit.

Txog kev txhim kho ntxiv ntawm txoj haujlwm no, Kuv yuav ntxiv cov kiv cua txias raws li qhia hauv daim duab saum toj no kom ua INDICATOR Circuit zoo dua.

Pom zoo: