Cov txheej txheem:

Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker: 6 Kauj Ruam
Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker: 6 Kauj Ruam

Video: Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker: 6 Kauj Ruam

Video: Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker: 6 Kauj Ruam
Video: Nastya and Watermelon with a fictional story for kids 2024, Kaum ib hlis
Anonim
Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker
Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker

Peb paub tias peb tuaj yeem tuag txhua lub sijhawm, txawm tias kuv tuaj yeem tuag thaum sau cov ntawv no, tom qab tag nrho, kuv kuv, koj, peb txhua tus yog neeg tuag. Tag nrho lub ntiaj teb tau tshee vim yog COVID19 muaj thoob qhov txhia chaw. Peb paub yuav tiv thaiv qhov no li cas, tab sis hav! peb paub yuav thov li cas thiab vim li cas thiaj thov Vajtswv, peb puas ua txhua hnub? Tsis yog !! Qhov tseeb, peb tsis nco qab lub hauv paus yog vim li cas peb yuav tsum ua tej yam. Yog li, peb paub tias kev noj zaub mov zoo tuaj yeem cawm peb tau tab sis peb tsis ua nws kom raug. Xav txog rooj plaub ntawm kuv tus kwv yau, nws xav tawm mus thiab ua si txawm tias nyob rau lub sijhawm no. Kuv yuav tsum tau ua qee yam kom tsis tu ncua qhia rau txhua tus paub txog qhov xwm txheej tshiab ntawm COVID19. Yog li, kuv tau ua lub digial rooj tso saib uas qhia pom qhov tseeb ntawm COVID19 nyob rau lub sijhawm tiag. Raws li qhov no muaj lub moos ces kuv tuaj yeem tso nws rau hauv qhov chaw uas txhua tus tuaj sib sau lossis tuaj. Lawv yuav pom cov lej ntxiv, uas yuav ua rau muaj kev paub hauv lawv thiab vam tias txhua tus yuav paub. Tsis tas li kuv yog tus tsim khoom thiab nyiam ua haujlwm, qhov no tau dhau los ua qhov haujlwm zoo los ua haujlwm hauv qhov kev sib tham kaw.

Kauj Ruam 1: Qhov Chaw Kuv Tau Siv:

Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
Qhov Kuv Tau Siv
  • Raspberry Pi 3 Qauv B (khau raj siv daim npav SD)
  • Raspberry Pi UPS module (xaiv tau)
  • 7 nti HDMI LCD Screen
  • HDMI rau HDMI cable (qhov no los nrog lub vijtsam)
  • USB kab
  • 5v 2A lub zog hloov pauv (kom lub zog pi)
  • PVC ntawv [ntoo xim] (los ua lub cev)

Kauj Ruam 2: Teeb Raspberry Pi:

Teeb Raspberry Pi
Teeb Raspberry Pi

Kuv twv koj tau teeb tsa pi zoo kawg nkaus, tshwj tsis yog koj tsis tau -

  1. tau txais daim npav SD - ntau dua 8 GB
  2. download tau cov ntaub ntawv raspbian iso tshiab los ntawm no.
  3. Hlawv daim npav SD siv lwm yam

(Nco ntsoov tias tib neeg tuaj yeem hais txog lwm yam software uas xav kom koj ua qee yam teeb tsa tab sis lwm yam yog qhov yooj yim siv thiab yooj yim tab sis muaj txiaj ntsig ib yam.)

Tsuas yog ntsaws koj daim npav SD rau lub PC, khiav lwm yam, koj yuav pom daim npav SD tau xaiv los ntawm lwm qhov, tom qab ntawv nyem rau xaiv lub iso rub tawm los yog duab, tom qab ntawd hlawv nws. Tom qab ua tiav kev sau ntawv thiab ua haujlwm tshem tawm daim npav SD thiab txuas nws rau koj tus pi, siv nws thiab VOILA !! Nws ciaj sia.

Kauj Ruam 3: Daim Duab Circuit:

Daim duab kos duab
Daim duab kos duab

Txuas txhua yam thiab ua kom muaj zog raspbery pi, nws tsuas yog txuas, tsis muaj dab tsi ntxiv.

Koj yuav pom pi booting.

Kauj Ruam 4: Lub Cev:

Lub Cev
Lub Cev
Lub Cev
Lub Cev
Lub Cev
Lub Cev
Lub Cev
Lub Cev

