Cov txheej txheem:
- Kauj Ruam 1: Teeb SD Card thiab Raspberry PI
- Kauj Ruam 2: Teeb Lub Tsev Qiv WeatherHAT
- Kauj Ruam 3: Txhim Kho Huab Cua-api thiab GetWeather Script
- Kauj Ruam 4: Hloov Kho Cov Ntaub Ntawv Rau: Openweathermap API
Video: Yooj Yim Huab Cua Qhia Siv Raspberry PI thiab Cyntech WeatherHAT: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
* Xyoo 2019 Yahoo hloov nws li API, thiab qhov no tsis ua haujlwm. Kuv tsis paub txog qhov hloov pauv. Thaum lub Cuaj Hlis xyoo 2020 txoj haujlwm no tau raug hloov kho tshiab los siv OPENWEATHERMAP API Saib ntu hloov tshiab hauv qab no, cov ntaub ntawv no tseem tshuav zoo li cas. Ua tsaug rau kev saib, thiab ua tsaug rau qhov qhia rau kuv paub txog Yahoo hloov pauv. *
Tsis ntev los no kuv tau txais Cyntech WeatherHAT, tab sis kuv poob siab me ntsis nrog qhov tsis muaj software rau nws.
HAT nws tus kheej zoo li tau tsim kho kom zoo, nrog 6 LEDs xiav nyob rau hauv daim ntawv los nag, 6 LED txiv kab ntxwv nyob rau hauv daim ntawv ntawm xob laim-ntsia liaj qhov rooj, 6 LEDs dawb nyob rau hauv daim ntawv ntawm huab. 1 (Qhov kuv ntseeg yog RGB LED) rau SUN - nws qhia txiv kab ntxwv (yog li kuv yuav tsis raug txog nws yog RGB). Thiab 6 WS2812 LEDs (Cov no yog RGB:-))
Cyntech muaj phau ntawv pib -pib, thiab txawm tias yog qhov zoo - nws yooj yim rau nruab thiab siv HAT.
Yog li kuv tsuas yog xav tsis thoob uas tsis pom ib qho software tiag tiag (lwm qhov tom qab ntawd qhov demo muab los ntawm Cyntech). Kuv zoo ib yam tsis txaus ntseeg kom tsis pom leej twg siv qhov no tiag tiag - Tej zaum tib neeg xav tau cov khoom "zoo nkauj" nrog qhov kub thiab txias, thiab txhua yam ntaub ntawv ntawd. Rau kuv nws yog qhov zoo tsuas yog saib ntawm ob peb LEDs thiab paub - nws los nag, lossis Thunderstorm, lossis Cloudy - Thaum ntawd yog tias kuv xav tau xov xwm ntxiv kuv tuaj yeem saib kuv lub ntsiav tshuaj lossis xov tooj.:-)
Ib me ntsis ntxiv - qhov no yog kuv thawj zaug siv nab nab, Kuv tsis txhais tau tias zoo ntawm nws. Thiab kuv paub tseeb tias cov neeg uas paub nab nab tiag yuav qhia kuv txoj hauv kev zoo dua los ua qhov no.
Cia peb pib:
Peb xav tau daim npav SD (tsawg kawg 8gb)
Raspberry PI (Kuv siv Zero W) nws yuav tsum muaj kev siv internet.
thiab peb xav tau Cyntech weatherHAT
Yog tias koj siv Raspberry PI Zero W koj yuav tsum muaj peev xwm tuaj yeem txuas cov kab taub hau rau pawg thawj coj saib.
Txwv tsis pub cov txuj ci xav tau yog lub peev xwm los siv software thiab teeb tsa daim npav SD.
Kauj Ruam 1: Teeb SD Card thiab Raspberry PI
Koj yuav tsum rub tawm Raspbian qhov tseeb (thaum lub sijhawm qhia no uas yog Raspbian Stretch Lub Peb Hlis 2018 (2018-03-13))
www.raspberrypi.org/downloads/raspbian/
Kuv siv lub khoos phis tawj khoos phis tawj, txawm tias koj yog kuv tab tom teeb tsa kuv lub taub hau, thiab ua ntau yam los ntawm CLI (kab lus hais kom ua interface) hla ssh.
Ua raws cov txheej txheem teeb tsa pom ntawm no:
www.raspberrypi.org/documentation/installa…
Tom qab Etcher ua tiav, tshem daim npav SD, thiab rov qab tso rau hauv lub computer.
* Koj tsuas yog xav tau ua cov theem hauv qab no yog tias koj npaj yuav ua lub taub hau ntsaws
Peb yuav tsum teeb tsa SSH thiab WIFI ua ntej peb siv daim npav SD hauv Raspberry PI. Hauv BOOT muab faib ntawm daim npav, tsim cov ntawv hu ua "ssh" yam tsis muaj nqe lus. tsis muaj dab tsi yuav tsum muaj nyob hauv cov ntawv ntawd. Thaum PI khau raj nws yuav pom cov ntawv ntawd, thiab qhib rau SSH.
Peb kuj yuav tsum tsim cov ntaub ntawv hu ua "wpa_supplicant.conf". Peb yuav tsum hloov kho cov ntaub ntawv no nrog koj qhov chaw teeb tsa wifi.
Nws yuav tsum zoo ib yam li qhov no:
ctrl_interface = DIR =/var/run/wpa_supplicant GROUP = netdev
update_config = 1 network = {ssid = "yourwifiSSID" psk = "yourwifipassword" scan_ssid = 1}
* Koj tsuas yog yuav tsum ua qhov no yog tias koj npaj yuav ua lub taub hau ntsaws
Thaum qhov ntawd ua tiav, tshem tawm daim npav SD kom nyab xeeb thiab muab tso rau hauv Raspberry PI (xyuas kom tsis muaj lub zog ntawm PI).
Txuas cov huab cua HAT, thiab lub zog ntawm Raspberry PI.
Kauj Ruam 2: Teeb Lub Tsev Qiv WeatherHAT
Rau cov kauj ruam no peb yuav ua raws li Kev Pib Pib Qhia pom
guides.cyntech.co.uk/weatherhat/getting-sta…
Yog tias koj tab tom teeb tsa lub taub hau koj yuav xav ssh [email protected]
Yog tias koj tsis muaj tus neeg siv ssh - PUTTY yog qhov zoo.
Yog tias koj siv keyboard thiab saib xyuas - phau ntawv qhia saum toj no yog qhov zoo los ua raws, nws pib koj ntawm GUI desktop.
Cov kauj ruam tseem ceeb ntawm no yog teeb tsa WS281x lub tsev qiv ntawv thiab WeatherHAT cov tsev qiv ntawv, nrog rau kev cia siab rau txhua tus.
sudo apt-tau hloov tshiab
sudo apt-get upgrade -y sudo apt-get install build-essential sej-dev git scons swig python-smbus git clone https://github.com/jgarff/rpi_ws281x.git> git clone https://github.com/ jgarff/rpi_ws281x.git> cd rpi_ws281x scons cd nab nab sudo python setup.py nruab
Tam sim no peb yuav tsum paub tseeb tias I2C tau qhib.
sudo raspi-teeb tsa
Phau ntawv qhia tau sau rau qhov qub version ntawm raspi-config thiab hais kom mus rau "Advanced Options" uas tau hloov los ntawm kuv ntseeg "Interfaces"
Thaum koj qhib I2C koj yuav tsum rov pib dua.
Tam sim no nws yog lub sijhawm los ntsuas HAT
cd WeatherHAT
sudo python cycle.py
Yog tias txhua yam mus zoo koj yuav tsum pom txhua tus yam ntxwv thiab zaj sawv.
ctrl-z yuav tso tseg qhov program.
*Cov Lus Cim Tshwj Xeeb: Kuv tau kawm tias lub sijhawm Raspberry PI 3 sib txawv thiab zaj sawv yuav ua haujlwm tsis raug. Yog tias koj muaj teeb meem ntawm no yog yuav kho nws li cas.
github.com/CyntechUK/WeatherHAT/issues/3
guides.cyntech.co.uk/raspberry-pi/assemblin…
Thaum txhua yam ua haujlwm, peb tuaj yeem txuas ntxiv mus rau theem tom ntej.
Hloov kho: (Lub Kaum Hli 6, 2020) Tam sim no qhov chaw cia khoom no muaj kuv tsab ntawv getWeather.py, qhov no yog xov xwm zoo, vim tias kev txaus siab tau tshwm sim dua, thiab tej yam tshiab yuav tau tshwm sim.
Kauj Ruam 3: Txhim Kho Huab Cua-api thiab GetWeather Script
Yog li, kuv muab tso rau hauv PULL thov rau CyntechUK rau kuv tsab ntawv - vam tias lawv yuav lees txais qhov kev thov, thiab koj tuaj yeem hla rub tawm kuv lub chaw cia khoom. (lawv yuav tsis xav suav nrog kuv tus lej koj)
(Lub Kaum Hli 6, 2020) Qhov kev thov PULL tau pom zoo, kuv tau txais tsab ntawv GetWeather tam sim no suav nrog hauv Weatherhat chaw cia khoom.
********* Koj tseem tuaj yeem siv cov ntaub ntawv no yog tias koj nyiam, txawm li cas los getWeather.py tau suav nrog hauv huab cua qhov chaw khaws cia tam sim no ******************* ******************
Kuv qhov chaw khaws khoom tuaj yeem pom ntawm no:
github.com/kd8bxp/WeatherHAT/tree/getWeath…
thiab kuv tsab ntawv hu ua getWeather.py
Yog tias lawv lees txais qhov rub thov koj yuav tau sau tsab ntawv no - yog tias tsis yog koj yuav xav tau clone lub chaw cia khoom.
hauv koj phau ntawv teev npe tsev (/home/pi) hom:
git clone https://github.com/kd8bxp/WeatherHAT.git getWeather
qhov no yuav clone qhov chaw cia rau hauv cov npe hu ua getWeather, tom ntej no peb yuav tsum txheeb xyuas qhov chaw getWeather.
cd getWeather
git checkout getWeather
**********************************************************************
Koj yuav tsum tau cd mus rau hauv daim ntawv qhia huab cua HAT uas tau cloned ua ntej thiab
Peb yuav tsum hloov kho tsab ntawv getWeather.py rau koj qhov chaw nyob.
nano getWeather.py
Koj yuav tsum pom kab uas pib nrog
qhov chaw thiab xaus nrog saib (45042) - Nov yog kuv tus lej zip, kuv tau pom tias nws tsis ua haujlwm zoo ib yam li koj xav
thiab kab txoj cai saum nws uas tau hais tawm ua haujlwm zoo dua nrog lub nroog lub npe. Qhov ntawd yog qhov uas tej zaum koj xav siv. Yog li Tshaj Tawm tus lej zip code kab (#) thiab tsis pom zoo thiab hloov koj lub nroog lub npe.
*********** QHIA YAHOO INFORMATION - Tsis xav tau ntev dua ***********
Peb yuav tsum teeb tsa ib lub tsev qiv ntawv ntxiv rau qhov no los ua haujlwm, huab cua-api uas yog qhwv rau Yahoo huab cua API.
pypi.python.org/pypi/weather-api/0.0.5
Kev teeb tsa yog yooj yim -
pip nruab huab cua-api
***********************************************************************************
Tam sim no peb tuaj yeem khiav tsab ntawv:
sudo nab hab sej getWeather.py &
Tus & yuav cia tsab ntawv khiav hauv keeb kwm yav dhau. Tsab ntawv pw txog li 5 feeb, thiab tom qab ntawd tshawb xyuas Yahoo Huab Cua yog tias muaj qee yam hloov pauv - yog li nws hloov kho cov zaub. Lub sijhawm 5 feeb tuaj yeem hloov pauv, nws nyob ze rau hauv qab ntawm tsab ntawv.
pw tsaug zog (60 * 5)
Koj tuaj yeem teeb tsa txoj haujlwm crontab (nco ntsoov qhov no yuav tsum tau ua raws li hauv paus) uas yuav pib sau ntawv ntawm txhua lub khau raj.
siv:
sudo crontab -e
nkag mus:
@reboot sej /home/pi/weatherHAT/getWeather.py
Kuv xav tias yuav tsum ua haujlwm - Kuv tsis tau teeb tsa cron tsis tau ntawm kuv lub kaw lus.
Qhov ntawd zoo nkauj heev -
Raws li kuv tau hais qhov no yog ib qho ntawm kuv thawj qhov kev pab cuam nab nab, thiab kuv paub tseeb tias ib tus neeg paub ntau dua yuav pom txoj hauv kev zoo dua los ua qhov no.
Kuv tsuas yog ua qhov kev sim tsawg ntawm qhov no - Kuv tau pom "Snow" "Rain" thiab "Thunderstorm" ua haujlwm kom deb li deb, Muaj qee qhov xwm txheej uas kuv tsis paub yuav ua li cas tam sim no - Kuv zoo siab txais tos cov tswv yim.
Kauj Ruam 4: Hloov Kho Cov Ntaub Ntawv Rau: Openweathermap API
Thaum lub Cuaj Hlis xyoo 2020, Kuv hloov kho tsab ntawv los siv https://openweathermap.org API.
NCO TSEG: Qhov no yog "nrawm" kho rau kuv, thiab txwv kev sim - (Nws tau dhau mus rau ob peb hnub dhau los, thiab txhua yam kuv pom yog huab thiab nag tso saib) - Thaum kuv ntseeg tias kuv ntes tau txhua qhov xwm txheej uas yooj yim rau tso saib, nws muaj peev xwm uas kuv nco ob peb vim li cas "nrawm" qhov kev kho no tau ua tiav. Uas tau hais tias, yog tias koj xav tias muaj teeb meem thov tawm lus thiab lub sijhawm tso cai kuv yuav saib mus rau nws - lossis sim taw tes koj mus rau qhov yog. *
Koj yuav tsum tau kos npe rau tus lej API siv qhov txuas saum toj no, thaum koj hloov tsab ntawv los tso koj lub nroog, koj yuav pom qhov chaw rau tus yuam sij. Tsuas yog luam thiab muab nws tso, thiab koj yuav tsum yog tus zoo.
Lwm cov ntawv:
Tsab ntawv no tam sim no siv "Cov ntaub ntawv huab cua tam sim no API" cov ntaub ntawv hais txog API ntawd tuaj yeem pom ntawm no:
openweathermap.org/current Ib yam uas yuav tsum nco ntsoov yog koj tuaj yeem siv lub nroog, xeev, thiab lub tebchaws.
IE: lub nroog "Dayton" dhau los "Dayton, OH, US" ceeb toom tias lub xeev thiab lub tebchaws cov lej yog ob qho ntawv loj, qhov no yuav tsum tau ua. API hais tias nws tuaj yeem siv tsuas yog "Dayton, OH" tab sis kuv tau txais qhov yuam kev los ntawm tsab ntawv thaum kuv ua qhov no - thiab txij li qhov no yog kho sai, kuv tsis tau saib mus rau vim li cas. Yog li, kuv pom zoo siv "nroog, xeev, lub tebchaws"
Yog tias yog vim li cas koj thiaj tsis tau txais cov ntaub ntawv zoo siv lub nroog lub npe, koj tseem tuaj yeem tshawb xyuas Lub Nroog ID, lossis siv latitude thiab longitude lossis zip code. Hauv txhua kis URL yuav xav tau hloov pauv, yog tias koj nyem rau ntawm qhov txuas ntawm sab xis ntawm API lub vev xaib, nws yuav muab piv txwv ntawm qhov URL yuav tsum yog dab tsi.
Koj yuav tsum hloov qhov URL hauv tsab ntawv ib yam.
Txawm tias sau ntau ntxiv: Lub Kaum Hli 3, 2020
@Itsmedoofer taw qhia tias lawv xav tau los teeb tsa lub tsev qiv ntawv nab hab sej-thov nrog qhov hloov tshiab tshiab. Kuv tsis paub tseeb tias kuv xav tau qhov no, (nws tseem tuaj yeem ua tau tias kuv tau teeb tsa nws los ntawm xyoo dhau los, lossis ntau qhov sib txawv ntawm nab hab sej teeb tsa cov tsev qiv ntawv sib txawv los ntawm lub neej ntawd). Yog li yog tsab ntawv muab qhov yuam kev txog sej-thov nws yooj yim los kho.
ntaus cov lus txib no rau hauv CLI: nab hab sej -m pip teeb tsa thov
thiab koj yuav tsum zoo.
Vam tias qhov no ua rau, qhov no yog kho sai, thiab tej zaum muaj ib hnub tso cai kuv tuaj yeem ua haujlwm tu nws kom zoo dua me ntsis.
Hloov Kho (Lub Kaum Hli 6, 2020) Github rub thov tau txais, thawj CyntechUK thawj qhov chaw cia tam sim no suav nrog tsab ntawv no. https://github.com/CyntechUK/WeatherHAT Tus neeg siv Boeerb muaj qee lub tswv yim yuav ua li cas tso saib qee qhov xwm txheej uas tam sim no tsis tshwm, nrog rau qee qhov tswv yim siv. Yog li khaws qhov muag ntawm qhov chaw cia khoom ntawd. Thiab vam tias txhua yam yuav tshwm sim.
Hloov kho tshiab: (Lub Kaum Hli 8, 2020) Qhib Huab Cua Daim Ntawv Qhia muaj cov lus qhia luv luv ntawm kev teeb tsa thiab siv API, https://openweathermap.org/appid Qhov chaw zoo pib.
Pom zoo:
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: 4 Cov Kauj Ruam (nrog Duab)
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: Hnub no kuv xav qhia yuav ua li cas kom pom lub teeb pom kev zoo los ntawm lub zog xa hluav taws xob tsis siv hluav taws xob los ntawm tus txhuam txhuam hniav thiab lub tshuab solenoid valve coils uas tau khaws los ntawm scrapyard.Ua ntej pib, thov saib cov vis dis aus hauv qab no:
IoT Ua Yooj Yim: Txheeb Xyuas Cov Ntaub Ntawv Huab Cua Tej Zaum: UV thiab Huab Cua Kub & Vaum: 7 Kauj Ruam
IoT Ua Yooj Yim: Txheeb Xyuas Cov Ntaub Ntawv Huab Cua Nyob deb: UV thiab Huab Cua Kub & Vaum: Ntawm qhov kev qhia no, peb yuav ntes cov ntaub ntawv nyob deb li UV (Ultra-Violet hluav taws xob), huab cua kub thiab av noo. Cov ntaub ntawv no yuav yog ib qho tseem ceeb heev thiab yuav siv rau yav tom ntej Chaw Ua Haujlwm Huab Cua.Qhov thaiv daim duab qhia tau tias peb yuav tau txais dab tsi thaum kawg
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): 7 Kauj Ruam
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): Xav hloov pauv yam ntawm koj lub laptop lossis PC? Xav tau kev hloov pauv hauv koj qhov chaw? Ua raws cov kauj ruam no yooj yim thiab yooj yim kom ua tiav koj tus kheej lub computer ntsuas phoo
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: 4 Cov Kauj Ruam
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: Nyeem … lub npe