Cov txheej txheem:
- Kauj Ruam 1: Tau txais tag nrho cov khoom xav tau
- Kauj Ruam 2: Tau Txais Koj Raspberry Pi Npaj
- Kauj Ruam 3: Txuas Txhua Yam Ua Ke
- Kauj Ruam 4: Tsim Koj Cov Ntaub Ntawv
- Kauj ruam 5: Sijhawm rau Txoj Cai
- Kauj Ruam 6: Sim Nws
Video: Fanair: Chaw Huab Cua rau Koj Chav: 6 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Muaj ntau txoj hauv kev los nrhiav huab cua tam sim no, tab sis tom qab ntawd koj tsuas paub huab cua sab nraud. Yuav ua li cas yog tias koj xav paub huab cua hauv koj lub tsev, hauv ib chav tshwj xeeb? Nov yog qhov kuv sim daws nrog txoj haujlwm no.
Fanair siv ntau lub ntsuas kom nkag siab:
- kub
- av noo
- lub teeb
- qee cov pa
- cua siab
Nws yog qhov me me thiab siv Raspberry Pi 3 B, kom tau txais qhov muaj txiaj ntsig, txuag lawv hauv MySQL database thiab tom qab ntawd ua rau lawv yooj yim muaj nyob ntawm lub vev xaib. Suav nrog cov cai thiab lub vev xaib yog lub peev xwm kom tau txais cov ntaub ntawv huab cua tiag rau koj qhov chaw nyob kom lub vev xaib tuaj yeem siv los tshuaj xyuas huab cua sab nraud ib yam.
Kauj Ruam 1: Tau txais tag nrho cov khoom xav tau
Ua ntej tshaj plaws koj yuav xav tau cov khoom siv hluav taws xob yooj yim xws li xov hlau / jumper cables. Yog tias koj npaj yuav siv txhua yam ua ke ua ib txoj haujlwm ruaj khov ces pom tseeb koj tseem yuav xav tau cov hlau txuas, cov laug, thiab rau koj tus kheej txoj kev nplij siab rau PCB txhawm rau txhuam txhua yam rau.
Txog cov khoom tshwj xeeb Kuv tau ua daim nqi ntawm Cov Khoom Siv no.
- Raspberry Pi 3B
- MPC3008-8-Channel 10-Bit ADC
- AM2301 Ntsuas Kub Kub thiab Vaum Sensor
- WR Rademacher WR-tyoe 930-1 PCB
- ABS Case rau prototyping (dub)
- LDR
- MQ135 gass sensor
- 2x BC517 Darlington Transistor
- RGB LED
- Pob Resistor
- Buzzer
- Hlau
- BMP280 Tus pas ntsuas kub
- Nyob ntsiag to USB kiv cua (5V)
Txhua yam ua ke qhov no yuav tsum raug nqi txog € 110. Nco ntsoov tias tus nqi tag nrho yog kwv yees. Tsis tas li, kuv txoj haujlwm muaj lub vijtsam LCD hauv daim duab tab sis nws tsis txuas nrog vim tias tsis muaj chaw txaus hauv kuv kis, yog li nws tsis suav nrog hauv kev qhia.
Kauj Ruam 2: Tau Txais Koj Raspberry Pi Npaj
Tau txais koj tus Raspian Jessie nrog Pixel kev ua haujlwm los ntawm cov nom Raspberry Pi site thiab ib zaug nws rub tawm unzip nws. Koj yuav tau txais cov ntaub ntawv duab. Txhawm rau kom nws ntawm Pi koj yuav tsum sau nws mus rau SD-Card siv Win32 Disk Imager. Thaum nws tau teeb tsa xaiv cov ntaub ntawv duab thiab tsav uas koj nyob hauv SD-Card nyob. Tom qab ntawv nyem sau thiab tos kom txog thaum nws ua tiav.
Thaum nws ua tiav nyem rau ntawm koj daim npav SD hauv File Explorer thiab qhib cov ntaub ntawv hu ua 'cmdline.txt' mus rau qhov kawg ntawm cov ntawv ntawv ua ntej rootwait thiab sau 'ip = 254.169.10.2' nrog qhov chaw nyob ib puag ncig. Tom qab koj khaws nws koj yuav tsum nyem qhov chaw sab hauv lub qhov rais thiab tsim cov ntawv tshiab hu ua 'ssh'. Nco tseg tias cov ntawv no tsis muaj cov ntawv txuas ntxiv. Kom paub tseeb tias nws tsis muaj qhov txuas ntxiv nyem rau ntawm 'saib' hauv cov ntawv tshawb fawb thiab tshawb xyuas 'cov ntaub ntawv zais'. Yog tias nws hloov nws thiab rho tawm qhov txuas ntxiv nws tsuas yog nyeem 'ssh'.
Tom qab ua tiav koj tuaj yeem thaum kawg tso koj daim npav SD hauv Raspberry Pi. Rub tus neeg siv ssh (Kuv pom zoo MobaXterm). Thiab txuas siv ssh nrog tus IP koj teeb tsa ua ntej '254.169.10.2'. Lub npe siv yog 'pi', tus password 'raspberry'. Yog tias koj xav tau koj tuaj yeem hloov tus password los ntawm kev ntaus qhov hais kom ua 'sudo passwd' hauv lub davhlau ya nyob twg thiab ua raws cov lus qhia. Txij li thaum peb tab tom siv ib qho zoo ntawm SD-Card rau Fanair koj yuav tsum txuas ntxiv qhov chaw khaws cia los ntawm kev ntaus 'sudo rapi-teeb tsa' xaiv 'Advanced Options' thiab tom qab ntawd 'Nthuav Tawm Cov Ntaub Ntawv System'. Yog hais tias prompted restart.
Peb yuav siv 1-xaim, SPI, thiab I2C interface. Txhawm rau siv tau lawv koj yuav tsum xub teeb tsa lawv!
Kauj Ruam 3: Txuas Txhua Yam Ua Ke
Nws yog lub sijhawm los tsim lub voj voog! Thawj thawj zaug koj yuav tsum tau sim nws ntawm lub khob cij, tab sis yog tias koj tsis muaj sijhawm rau qhov ntawd koj tuaj yeem sim ua kom nws sib xyaw ua ke.
Lub voj voos koj yuav xav tau zoo li cov lus saum toj no, kom yooj yim dua ib lub khob cij version kuj suav nrog.
Kauj Ruam 4: Tsim Koj Cov Ntaub Ntawv
Txhawm kom txuag tau txhua cov ntaub ntawv koj yuav tau txais peb yuav siv TSQL MySQL database. Ua ntej txhim kho MySQL cia peb paub tseeb tias txhua yam tau hloov kho tshiab los ntawm kev ntaus ob peb lus txib hauv lub davhlau ya nyob twg:
- 'sudo apt-tau hloov tshiab'
- 'sudo apt-tau hloov tshiab'
- 'sudo apt-tau hloov dua siab tshiab'
Txais txhua qhov kev ceeb toom los ntawm kev ntaus 'y' thiab nkag mus.
Txhawm rau nruab MySQL hom:
- 'sudo apt-tau nruab mysql-server'
- 'sudo apt-tau nruab mysql-client'
Thaum hais kom tsim lub hauv paus lo lus zais uas koj xaiv.
Tom qab nws ua tiav txhim kho tus ID nkag mus siv:
'mysql -uroot -p'
Thiab ntaus koj tus password.
Tau txais Fanair code los ntawm Kuv Github! Nyem rau 'Clone lossis rub tawm' thiab tom qab ntawd 'Download ZIP'. Unzip cov cai hauv daim nplaub tshev uas koj xaiv. Cov lus nug los tsim cov ntaub ntawv ua haujlwm tau zoo yog nyob hauv cov ntawv tais ceev tseg. Qhib cov ntawv theej cov cai thiab muab tso rau hauv lub davhlau ya nyob twg nrog MySQL qhib. Tom qab ntawd nyem nkag mus thiab cov ntaub ntawv tiav lawm!
Kauj ruam 5: Sijhawm rau Txoj Cai
Txhawm rau siv tag nrho cov ntsuas koj pom tseeb yuav tsum tau ua haujlwm. Luckily txoj cai twb ua tiav (rau feem ntau), thiab peb twb rub tawm nws thaum tau txais cov ntaub ntawv SQL database.
Zoo li kuv tau hais tias muaj qee qhov uas tseem yuav tsum tau hloov pauv / ntxiv rau txoj haujlwm kom ua haujlwm tau zoo. Ua ntej tshaj plaws ntawm txoj haujlwm siv Darksky API kom tau txais cov ntaub ntawv huab cua raws qhov ntev thiab qhov ntev. Txhawm rau siv nws koj yuav tsum sau npe. Thawj 1000 qhov kev hu dawb thiab tom qab ntawd nws raug nqi $ 0.0001 ib zaug. Kuv tau hnov yog tias koj tsis them koj tus account raug thaiv. Yuav kom ncaj ncees $ 0.0001 rau ib lub xov tooj yog pheej yig heev. Fanair hu cov ntaub ntawv tshiab tshaj plaws txhua teev uas txhais tau tias hauv ib xyoos yog tias ua haujlwm puv sijhawm nws yuav tsuas yog nqi koj $ 0.876. Koj kuj tau txais 41 hnub dawb yog Fanair ua haujlwm puv sijhawm.
Thaum kos npe pom zoo rau koj tus lej API. Nrhiav koj qhov chaw nyob qhov ntev thiab txoj kab nruab nrab ntawm google maps lossis sim rau google nws. Tsim cov ntawv sau tshiab cov ntaub ntawv hauv paus ntawm Fanair (nrog cov chav kawm, main.py…). Npe cov ntaub ntawv 'key_location.txt'. Qhib cov ntawv kab ntawv thiab thawj kab ntawv muab koj tus lej Darksky API. Ntawm kab thib ob muab tshuaj txhuam koj qhov ntev thiab ntawm kab thib peb muab koj qhov latitude (ob qho tib si hauv hom zauv). Thaum koj ua tiav txuag cov ntawv.
Hauv tib phau ntawv teev npe tsim lwm cov ntawv sau hu ua 'database_dsn.txt'. Thawj kab yuav tsum hais tias 'localhost'. Kab thib ob yog 'hauv paus'. Hauv kab thib peb koj yuav tsum ntaus koj tus password uas koj tau ua rau cov ntaub ntawv ua ntej, thiab kab plaub thiab kab kawg koj yuav tsum ntaus 'fanair'.
Txoj cai nyem rau ntawm main.py cov ntaub ntawv thiab xaiv kho kom raug. 'Fanair = Fanair (5, 26, 17, 27, 22, 4, "AM2301", 1, 0, 0, 0, "key_location.txt", "database_dsn.txt")' yuav tsum tau hloov pauv. Yog tias koj ua raws daim duab thawj 5 qhov tseem ceeb yuav tsum hloov ntawm '5, 26, 17, 27, 22, 4' txog '20, 21, 26, 19, 13 '. '/home/muhsin/Applications/Fanair' yuav tsum tau hloov pauv rau koj txoj hauv kev Fanair (qhov twg yog main.py yog). Nco ntsoov muab tus slash tso rau pem hauv ntej ntawm 'tsev' tab sis tsis yog tom qab 'Fanair'.
Tam sim no txhua yam zoo tab sis cov cai xav tau hauv Pi. Luckily rau peb cov sftp raws tu qauv muaj. Txhawm rau muab cov ntaub ntawv ntawm Pi siv tus thov sftp zoo li FileZilla lossis yog tias koj txiav txim siab siv MobaXterm koj tuaj yeem xa cov ntaub ntawv yooj yim hauv sftp interface sab laug ntawm lub davhlau ya nyob twg.
Hauv kuv qhov kev paub Kuv tsis tas yuav tau txais hnub thiab sijhawm raug nyob hauv Raspberry Pi. Txhawm rau kom ntseeg tau tias koj yuav tau txais lub sijhawm tseeb Kuv qhia kom ua raws phau ntawv qhia no: Raspberry Pi sync hnub thiab sijhawm.
Thiab kawg tab sis tsis tsawg kawg ob peb lub tsev qiv ntawv yuav tsum tau teeb tsa thiab ob peb qhov cuam tshuam yuav tsum tau qhib kom ua:
'sudo apt-tau nruab tsim-qhov tseem ceeb nab hab sej-dev'
Adafruit DHT:
'pip3 nruab adafruit_python_dht'
1-Hlau:
- 'sudo raspi-teeb tsa'
- 'Interfacing Options'
- '1 Hlau'
- Pab kom
- 'sudo nano /boot /config.txt'
- Ntxiv kab no hauv cov ntawv: 'dtoverlay = w1-gpio'
- 'sudo rov pib dua'
SPI:
- 'sudo raspi-teeb tsa'
- 'Interfacing Options'
- 'SPI'
- Pab kom
- 'sudo rov pib dua'
- 'sudo nano /boot /config.txt'
- Tshawb nrhiav 'dtparam = spi = on' thiab tsis pom zoo nws los ntawm kev tshem lub hashtag.
- 'sudo apt-tau nruab python3-dev
Smbus:
- 'sudo raspi-teeb tsa'
- 'Interfacing Options'
- 'I2C'
- Pab kom
- 'sudo rov pib dua'
- 'sudo apt-tau nruab -y nab hab sej-smbus'
- 'sudo apt-tau nruab -y i2c-cuab yeej'
- 'sudo nano /boot /config.txt'
- Tshawb rau dtparam = i2c_arm = ntawm thiab tsis pom zoo nws los ntawm kev tshem lub hashtag.
hwj
pip3 nruab Flask
mysql txuas
'pip3 nruab -Iv mysql -connector == 2.1.4'
spidev
'pip3 nruab py-spidev'
tsaus ntuj
'pip3 nruab darkskylib'
Kauj Ruam 6: Sim Nws
Yog tias koj tau tswj hwm kom ua qhov no kom deb koj tus kheej nyob tom qab. Tam sim no txhua yam tau ua tiav kom Fanair ua haujlwm tau zoo. Yog li txhawm rau sim nws tawm yam 'cd ""'. Cov ntaub ntawv qhov chaw yog "/home/pi" piv txwv li yog tias koj nyuam qhuav muab tso rau hauv koj phau ntawv teev npe tsev. Tom qab ntawd ntaus 'python3 main.py' thiab cia nws so rau 15 feeb yog li nws yuav muaj cov ntaub ntawv hauv lub database thaum ua tiav. Tom qab ntawd nias 'ctrl + c' nres nres qhov program thiab ntaus 'python3 Flask.py'. Txhawm rau saib yog tias koj lub vev xaib ua haujlwm koj yuav tsum nthwv mus rau koj tus IP chaw nyob koj tau ua nrog ': 5000' tom qab nws (zoo li no: 169.254.10.1:5000 ').
Txhawm rau kom nws ua haujlwm tom qab khau raj:
'sudo nano /etc/rc.local'
Qhov kawg ntawm cov ntaub ntawv TAB SIS UA NTEJ tawm 0:
'sudo python3 "/main.py" &'
'sudo python3 "/Flask.py" &'
Nrog koj zoo siab tam sim no koj tsab ntawv yuav tsum khiav los ntawm kev pib thiab koj ua tiav! Yog tias koj npaj yuav ua kom txoj haujlwm khiav mus thiab tseem tsis tau ua tiav Kuv xav qhia koj kom muab txhua yam tso ua ke, tsuas yog kom ntseeg tau tias txhua yam nyob qis qis. Txawm hais tias yog tias koj tsis ua si kom txav nws ib puag ncig ntau lub khob cij tseem ua haujlwm tau kawg.
Pom zoo:
Chav Huab Cua Hauv Chav Siv Arduino & BME280: 4 Cov Kauj Ruam
Chav Chaw Cua Huab Cua Siv Arduino & BME280: Yav tas los kuv tau qhia lub chaw nres tsheb huab cua yooj yim uas nthuav tawm Qhov Kub thiab Vaum ntawm thaj chaw. Qhov teeb meem nrog nws yog tias nws yuav siv sijhawm hloov kho thiab cov ntaub ntawv tsis raug. Hauv qhov kev qhia no peb yuav ua tus saib xyuas huab cua sab hauv tsev
PyonAir - Qhib Qhov Chaw Huab Cua Huab Cua Pollution: 10 Cov Kauj Ruam (nrog Duab)
PyonAir - Qhib Qhov Chaw Huab Cua Pollution: PyonAir yog tus nqi qis rau kev saib xyuas cov pa phem hauv cheeb tsam - tshwj xeeb, muaj teeb meem me me. Raws li nyob ib puag ncig Pycom LoPy4 lub rooj tsavxwm thiab Grove-sib xws kho vajtse, lub kaw lus tuaj yeem xa cov ntaub ntawv hla LoRa thiab WiFi. Kuv lees paub qhov no
Huab Cua Huab Cua - Koj Lub Vev Xaib Zoo Kom Hnav: 6 Cov Kauj Ruam (nrog Duab)
Npuas Cua Huv - Koj Lub Vev Xaib Zoo rau Hnav: Hauv Cov Lus Qhia no Kuv yuav piav qhia yuav ua li cas koj tuaj yeem tsim lub tshuab ua pa rau hauv koj cov khaub ncaws uas yuav ua rau koj muaj kuab huv thiab lim huab cua ua pa. Ob lub kiv cua radial tau muab tso rau hauv lub tsho loj siv cov kev cai luam tawm 3d uas yog
Huab Cua Huab Cua Huab Cua: 11 Kauj Ruam (nrog Duab)
Huab Cua Huab Cua Huab Cua: Txoj haujlwm no ua rau huab cua huab siv Raspberry Pi Zero W. Nws txuas rau Yahoo Huab Cua API thiab nyob ntawm qhov kev kwv yees rau hnub tom ntej hloov xim. Kuv tau tshoov siab los ntawm Wisconsin Gas Building uas muaj nplaim taws ntawm lub ru tsev uas hloov pauv
HRV (Lub Tsev Huab Cua Hloov Chaw) Arduino Tus Tswj Nrog Huab Cua Huab Cua: 7 Cov Kauj Ruam (nrog Duab)
HRV (Lub Tsev Huab Cua Hloov Chaw) Arduino Tus Tswj Nrog Air Economizer: HRV Arduino Tus Tswj Nrog Air Economizer Yog li kuv keeb kwm nrog txoj haujlwm no yog kuv nyob hauv Minnesota thiab kuv lub rooj tsav xwm hluav taws xob kib ntawm kuv LifeBreath 155Max HRV. Kuv tsis xav them $ 200 rau qhov tshiab Kuv ib txwm xav tau qee yam nrog kev lag luam huab cua kev ua txhaum