Kuv txiav ib daim ntawv PVC raws li cov zaub loj, tom qab ntawd ntxiv nws siv cov ntsia hlau. Tom qab ntawd kuv txuas txhua yam. Thaum kawg ntxiv lwm daim ntawv tom qab los txhawb nws kom poob (daim ntawv xiav). Yog tias txhua yam zoo, koj yuav tsum pom pi booting (daim duab kawg)

Kauj Ruam 5: Software (Source Code):

Qhov kev zov me nyuam tau sau ua sej 3. Txog GUI (Cov Neeg Siv Duab Duab) Kuv siv PyQt5, thiab txhawm rau rho tawm cov ntaub ntawv COVID19 lub sijhawm tiag tiag kuv siv COVID19Py lub tsev qiv ntawv. Ua tsaug rau cov hais mav uas ua tus API muaj rau peb

Qhov ntawd zoo nkauj heev, tam sim no qhib rau Terminal ntawm raspberry pi thiab teeb tsa cov tsev qiv ntawv (luam txhua tus ntawm lawv thiab muab tshuaj txhuam rau ntawm rpi davhlau ya nyob twg).

Tsis quav ntsej $ kos npe thaum luam

$ pip3 nruab pyqt5

$ pip3 teeb tsa thov $ pip3 nruab covid19py

Qhov ntawd yog nws, tam sim no rub tawm cov cai los ntawm no, Kuv tau muab cov cai hauv qab no:

"" "*Realtime Covid19 International thiab Local Tracker With Clock*" "" "" "************** Nyob Hauv Tsev Nyob Nyab Xeeb. Nyob, cia Nyob ******** ***** "" "" Yog

"""

sau: ashraf minhaj mail: [email protected] site: ashrafminhajfb.blogspot.com """

#import cov tsev qiv ntawv uas tsim nyog

ntshuam PyQt5 #QT GUI Library rau python3 los ntawm PyQt5. QtCore ntshuam Qt, QTimer #timer hloov kho los ntawm PyQt5. QtWidgets import * #import txhua yam los ntawm PyQt5. QtGui import QFont #rau fonts ntshuam sys #xav tau rau QT daim ntawv thov #import os ntshuam COVID19Py #covid19 cov ntaub ntawv -api ntshuam sijhawm #koj paub dab tsi qhov no yog rau

chav kawm CoronaTracker (QWidget):

"" "chav kawm tseem ceeb uas muaj txhua yam" "" def _init _ (tus kheej): "" "pib ua tej yam" "" super ()._ init _ () self.covid = COVID19Py. COVID19 () #initialize self.timer = QTimer () #initialize self.timer.timeout.connect (self.update) #if timer nce mus txog qhov pib - hu hloov tshiab self.ui () #user interface

def ui (tus kheej):

"" "Tus Neeg Siv Kev Sib Txuas" "" self.setWindowTitle ("Covid19 International thiab Local Tracker") #self.setWindowFlags (Qt. CustomizeWindowHint) #hide title bar self.setStyleSheet ("Background-color: black") self.setFixedSize (640, 480) #as rau kuv cov zaub (x, y) /rpi daws teeb meem

#cov ntawv tseem ceeb

self.banner_label = QLabel (tus kheej) self.banner_label.setGeometry (50, 5, 560, 50) #(x_origin, y_origin, till_x, till_y) self.banner_label.setText ("CORONA Pandemic - COVID19 TRACKER") self.banner_ab. setFont (QFont ('SansSerif', 20)) self.banner_label.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: dawb; ciam teb-style: pib; ciam teb-dav: 1px" "")

"" "_ Ntiaj teb cov ntaub ntawv tshiab kawg _" ""

#ntiaj teb daim ntawv self.w = QLabel (tus kheej) self.w.setGeometry (200, 55, 400, 40) self.w.setText ("Ntiaj Teb Ib Zaug") self.w.setFont (QFont ('SansSerif', 18)) self.w.setStyleSheet ("" "keeb kwm yav dhau xim: dub; xim: xiav; ciam teb-style: pib; ciam teb dav: 1px" "")

#Cov xwm txheej thoob ntiaj teb tau lees paub

self.w_cases = QLabel (tus kheej) self.w_cases.setGeometry (5, 90, 100, 40) self.w_cases.setText ("Cases:") self.w_cases.setFont (QFont ('SansSerif', 18)) self. w_cases.setStyleSheet ("" "keeb kwm yav dhau xim: dub; xim: txiv kab ntxwv; ciam teb-style: pib; ciam teb dav: 1px" "") #cov xov tooj tus kheej.w_cases_num = QLabel (tus kheej) tus kheej.w_cases_num.setGeometry (110, 90, 100, 40) self.w_cases_num.setFont (QFont ('SansSerif', 18)) self.w_cases_num.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: dawb; ciam teb-style: outset; ciam teb-dav: 1 px "" ")

