Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Particulate Matter (PM): Nws Yog Dab Tsi? Nws Ua Li Cas Rau Hauv Huab Cua?
- Kauj Ruam 2: Vim Li Cas Nws Tseem Ceeb Kom Saib Xyuas Cov Teeb Meem No?
- Kauj Ruam 3: Qhov Tseeb Sensor - SDS011
- Kauj Ruam 4: Tab sis Yuav ua li cas SDS011 tuaj yeem ntes cov khoom ntawd?
- Kauj ruam 5: Sijhawm Qhia Tawm
- Kauj Ruam 6: Kev Ntsuas Huab Cua Zoo - AQI
- Kauj Ruam 7: Txheeb Cov Ntaub Ntawv Hauv Zos
- Kauj Ruam 8: Xa Cov Ntaub Ntawv mus rau Kev Pabcuam Huab
- Kauj Ruam 9: MQTT raws tu qauv thiab ThingSpeak Kev Sib Txuas
- Kauj ruam 10: MQTT Tshaj Tawm
- Kauj Ruam 11: Tsab Ntawv Kawg
- Kauj Ruam 12: Ua Tus Saib Xyuas Sab Nraud
- Kauj Ruam 13: Cov Roj Roj Hluav Taws Xob
- Kauj Ruam 14: Ntoo Ntoo
- Kauj Ruam 15: Xaus
Video: Tus nqi qis IoT Air Quality Monitor Raws li RaspberryPi 4: 15 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Santiago, Chile thaum lub caij ntuj no ib puag ncig xwm txheej kub ntxhov muaj txoj cai nyob hauv ib lub tebchaws zoo nkauj tshaj plaws hauv ntiaj teb, tab sis hmoov tsis, nws tsis yog txhua lub paj. Chile thaum lub caij ntuj no raug kev txom nyem ntau nrog huab cua sib kis, feem ntau yog los ntawm cov khoom siv ua hmoov av thiab pos huab.
Vim tias huab cua txias, nyob rau sab qab teb, huab cua sib kis feem ntau yog los ntawm cov ntoo calefactors thiab hauv Santiago (lub peev txheej tseem ceeb nyob hauv nruab nrab ntawm lub tebchaws) sib xyaw los ntawm kev lag luam, tsheb, thiab nws qhov xwm txheej tshwj xeeb ntawm 2 lub roob loj loj.
Niaj hnub no, huab cua muaj kuab paug yog teeb meem loj thoob plaws ntiaj teb thiab hauv kab lus no peb yuav tshawb xyuas yuav txhim kho tus saib xyuas huab cua hauv tsev uas tsis kim li cas, raws li Raspberry Pi. Yog tias koj xav nkag siab ntau ntxiv txog huab cua zoo, thov mus saib "World Air Quality Index" Project.
Khoom siv
- Raspberry Pi 4
- 1SDS011 - Siab precision laser pm2.5 huab cua ntsuas qhov ntsuas tau zoo
- Lub thawv yas
Kauj Ruam 1: Particulate Matter (PM): Nws Yog Dab Tsi? Nws Ua Li Cas Rau Hauv Huab Cua?
Yog li, txhawm rau nkag siab txog kev ua qias tuaj lossis huab cua sib kis, peb yuav tsum kawm cov khoom uas cuam tshuam nrog qhov ntawd, uas tseem hu ua teeb meem me me. Saib ntawm kab ntawv ntawm ntu dhau los peb tuaj yeem pom tias lawv hais txog PM2.5 thiab PM10. Cia peb muab cov ntsiab lus nrawm ntawm qhov ntawd.
PM sawv cev rau qhov teeb meem me me (tseem hu ua kev ua qias tuaj me me): lub sij hawm sib xyaw cov khoom sib xyaw thiab cov kua ua kua pom hauv huab cua. Qee qhov me me, xws li hmoov av, av, hmoov av, lossis pa luam yeeb, loj lossis tsaus ntuj txaus kom pom nrog qhov muag liab qab. Lwm tus yog qhov me me lawv tsuas tuaj yeem kuaj pom siv lub tshuab tsom hluav taws xob. Cov khoom tuaj hauv ntau qhov ntau thiab tsawg. Cov khoom me me tsawg dua lossis sib npaug li 10 micrometers txoj kab uas hla me me uas lawv tuaj yeem nkag mus rau hauv lub ntsws, ua rau muaj teeb meem kev noj qab haus huv loj. Kaum micrometers tsawg dua qhov dav ntawm tib neeg cov plaub hau.
Cov kuab paug me me suav nrog Cov hmoov av me me (PM10): nqus tau cov pa, nrog cov kab uas feem ntau 10 micrometers thiab me dua. Cov peev txheej suav nrog tsoo lossis ua haujlwm sib tsoo thiab plua plav ua los ntawm cov tsheb ntawm txoj kev. Cov khoom me me (PM2.5): cov hmoov nqus tau zoo, nrog cov kab uas feem ntau yog 2.5 micrometers thiab me dua. Cov khoom me me tau tsim los ntawm txhua hom kev sib txuas, suav nrog lub tsheb loj, cov tshuab hluav taws xob, cov ntoo nyob hauv tsev, hluav taws hauv hav zoov, kev ua liaj ua teb hlawv, thiab qee cov txheej txheem kev lag luam koj tuaj yeem pom ntau ntxiv txog qhov teeb meem ntawm EPA qhov chaw: Tebchaws Meskas Lub Chaw Tiv Thaiv Ib puag ncig
Kauj Ruam 2: Vim Li Cas Nws Tseem Ceeb Kom Saib Xyuas Cov Teeb Meem No?
Raws li tau piav qhia los ntawm GERARDO ALVARADO Z. hauv nws txoj haujlwm ntawm Chile University, kev tshawb fawb txog qhov xwm txheej ntawm huab cua muaj kuab paug nyob hauv Meuse Valley (Belgium) xyoo 1930, Donora (Pennsylvania) xyoo 1948 thiab London xyoo 1952 tau ua thawj cov ntaub ntawv hais txog kev tuag nrog cov kab mob sib kis (Préndez, 1993). Kev nce qib hauv kev tshawb xyuas qhov cuam tshuam ntawm huab cua ua paug rau tib neeg txoj kev noj qab haus huv tau txiav txim siab tias kev pheej hmoo kev noj qab haus huv yog tshwm sim los ntawm cov nqus tau nqus, nyob ntawm lawv nkag mus thiab tso rau hauv ntau ntu ntawm kev ua pa, thiab Biological teb rau cov khoom tso.
Cov tuab tuab tshaj plaws, kwv yees li 5 μm, raug lim los ntawm kev sib koom ua ke ntawm cilia ntawm lub qhov ntswg thiab qhov mucosa uas npog lub qhov ntswg thiab lub ntsws. Cov kab uas muaj txoj kab nruab nrab nruab nrab ntawm 0.5 thiab 5 μm tuaj yeem tso rau hauv cov hlab ntsws thiab txawm tias nyob hauv lub ntsws alveoli, txawm li cas los xij, lawv raug tshem tawm los ntawm cilia ntawm bronchi thiab bronchioles tom qab ob peb teev. Cov khoom me dua 0.5 μm tuaj yeem nkag mus tob heev kom txog thaum lawv tau tso rau hauv lub ntsws alveoli, tshuav li ntawm lub lis piam mus rau xyoo, vim tias tsis muaj lub tshuab mucociliary thauj uas pab txhawb kev tshem tawm. Daim duab hauv qab no qhia pom qhov nkag mus ntawm cov pa hauv cov pa ua pa nyob ntawm lawv qhov loj me.
Yog li, txhawm rau pom ob hom kab mob (PM2.5 thiab PM10) yog qhov tseem ceeb heev thiab cov xov xwm zoo yog tias ob qho tib si nyeem tau los ntawm qhov yooj yim thiab tsis kim sensor, SDS011.
Kauj Ruam 3: Qhov Tseeb Sensor - SDS011
Kev Saib Xyuas Huab Cua Zoo paub zoo thiab tsim kev tshawb fawb uas tau pib rov qab rau hauv 80's. Lub sijhawm ntawd, thev naus laus zis tau txwv, thiab kev daws teeb meem siv los ntsuas cov pa phem ua pa nyuaj, nyuaj thiab kim heev.
Hmoov zoo, niaj hnub no, nrog cov thev naus laus zis tshiab tshaj plaws thiab niaj hnub no, cov kev daws teeb meem siv rau Kev Saib Xyuas Huab Cua Zoo tau dhau los tsis yog qhov tseeb tab sis kuj nrawm dua ntawm kev ntsuas. Cov cuab yeej tau dhau los ua me dua, thiab raug nqi ntau dua li yav dhau los.
Hauv tsab xov xwm no peb yuav tsom mus rau lub ntsuas pa, uas tuaj yeem tshawb pom cov hmoov av hauv huab cua. Thaum thawj tiam neeg tsuas yog tuaj yeem txheeb pom qhov opacity, cov cuab yeej tshiab tam sim no zoo li SDS011 los ntawm INOVAFIT, tig tawm los ntawm University of Jinan (hauv Shandong), tam sim no tuaj yeem pom PM2.5 thiab PM10.
Nrog nws qhov loj me, SDS011 tej zaum yog ib qho zoo tshaj plaws ntsuas qhov ntsuas qhov tseeb thiab tus nqi (tsawg dua USD40.00).
- Ntsuas qhov ntsuas: PM2.5, PM10
- Ntau: 0-999.9 μg /m³
- Muab qhov hluav taws xob: 5V (4.7–5.3V)
- Kev siv fais fab (ua haujlwm): 70mA ± 10mA
- Kev siv fais fab (pw tsaug zog hom laser & kiv cua): <4mA
- Cia kub: -20 txog +60C
- Ua haujlwm kub: -10 txog +50C
- Vaum (cia): Max. 90%
- Vaum (ua haujlwm): Max. 70% (hws cov pa ua pa tsis raug nyeem)
- Qhov tseeb: 70% rau 0.3μm thiab 98% rau 0.5μm
- Loj: 71x70x23 mm
- Ntawv pov thawj: CE, FCC, RoHS
SD011 siv PCB ua ib sab ntawm cov ntaub thaiv, tso cai txo nws cov nqi. Lub receptor diode tau teeb tsa ntawm sab PCB (qhov no yuav tsum tau ua ib qho suab nrov ntawm diode thiab LNA yuav tsum zam). Lub tshuab hluav taws xob emitter tau teeb tsa ntawm lub thawv yas thiab txuas nrog PCB los ntawm cov xaim hloov pauv tau.
Hauv ntej, Nova Fitness SDS011 yog cov kws tshaj lij laser plua plav sensor. Kiv cua tau teeb tsa ntawm lub ntsuas hluav taws xob tau nqus cov pa. Lub ntsuas hluav taws xob siv lub hauv paus ntsiab lus ua lub teeb ci laser* txhawm rau ntsuas tus nqi ntawm cov plua plav tshem tawm hauv huab cua. Lub ntsuas hluav taws xob muab qhov ua tau zoo thiab nyeem tau zoo ntawm PM2.5 thiab PM10 qhov tseem ceeb. Ib qho kev hloov pauv hauv ib puag ncig tuaj yeem pom yuav luag tam sim lub sijhawm luv luv hauv qab 10 vib nas this. Lub ntsuas pa hauv tus qauv ntsuas qhia nyeem nrog lub sijhawm thib 1.
* Lub hauv paus ntsiab lus Laser tawg: Lub teeb tawg tuaj yeem raug ntxias thaum cov khoom hla mus rau thaj chaw kuaj pom. Lub teeb tawg tawg tau hloov pauv mus rau cov cim hluav taws xob thiab cov cim no yuav raug nthuav dav thiab ua tiav. Tus naj npawb thiab txoj kab uas hla ntawm cov khoom tuaj yeem tau los ntawm kev tshuaj xyuas vim tias lub teeb liab teeb tsa muaj qee yam kev sib raug zoo nrog txoj kab uas hla ntawm cov khoom.
Kauj Ruam 4: Tab sis Yuav ua li cas SDS011 tuaj yeem ntes cov khoom ntawd?
Raws li tau hais ua ntej, lub hauv paus ntsiab lus siv los ntawm SDS011 yog lub teeb tawg lossis zoo dua, Dynamic Light Scattering (DLS), uas yog txheej txheem hauv physics uas tuaj yeem siv los txiav txim siab qhov faib loj ntawm cov khoom me me hauv kev ncua lossis polymers hauv kev daws teeb meem. Hauv qhov dav ntawm DLS, kev hloov pauv ntawm lub cev feem ntau yog tshuaj xyuas los ntawm kev siv lossis photon auto-correlation muaj nuj nqi (tseem hu ua photon correlation spectroscopy lossis quasi-elastic light scattering). Hauv kev txheeb xyuas lub sijhawm, kev ua haujlwm sib cuam tshuam nrog tus kheej (ACF) feem ntau ploj mus pib los ntawm lub sijhawm ncua sijhawm qeeb, thiab kev hloov pauv sai dua vim tias cov khoom me me ua rau kev cuam tshuam zoo dua ntawm kev tawg tawg. Nws tau pom tias kev siv ACF yog Fourier hloov pauv ntawm lub zog siv hluav taws xob, thiab yog li ntawd kev ntsuas DLS tuaj yeem ua tau zoo ib yam ua tau zoo hauv thaj chaw ib puag ncig.
Saum toj no qhov kev xav ntawm lub teeb tawg tawg ntawm ob qhov piv txwv: Cov loj dua (zoo li PM10) nyob rau sab saud thiab me dua (raws li PM2.5) nyob hauv qab. Thiab saib sab hauv peb lub ntsuas cua, peb tuaj yeem pom yuav ua li cas lub hauv paus ntsiab lus ntawm lub teeb tawg.
Cov teeb liab hluav taws xob tau ntes ntawm lub diode mus rau Lub Suab nrov nrov qis thiab los ntawm qhov ntawd los hloov pauv mus rau lub teeb liab digital los ntawm ADC thiab sab nraud ntawm UART.
Txhawm rau paub ntau ntxiv txog SDS011 ntawm qhov kev paub tshawb fawb tiag tiag, thov ua tib zoo saib 2018 kev ua haujlwm ntawm Konstantinos li al, Kev Txhim Kho thiab Kev Xeem Ntawm Kev Tshawb Fawb ntawm Tus Nqi Nqi Nqis Portable rau Kev Saib Xyuas PM2.5 Kev Ntsuas.
Kauj ruam 5: Sijhawm Qhia Tawm
Cia peb so ntawm txhua qhov kev xav no thiab tsom mus rau ntsuas qhov teeb meem me me siv Raspberry Pi thiab SDS011 sensor
Qhov txuas HW yog qhov tseeb yooj yim heev. Lub ntsuas tau muag nrog USB adapter los cuam tshuam cov ntaub ntawv tso tawm los ntawm nws 7 pins UART nrog ib qho ntawm RPi tus qauv USB txuas.
SDS011 tus pinout:
- Pin 1 - tsis txuas nrog
- Pin 2 - PM2.5: 0-999μg/m³; PWM output
- Pin 3 - 5 V
- Pin 4 - PM10: 0-999 μg/m³; PWM output
- Pin 5 - GND
- Pin 6 - RX UART (TTL) 3.3V
- Pin 7 - TX UART (TTL) 3.3V
Txog qhov kev qhia no, Kuv tab tom siv thawj zaug, hom tshiab Raspberry-Pi 4. Tab sis tau kawg, txhua tus qauv dhau los kuj tseem yuav ua haujlwm zoo.
Sai li koj txuas lub sensor ntawm ib qho ntawm RPi USB chaw nres nkoj, koj cia li yuav pib mloog lub suab ntawm nws cov kiv cua. Lub suab nrov yog me ntsis thab plaub, yog li tej zaum koj yuav tsum tshem nws thiab tos kom txog thaum koj tau teeb tsa nrog SW.
Kev sib txuas lus ntawm lub ntsuas cua thiab RPi yuav dhau los ntawm cov txheej txheem. Cov ntsiab lus hais txog cov txheej txheem no tuaj yeem pom ntawm no: Laser Dust Sensor Control Protocol V1.3. Tab sis rau txoj haujlwm no, qhov zoo tshaj plaws yog siv tus nab hab sej interface txhawm rau ua kom yooj yim cov cai los tsim. Koj tuaj yeem tsim koj tus kheej lub interface lossis siv qee qhov uas muaj nyob hauv is taws nem, zoo li Frank Heuer lossis Ivan Kalchev's. Peb yuav siv qhov kawg, uas yooj yim heev thiab ua haujlwm tau zoo (koj tuaj yeem rub tawm sds011.py tsab ntawv los ntawm nws GitHub lossis kuv li).
Cov ntaub ntawv sds011.py yuav tsum yog nyob rau tib cov npe uas koj tsim koj tsab ntawv.
Thaum lub sijhawm txhim kho, Kuv yuav siv Jupyter Notebook, tab sis koj tuaj yeem siv ib qho IDE uas koj nyiam (Thonny lossis Geany, piv txwv li, uas yog ib feem ntawm Raspberry Pi Debian pob yog ob qho zoo heev).
Pib ntshuam sds011, thiab tsim koj li sensor piv txwv. SDS011 muab txoj hauv kev los nyeem los ntawm lub ntsuas ntsuas siv UART.
los ntawm sds011 ntshuam *
sensor = SDS011 ("/dev/ttyUSB0")
Koj tuaj yeem qhib lossis kaw koj lub sensor nrog kev hais kom tsaug zog:
pmt_2_5, pmt_10 = sensor.query ()
Tos tsawg kawg 10 vib nas this rau kev ruaj khov ua ntej ntsuas thiab tsawg kawg 2 vib nas this los pib qhov tshiab (saib cov cai saum toj no).
Thiab qhov no yog txhua yam koj xav paub txog SW los siv lub ntsuas. Tab sis cia mus tob dua ntawm Kev Tswj Xyuas Huab Cua! Thaum pib ntawm tsab xov xwm no, yog tias koj tau tshawb nrhiav cov vev xaib uas muab cov ntaub ntawv hais txog huab cua zoo lossis phem li cas, koj yuav tsum paub tias xim cuam tshuam nrog cov txiaj ntsig ntawd. Txhua xim yog Index. Qhov uas paub tshaj plaws yog AQI (Air Quality Index), siv hauv Asmeskas thiab ntau lub tebchaws.
Kauj Ruam 6: Kev Ntsuas Huab Cua Zoo - AQI
AQI yog qhov ntsuas rau tshaj tawm huab cua txhua hnub. Nws qhia koj tias huab cua huv npaum li cas lossis ua qias tuaj, thiab cuam tshuam txog kev noj qab haus huv zoo li cas yuav yog kev txhawj xeeb rau koj. AQI tsom mus rau kev noj qab haus huv uas koj tuaj yeem ntsib hauv ob peb teev lossis ntau hnub tom qab ua pa tsis huv.
EPA (Tebchaws Meskas Lub Chaw Tiv Thaiv Ib puag ncig), piv txwv li, suav AQI tsis yog rau cov pa phem (PM2.5 thiab PM10) tab sis kuj tseem rau lwm yam pa phem loj uas tau tswj hwm los ntawm Txoj Cai Huv Cua: hauv av ozone, carbon monoxide, sulfur dioxide, thiab nitrogen dioxide. Rau txhua qhov ntawm cov pa phem no, EPA tau tsim cov qauv huab cua hauv tebchaws los tiv thaiv kev noj qab haus huv rau pej xeem. Saib daim duab saum toj no nrog AQI qhov tseem ceeb, xim thiab lus noj qab haus huv cuam tshuam.
Raws li tau hais ua ntej cov AQI qhov tseem ceeb thiab xim muaj feem cuam tshuam rau txhua tus ntawm cov neeg ua haujlwm qias neeg, tab sis yuav koom nrog cov txiaj ntsig uas tsim los ntawm cov ntsuas nrog lawv li cas? Ib lub rooj ntxiv txuas lawv txhua qhov raws li qhia saum toj no.
Tab sis ntawm chav kawm, nws tsis muaj kev nkag siab los siv lub rooj ntawd. Thaum kawg, nws yog cov lej zauv yooj yim uas ua rau kev suav. Txog qhov ntawd, peb yuav ntshuam lub tsev qiv ntawv los hloov ntawm AQI tus nqi thiab cov pa phem (µg/m³): sej-aqi.
Nruab lub tsev qiv ntawv siv PIP thiab ua qhov kev xeem (saib cov cai saum toj no)
pip nruab sej-aqi
Thiab li cas txog Chile?
Hauv tebchaws Chile siv qhov ntsuas ntsuas zoo ib yam, ICAP: Kev ntsuas huab cua zoo rau huab cua ua pa. Txoj Cai Lij Choj Loj 59 ntawm Lub Peb Hlis 16, 1998, ntawm General Secretary Ministry of the Presidency of the Republic, teeb tsa hauv nws tsab xov xwm 1, tsab ntawv g) tias qib uas piav qhia ICA rau Cov Khoom Siv Ua Tsis Taus, ICAP.
Cov txiaj ntsig yuav sib txawv linearly ntawm cov ntu, tus nqi 500 yuav sib xws rau qhov txwv tus nqi uas yuav muaj kev pheej hmoo rau cov pej xeem thaum kis mus rau qhov ntau. Raws li ICAP qhov txiaj ntsig, pawg tau tsim uas tsim nyog muaj qib siab ntawm MP10 uas tib neeg tau nthuav tawm.
Kauj Ruam 7: Txheeb Cov Ntaub Ntawv Hauv Zos
Txog tam sim no, peb muaj tag nrho cov cuab yeej txhawm rau ntes cov ntaub ntawv los ntawm lub ntsuas thiab tseem hloov pauv lawv kom ntau dua "tus nqi nyeem tau", uas nws yog AQI qhov ntsuas.
Cia peb tsim txoj haujlwm txhawm rau ntes cov txiaj ntsig no. Peb yuav ntes 3 qhov tseem ceeb ua ntu zus nruab nrab ntawm lawv:
def tau_data (n = 3):
sensor.sleep (sleep = False) pmt_2_5 = 0 pmt_10 = 0 time.sleep (10) rau kuv hauv ntau (n): x = sensor.query () pmt_2_5 = pmt_2_5 + x [0] pmt_10 = pmt_10 + x [1] time.sleep (2) pmt_2_5 = puag ncig (pmt_2_5/n, 1) pmt_10 = puag ncig (pmt_10/n, 1) sensor.sleep (pw tsaug zog = Tseeb) time.sleep (2) rov pmt_2_5, pmt_10 Saum toj no koj tuaj yeem pom cov ntawv xeem. Cia peb tseem ua lub luag haujlwm los hloov tus lej lej ntawm PM hauv AQI qhov ntsuas
def conv_aqi (pmt_2_5, pmt_10): cov
aqi_2_5 = aqi.to_iaqi (aqi. POLLUTANT_PM25, str (pmt_2_5)) aqi_10 = aqi.to_iaqi (aqi. POLLUTANT_PM10, str (pmt_10)) rov qab aqi_2_5, aqi_10 siab dua qhov tshwm sim ntawm kev sim nrog ob lub zog. Tab sis yuav ua li cas nrog lawv? Cov lus teb yooj yim tshaj plaws yog los tsim txoj haujlwm kom txuag tau cov ntaub ntawv khaws tseg, txuag lawv ntawm cov ntawv hauv zos
def save_log (): ua
nrog qhib ("KOJ PATH NTAWM NO/air_quality.csv", "a") raws li cav: dt = datetime.now () log.write ("{}, {}, {}, {}, {} n". hom ntawv (dt, pmt_2_5, aqi_2_5, pmt_10, aqi_10)) log.close () Nrog ib lub voj, koj tuaj yeem teev cov ntaub ntawv ntawm cov hauv paus hauv koj cov ntaub ntawv hauv zos, piv txwv li, txhua feeb
thaum (Tseeb):
pmt_2_5, pmt_10 = get_data () aqi_2_5, aqi_10 = conv_aqi (pmt_2_5, pmt_10) sim: save_log () tshwj tsis yog: luam tawm ("[INFO] Ua tsis tau cov ntaub ntawv logging") time.sleep (60) Txhua 60 vib nas this, lub sij hawm ntxiv nrog cov ntaub ntawv yuav yog "txuas ntxiv" rau cov ntaub ntawv no, raws li peb tuaj yeem pom saum toj no.
Kauj Ruam 8: Xa Cov Ntaub Ntawv mus rau Kev Pabcuam Huab
Txog tam sim no, peb tau kawm paub yuav khaws cov ntaub ntawv li cas los ntawm lub sensor, txuag lawv ntawm cov ntaub ntawv CSV hauv ib cheeb tsam. Tam sim no, nws yog lub sijhawm los saib yuav xa cov ntaub ntawv no mus rau IoT platform li cas. Ntawm qhov kev qhia no, peb yuav siv ThingSpeak.com.
"ThingSpeak yog qhov qhib qhov Internet ntawm Yam (IoT) daim ntawv thov los khaws thiab khaws cov ntaub ntawv los ntawm yam khoom, siv REST thiab MQTT APIs. ThingSpeak ua rau kev tsim cov ntawv thov ntsuas kev nkag mus, daim ntawv thov taug qab qhov chaw, thiab kev sib raug zoo ntawm cov khoom nrog xwm txheej hloov tshiab."
Ua ntej, koj yuav tsum muaj tus as khauj ntawm ThinkSpeak.com. Tom ntej no, ua raws cov lus qhia los tsim Channel, sau tseg nws Channel ID thiab Sau API Key.
Thaum tsim cov channel, koj tseem yuav tsum txheeb xyuas cov ntaub ntawv twg uas yuav muab xa mus rau txhua qhov ntawm 8 thaj chaw, raws li tau hais los saum no (hauv peb kis tsuas yog 4 ntawm lawv yuav siv).
Kauj Ruam 9: MQTT raws tu qauv thiab ThingSpeak Kev Sib Txuas
MQTT yog kev tshaj tawm/sau npe ua vaj tsev uas tau tsim tshwj xeeb los txuas rau kev siv bandwidth thiab txwv tsis pub siv cov cuab yeej hla wireless tes hauj lwm. Nws yog cov txheej txheem yooj yim thiab hnyav uas ua haujlwm dhau TCP/IP qhov nyob lossis WebSockets. MQTT hla WebSockets tuaj yeem ruaj ntseg nrog SSL. Kev tshaj tawm/sau npe ua haujlwm ua kom cov lus raug thawb mus rau cov neeg siv khoom yam tsis muaj lub cuab yeej xav tau los mus pov ntawv tawm suab tsis tu ncua.
MQTT tus tswv lag luam yog lub hauv paus ntsiab lus ntawm kev sib txuas lus, thiab nws yog lub luag haujlwm xa tag nrho cov lus ntawm tus xa thiab tus txais raug cai. Tus neeg siv khoom yog ib qho khoom siv uas txuas rau tus broker thiab tuaj yeem tshaj tawm lossis sau npe rau cov ncauj lus kom nkag tau cov ntaub ntawv. Ib lub ncauj lus muaj cov ntaub ntawv qhia txog tus broker. Txhua tus neeg siv khoom uas xav xa lus tshaj tawm lawv mus rau qee lub ncauj lus, thiab txhua tus neeg siv khoom uas xav tau txais cov lus sau npe rau qee lub ncauj lus. Tus broker xa tag nrho cov lus nrog cov ncauj lus sib txuas rau cov neeg siv khoom tsim nyog.
ThingSpeak ™ muaj tus broker MQTT ntawm qhov URL mqtt.thingspeak.com thiab chaw nres nkoj 1883. Tus ThingSpeak tus broker txhawb nqa ob qho MQTT tshaj tawm thiab MQTT sau npe.
Hauv peb qhov xwm txheej, peb yuav siv MQTT Tshaj Tawm.
Kauj ruam 10: MQTT Tshaj Tawm
Txog kev pib, cia peb nruab Eclipse Paho MQTT Python cov neeg siv tsev qiv ntawv, uas ua raws li cov qauv 3.1 thiab 3.1.1 ntawm MQTT raws tu qauv
sudo pip nruab paho-mqtt
Tom ntej no, cia peb import lub tsev qiv ntawv paho:
ntshuam paho.mqtt.publish li tshaj tawm
thiab pib ua Thingspeak channel thiab MQTT raws tu qauv. Txoj kev sib txuas no yog qhov yooj yim tshaj plaws thiab xav tau cov peev txheej tsawg tshaj plaws:
channelID = "Koj li CHANNEL ID"
apiKey = "KOJ YUAV TSUM KEY" ntsiab lus = "raws/" + channelID + "/tshaj tawm/" + apiKey mqttHost = "mqtt.thingspeak.com" Tam sim no peb yuav tsum txhais peb "payload"
tPayload = "field1 =" + str (pmt_2_5) + "& field2 =" + str (aqi_2_5) + "& field3 =" + str (pmt_10) + "& field4 =" + str (aqi_10)
Thiab qhov ntawd yog nws! peb tau npaj los pib xa cov ntaub ntawv mus rau huab! Cia rov sau dua lub voj ua haujlwm yav dhau los tseem suav nrog ThingSpeak ib feem ntawm nws.
# Xa tag nrho cov ntaub ntawv rau ThingSpeak txhua 1 feeb
thaum (Tseeb): pmt_2_5, pmt_10 = get_data () aqi_2_5, aqi_10 = conv_aqi (pmt_2_5, pmt_10) tPayload = "field1 =" + str (pmt_2_5) + "& field2 =" + str (aqi_2_5) + "& field3 =" + str (pmt_10) + "& field4 =" + str (aqi_10) sim: luam tawm.single (ntsiab lus, them = tPayload, hostname = mqttHost, chaw nres nkoj = tPort, tls = tTLS, thauj = tTransport) save_log () tsuas yog: luam tawm ("[INFO] Ua tsis tiav hauv kev xa cov ntaub ntawv ") time.sleep (60) Yog tias txhua yam zoo, koj yuav tsum pom cov ntaub ntawv tseem tshwm ntawm koj li channel ntawm thingspeak.com raws li qhia saum toj no.
Kauj Ruam 11: Tsab Ntawv Kawg
Nws yog ib qho tseem ceeb rau taw qhia tias Jupyter Notebook yog cov cuab yeej zoo rau kev txhim kho thiab tshaj tawm, tab sis tsis muaj los tsim cov cai los tso rau hauv kev tsim khoom. Dab tsi koj yuav tsum ua tam sim no yog siv qhov feem cuam tshuam ntawm cov cai thiab tsim cov ntawv.py thiab khiav nws ntawm koj lub davhlau ya nyob twg.
Piv txwv li, “ts_air_quality_logger.py”, uas koj yuav tsum khiav nrog cov lus txib:
python 3 ts_air_quality_logger.py
Tsab ntawv no ib yam Jupyter Notebook thiab sds011.py tuaj yeem pom hauv kuv lub chaw cia khoom ntawm RPi_Air_Quality_Sensor.
Nco ntsoov tias tsab ntawv no ua tau rau kev sim nkaus xwb. Qhov zoo tshaj plaws tsis yog siv sijhawm qeeb hauv lub voj kawg (uas tso cai rau hauv "ncua"), hloov siv timers. Los yog rau daim ntawv thov tiag tiag, qhov zoo tshaj plaws tsis siv lub voj, muaj Linux programmed los ua cov ntawv tsis tu ncua nrog crontab.
Kauj Ruam 12: Ua Tus Saib Xyuas Sab Nraud
Thaum kuv Raspberry Pi Air Quality monitor tau ua haujlwm, Kuv tau sib sau RPi sab hauv lub thawv yas, khaws lub ntsuas cua sab nraum thiab muab tso rau sab nraum kuv lub tsev.
Muaj ob qhov kev paub dhau los.
Kauj Ruam 13: Cov Roj Roj Hluav Taws Xob
Lub ntsuas ntsuas tau nyob ib puag ncig 1m los ntawm Lambretta cov pa roj av, thiab nws lub cav tig mus. Lub cav tau khiav ob peb feeb thiab muab tua. Los ntawm cov ntaub ntawv teev cia saum toj no, qhov tshwm sim uas kuv tau txais. Nthuav kom paub tseeb tias PM2.5 yog qhov phom sij txaus ntshai tshaj plaws uas tshwm sim los ntawm lub cev muaj zog.
Kauj Ruam 14: Ntoo Ntoo
Saib ntawm cov ntaub ntawv teev cia, peb paub tias cov ntaub ntawv ntsuas tau ib ntus "tawm ntawm Range" thiab tsis tau zoo los ntawm AQI hloov pauv Lub Tsev Qiv Ntawv, yog li kuv hloov cov cai dhau los los tswj nws:
def conv_aqi (pmt_2_5, pmt_10): cov
sim: aqi_2_5 = aqi.to_iaqi (aqi. POLLUTANT_PM25, str (pmt_2_5)) aqi_10 = aqi.to_iaqi (aqi. POLLUTANT_PM10, str (pmt_10)) xa rov qab aqi_2_5, aqi_10 tshwj tsis yog: rov qab 600, Qhov xwm txheej no tuaj yeem tshwm sim hauv thaj chaw, uas yog OK. Nco ntsoov tias qhov tseeb, koj yuav tsum siv qhov nruab nrab txav mus kom tau txais AQI (tsawg kawg ib teev, tab sis feem ntau txhua hnub).
Kauj Ruam 15: Xaus
Raws li ib txwm muaj, Kuv vam tias txoj haujlwm no tuaj yeem pab lwm tus nrhiav lawv txoj hauv kev hauv ntiaj teb zoo siab ntawm Electronics thiab Cov Ntaub Ntawv Kev Tshawb Fawb!
Yog xav paub ntxiv thiab tus lej kawg, thov mus saib kuv qhov kev tso nyiaj GitHub: RPi_Air_Quality_Sensor.
Saludos los ntawm sab qab teb ntawm lub ntiaj teb!
Pom koj ntawm kuv cov lus qhia tom ntej!
Ua tsaug, Marcelo
Pom zoo:
Yuav Ua Li Cas Tsim Tus Nqi Tus Nqi ECG Tus Nqi Qis: 26 Kauj Ruam
Yuav Ua Li Cas Tsim Tus Nqi ECG Tus Nqi Qis: Nyob zoo txhua tus! Kuv lub npe yog Mariano thiab kuv yog kws kho mob biomedical. Kuv tau siv qee hnub so los tsim thiab paub txog tus qauv ntawm tus nqi qis ECG ntaus ntawv raws Arduino pawg thawj coj txuas nrog ntawm Bluetooth mus rau Android ntaus ntawv (smartphone lossis ntsiav tshuaj). Kuv yuav
Pandemi: Tus Nqi Tus Nqi Tus Nqi Tus Kab Mob Qis Tsawg Tus Nqi: 7 Kauj Ruam
Pandemi: Tus Nqi Tus Nqi Tus Nqi Tus Kab Mob Qis Tsawg Tus Nqi: Qhov no yog qhov pheej yig, yooj yim los ua neeg hlau. Nws tuaj yeem ua kom tsis muaj menyuam hauv koj chav nrog UV-C lub teeb, nws yog lub teeb thiab nrawm, nws tuaj yeem mus rau txhua qhov av, thiab nws tuaj yeem haum rau txhua lub qhov rooj. Nws tseem yog tib neeg-nyab xeeb, thiab muaj kev ywj pheej tag nrho
ARUPI - Tus Nqi Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi Uas Tau Txais Tus Nqi/Tus Kheej Tus Kheej (ARU) rau Soundscape Ecologists: 8 Kauj Ruam (nrog Duab)
ARUPI - Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi/Tus Kheej Tus Kheej (ARU) rau Soundscape Ecologists: Cov lus qhia no tau sau los ntawm Anthony Turner. Txoj haujlwm tau tsim los nrog ntau qhov kev pab los ntawm Shed hauv Tsev Kawm Ntawv ntawm Kev Suav, University of Kent (Mr Daniel Knox tau pab zoo!)
LM317 Tus Nqi Tus Nqi Qis Tsawg Tus Nqi Zog: 6 Kauj Ruam
LM317 Tus Nqi Tus Nqi Qis Tsawg Tus Nqi Zog: Nyob Zoo Cov Menyuam, Qhov no yog kuv thawj qhov haujlwm qhia. ntawm no kuv yuav qhia koj li cas kuv tau ua kuv tus kheej tus nqi qis LM317 Lub rooj zaum fais fab mov. Kuv vam tias koj yuav txaus siab rau nws
Tus Nqi Tus Nqi Tus Nqi Qis Tus Nqi Qis Tsawg: 15 Kauj Ruam (nrog Duab)
Tsawg-tus nqi Spherical Speaker Array: Cov cuab yeej ua suab nrov ua suab nrov hauv qhov xav tsis thoob, 360 degree zam, thaum lub suab nrov nrov nrov ua rau ntau qhov tsis txaus ntseeg, tsom teeb ntawm lub suab. Koj tuaj yeem siv nyiaj ib tuj ntawm cov khoom zoo nkauj: Hemisphere los ntawm Electrotap Experim