#Txoj kev tuag thoob ntiaj teb

self.w_death = QLabel (tus kheej) self.w_death.setGeometry (350, 90, 100, 40) self.w_death.setText ("Tuag:") self.w_death.setFont (QFont ('SansSerif', 18)) self. w_death.setStyleSheet ("" "keeb kwm yav dhau xim: dub; xim: liab; ciam teb-style: pib; ciam teb dav: 1px" "") #tus lej tuag tus kheej.w_death_num = QLabel (tus kheej) tus kheej.w_death_num.setGeometry (460, 90, 100, 40) self.w_death_num.setFont (QFont ('SansSerif', 18)) self.w_death_num.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: dawb; ciam teb-style: outset; ciam teb-dav: 1 px "" ")

#ntiaj teb kho tau

self.w_cured = QLabel (tus kheej) self.w_cured.setGeometry (5, 140, 100, 40) self.w_cured.setText ("Kho:") self.w_cured.setFont (QFont ('SansSerif', 18)) tus kheej. w_cured.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: cyan; ciam teb-style: pib; ciam teb dav: 1px" "")

#Tus lej kho thoob ntiaj teb

self.w_cured_num = QLabel (tus kheej) self.w_cured_num.setGeometry (110, 140, 100, 40) self.w_cured_num.setFont (QFont ('SansSerif', 18)) self.w_cured_num.setStyleSheet ("" keeb kwm yav dhau xim: dub; xim: dawb; ciam teb-style: pib; ciam teb dav: 1px "" ")

"" "_ Local-By Country Code_" ""

#local - Lub teb chaws tus kheej.c = QLabel (tus kheej) self.c.setGeometry (170, 200, 400, 40) self.c.setText ("Kuv Lub Tebchaws: Bangladesh") self.c.setFont (QFont ('SansSerif', 18)) self.c.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: dawb; ciam teb-style: pib; ciam teb-dav: 1px" "") #thaj chaw paub tseeb cov neeg mob tus kheej.c_cases = QLabel (tus kheej) self.c_cases.setGeometry (5, 240, 400, 40) self.c_cases.setText ("Cases:") self.c_cases.setFont (QFont ('SansSerif', 18)) self.c_cases.setStyleSheet ("" "keeb kwm yav dhau -color: dub; xim: txiv kab ntxwv; ciam teb-style: pib; ciam teb dav: 1px "" ") #cov neeg nyob hauv tus lej tus kheej.c_cases_num = QLabel (tus kheej) tus kheej.c_cases_num.setGeometry (110, 240, 100, 40) self.c_cases_num.setFont (QFont ('SansSerif', 18)) self.c_cases_num.setStyleSheet ("" "keeb kwm yav dhau xim: dub; xim: dawb; ciam teb-style: pib; ciam teb dav: 1px" "")

#cov neeg tuag hauv nroog

self.c_death = QLabel (tus kheej) self.c_death.setGeometry (350, 240, 100, 40) self.c_death.setText ("Tuag:") self.c_death.setFont (QFont ('SansSerif', 18)) self. c_death.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: liab; ciam teb-style: pib; ciam teb dav: 1px" "")

#tus lej tuag hauv ib cheeb tsam

self.c_death_num = QLabel (tus kheej) self.c_death_num.setGeometry (460, 240, 100, 40) self.c_death_num.setFont (QFont ('SansSerif', 18)) self.c_death_num.setStyleSheet ("" keeb kwm yav dhau xim: dub; xim: dawb; ciam teb-style: pib; ciam teb dav: 1px "" ") #clocal kho tus kheej.c_cured = QLabel (tus kheej) self.c_cured.setGeometry (5, 280, 100, 40) self.c_cured. setText ("Kho:") self.c_cured.setFont (QFont ('SansSerif', 18)) self.c_cured.setStyleSheet ("" "keeb kwm yav dhau xim: dub; xim: cyan; ciam teb-style: pib; ciam teb dav: 1px "" ") #local kho tus lej self.c_cured_num = QLabel (tus kheej) self.c_cured_num.setGeometry (110, 280, 100, 40) self.c_cured_num.setFont (QFont ('SansSerif', 18)) self.c_cured_num.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: dawb; ciam teb-style: pib; ciam teb-dav: 1px" "")

"" "_Time, Hnub, Sijhawm _" ""

#clock tus kheej.clock = QLabel (tus kheej) self.clock.setGeometry (115, 340, 400, 70) self.clock.setFont (QFont ('SansSerif', 60)) self.clock.setStyleSheet ("" "keeb kwm yav dhau) xim: dub; xim: dawb; ciam teb-style: pib; ciam teb dav: 1px "" ") #label rau hnub ua haujlwm rau tus kheej.weekday = QLabel (tus kheej) tus kheej.weekday.setGeometry (5, 360, 110, 20) tus kheej.weekday.setFont (QFont ('SansSerif', 13)) self.weekday.setStyleSheet ("" "keeb kwm yav dhau-xim: dub; xim: dawb; ciam teb-style: outset; ciam teb-dav: 1px" "") #date label self.date = QLabel (tus kheej) self.date.setGeometry (510, 360, 110, 20) #self.clock.setText ("22:49:00") self.date.setFont (QFont ('SansSerif', 13)) self.date.setStyleSheet ("" "keeb kwm yav dhau xim: dub; xim: dawb; ciam teb-style: pib; ciam teb-dav: 1px" "")

#xyuas lub timer yog tias tsis yog tus kheej.timer.isActive (): #yog lub sijhawm ua haujlwm tau nres (mus txog qhov pib) #Tom qab 1 thib ob (kwv yees) lossis 1000ms

sim:

"" "sim kom tau txais cov ntaub ntawv, lwm tus khiav txoj cai lawm" "" self.latest = self.covid.getLatest () #gte covid19 cov ntaub ntawv tshiab

#tau txais cov ntaub ntawv tshiab los ntawm lub tebchaws chaws 'BD'-Bangladesh, 'IN'-India thiab lwm yam

self.local = self.covid.getLocationByCountryCode ('BD', ncua sij hawm = tsis tseeb) #print (self.local) #print (self.latest)

tshwj tsis yog:

"" "tsis tuaj yeem tau txais cov ntaub ntawv" "" luam tawm ("Internet yuam kev !!")

dhau #ignore, khiav lawm

self.timer.start (1000) #pib lub sijhawm

self.show () #qhia peb cov neeg siv cuam tshuam

def hloov tshiab (tus kheej):

"" "hloov tshiab cov ntawv nrog cov ntaub ntawv" ""

"" "_Extract ad Update Sijhawm thiab Hnub Qhia Txog Hnub Tim" """

#teeb tsa lub moos thiab sijhawm sijhawm (hloov kho qhov tseem ceeb) #tau txais thiab hloov kho qhov muaj txiaj ntsig #kom paub ntau nyeem cov ntaub ntawv nab npawb hnub tim

self.dt = datetime.datetime.now () #tau txais cov ntaub ntawv datetime

self.clock.setText (self.dt.strftime ('%X')) self.weekday.setText (self.dt.strftime ('%A')) self.date.setText (self.dt.strftime ('% x ')) "" "_ hloov kho covid19 cov ntaub ntawv_" "" #ntiaj teb cov ntaub ntawv tshiab kawg self.w_cases_num.setText (str (self.latest [' tau lees paub ']))) self.w_death_num.setText (str (self.latest [' tuag '])) self.) self.c_death_num.setText (str (self.local [0] ['tseeb'] ['tuag'])) self.c_cases_num.setText (str (self.local [0] ['tseeb'] ['paub tseeb'])))

print ("hloov tshiab")

rov qab

def lub ntsiab (): app = QApplication (sys.argv) yeej = CoronaTracker () #instantiate sys.exit (app.exec ()) #khiav daim ntawv thov yog _name_ == '_main_': main ()

Kauj Ruam 6: Ua Kom tiav:

Ua tiav
Ua tiav

Tom qab kuaj cov cai kuv muab tso rau hauv lub rooj thiab muab lub zog siv rau nws. Yog li nws tuaj yeem ua haujlwm thaum them nyiaj. Los ntawm kev siv qhov no tuaj yeem ua haujlwm txawm tias nyob hauv kev thauj khoom ib yam nkaus, qhov no muab rau koj daim npav SD daim npav tiv thaiv zoo ib yam.

Txawm li cas los peb yog leej twg, peb yuav tsum tuag. Cia peb tsis xav txog koj tus kheej, xav txog lub ntiaj teb. Peb tsuas tuaj yeem nyob mus ib txhis los ntawm peb cov kev ua, cia nws ua li ntawd.

Pom zoo: