Cov txheej txheem:

Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Cov nyob sib ze: 4 Cov Kauj Ruam
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Cov nyob sib ze: 4 Cov Kauj Ruam

Video: Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Cov nyob sib ze: 4 Cov Kauj Ruam

Video: Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Cov nyob sib ze: 4 Cov Kauj Ruam
Video: 3/22 Cov txiaj ntsig ntawm cov hluav taws daim 2 - Cov Hluav Taws Ntawm Vaj Ntsujplig Dawb Huv 2024, Hlis ntuj nqeg
Anonim
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Qhov Chaw Nyob Sib Xws
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Qhov Chaw Nyob Sib Xws
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Qhov Chaw Nyob Sib Xws
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Qhov Chaw Nyob Sib Xws
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Qhov Chaw Nyob Sib Xws
Ntse Tsev Automation Nrog Cov Hluav Taws Xob Energenie - Qhov Chaw Nyob Sib Xws

Taw qhia

Muaj ntau qhov piv txwv ntawm kev siv tsev ntse hauv tsev tawm muaj, tab sis qhov no yog qhov yooj yim thiab tau ua haujlwm tau zoo rau ib xyoos hauv kuv lub tsev yog li kuv vam tias koj nyiam nws. Thaum koj ua tiav koj yuav muaj lub cuab yeej uas tuaj yeem tshuaj xyuas lub network kom pom tias koj nyob hauv tsev, raws li qhov twg Wi-nkaus tau qhib lub cuab yeej koj khaws ntawm koj tus kheej, thiab tuaj yeem tswj cov txheej nyob ntawm tus siv RF kav hlau txais xov. Yog li tam sim no, thaum koj nkag mus rau hauv koj lub tsev, lub teeb yuav los thiab thaum koj tawm mus lawv yuav tua, tsuas yog los ntawm koj lub xub ntiag (tseem koj tuaj yeem txuag tau ntau lub zog ntawm cov khoom siv uas tsis xav tau thaum koj nyob tsis muaj, zoo li hais lus wireless).

Nws khiav tawm Raspberry Pi 2 tus qauv B, thiab siv pi-mote los ntawm Energenie, txawm hais tias kuv paub tseeb tias ib qho RF tswj lub qhov (socket) tuaj yeem raug nyiag ua haujlwm nrog cov khoom raug. Nws tau sau npe hauv Python, feem ntau yog siv nmap-sej tsev qiv ntawv rau chaw nres nkoj xa tawm ntawm koj lub network.

Yuav tsum:

1. Raspberry Pi - Kuv tau siv 2 Tus Qauv B, tab sis ib qho twg yuav ua haujlwm (tsis paub meej txog kev ntseeg tau ntawm xoom hla lub wireless network tab sis) - txuas nrog koj lub router (ethernet yog tias ua tau).

2. Energenie Pi-mote board thiab qhov nyob

3. Length ntawm cov hlau thiab cov hlau txuas yog tias ua tau

4. Optional khawm thiab LED override

Kauj Ruam 1: Kauj Ruam 1: Sib dhos

Kauj ruam 1: Sib dhos
Kauj ruam 1: Sib dhos
Kauj ruam 1: Sib dhos
Kauj ruam 1: Sib dhos
Kauj ruam 1: Sib dhos
Kauj ruam 1: Sib dhos

Tsis tas yuav xav kom kuv rov ua cov txheej txheem teeb tsa yooj yim ntawm no, Pi-mote nws muaj nws cov lus qhia uas yog qhov ncaj ncees.

energenie4u.co.uk/res/pdfs/ENER314%20UM.pd…

Txawm tias lub rooj tsavxwm muaj lub kav hlau txais xov, nws tau pom zoo rau ntau yam ntau dua (> 5m) ntxiv cov kav hlau txais xov raws li tau qhia hauv daim duab (kab rov tav dub). Cov cim qhia tau xa mus ntawm 433MHz yog li lub kav hlau txais xov yuav tsum ntxhib 1/4 * v/f ~ = 15cm ntev.

Kuv tseem tau ntxiv cov ntaub ntawv lego rau kuv, Kuv yuav cia koj ua tus txiav txim siab ntawm txoj haujlwm zoo:)

Kauj Ruam 2: Kauj Ruam 2: Nrhiav Koj Li Devices 'IP Address

Kauj Ruam 2: Nrhiav Koj Li Devices 'IP Address
Kauj Ruam 2: Nrhiav Koj Li Devices 'IP Address

Raws li tau hais tseg lub cuab yeej software tseem ceeb yog lub tsev qiv ntawv hu ua nmap uas tau hloov kho rau nab hab sej thiab tuaj yeem rub tawm los ntawm no: https://pypi.python.org/pypi/python-nmap/0.6.1 Nws tuaj yeem ua ntau yam khoom:

Peb yuav pib ua qhov dav dav scan ntawm lub network txhawm rau nrhiav cov cuab yeej raug thiab hauv cov haujlwm tseem ceeb khiav lub scan ntawm lub network.

Qhib tus nab npawb dav hlau thiab ntaus:

ntshuam ntshuam

nm = nmap. PortScanner ()

nm.scan (tswv = 'network IP chaw nyob ntau', kev sib cav = '-sP')

Tus IP chaw nyob yuav yog qee yam xws li: '192.168.0.1/24'

Qhov no yuav muab rau koj cov npe khoom ntev ntawm koj lub network, koj yuav tsum siv kev sim thiab yuam kev los txiav txim siab tias cov cuab yeej twg koj xav tau.

Cov kauj ruam no yooj yim dua ua nrog arp-scan cov lus txib lossis ping sab nraum tus neeg txhais lus nab nab, uas muab qee cov ntaub ntawv rau koj ntawm cov khoom siv, tab sis txij li thaum peb tau siv lub tsev qiv ntawv nab nab-nmap lawm kuv xav tias kuv yuav tso qhov no rau hauv.

Thaum koj tau pom cov cuab yeej twg koj xav siv los ua tus tswj hwm lub xub ntiag xws li xov tooj ntawm tes, ntsiav tshuaj thiab lwm yam Nco ntsoov lawv tus IP chaw nyob. Qhov no ua haujlwm ntawm ob qho tib si muaj zog thiab zoo li qub tswj tus IP chaw nyob.

Txhawm rau kom paub tseeb tias koj muaj lub cuab yeej raug, koj tuaj yeem txuas nws los ntawm lub network, thiab rov ua haujlwm luam theej duab, nws yuav tsum tsis tshwm ntawm koj lub scan.

Kauj Ruam 3: Kauj Ruam 3: Teeb Koj Qhov Ntsuas

Kauj Ruam 3: Teeb Koj Qhov Ntsuas
Kauj Ruam 3: Teeb Koj Qhov Ntsuas

Tam sim no koj muaj koj tus IP chaw nyob, koj yuav tsum teeb tsa koj lub qhov (socket). Qhov no yog ua tiav los ntawm kev tuav lub pob ntsuab ntawm lub qhov nyob kom txog thaum lub teeb liab liab thiab tom qab ntawd xa cov teeb liab xaiv. Cov cim sib txawv tau ua tiav los ntawm txheej 4 binary hloov pauv sib xws rau cov txiaj ntsig digital ntawm Pi.

Muaj tus lej piv txwv hauv phau ntawv Energenie rau kev hloov pauv, Kuv xav hais kom luam qhov no thiab yoog raws tsab ntawv luv uas tso cai rau koj teeb tsa lub qhov (socket) los ntawm kev xa lub teeb liab thaum koj sau tsab ntawv.

Kauj Ruam 4: Kauj Ruam 4: Sau Koj Li Code

Thiab mus rau qhov program kawg.

Kuv tau txuas cov cai kuv tau siv, uas ua haujlwm rau ob lub cuab yeej rau txhua tus neeg nyob hauv peb lub tsev, thaum muaj lub khawm hla rau lwm tus.

Txoj cai ua haujlwm los ntawm kev tshawb nrhiav tus IP chaw nyob '192.168.0.10' thiab '192.168.0.28'. Tom qab ntawd nws tsuas yog saib cov chaw nres nkoj 80 thiab 62078 kom txuag sijhawm, cov chaw nres nkoj no feem ntau qhib rau kev sib txuas lus ntawm cov khoom siv mobile. Hloov tus IP chaw nyob mus rau qhov chaw nyob uas koj pom hauv qib kawg. Nws kuj tseem txheeb xyuas lub khawm nkag, qhov no khawm txuas nrog tus pin 40 hauv GPIO.setup nrog rub tawm rau hauv av. Yog tias ib qho ntawm cov khoom siv tam sim no, lossis lub pob tau qhib, nws xa lub teeb liab mus rau lub qhov rooj kom qhib.

Txhawm rau zam qhov muaj peev xwm tso tawm: thaum lub cuab yeej yuav qhib sai sai ntawm koj lub xub ntiag, vim tias tsis muaj qhov tsis zoo, nws yuav kaw tom qab lub sijhawm ntev dua. Qhov no yog vim tias muaj qee zaum tsis raug qhov tsis zoo, piv txwv li nws tsis raug txheeb xyuas lub cuab yeej ntawm txhua qhov scan. Raws li kuv tau hais peb tsis muaj kev poob haujlwm hauv ib xyoos ntawm kev ua haujlwm siv cov txheej txheem no.

Kuv kuj tseem tshuav qhov debug code nyob rau hauv vim qhov no muaj txiaj ntsig zoo rau kev ua haujlwm seb koj cov cai ua haujlwm raug. Xav tias dawb los tsim thiab hloov pauv los ntawm lub hauv paus no kom muaj ntau lub qhov (socket) thiab cov khoom siv ntawm txhua qhov cuam tshuam. Ib qho ntxiv koj yuav zaum xav ua txoj cai no tas li ntawm koj Pi hauv keeb kwm yav dhau los thaum nws tab tom ua lwm yam, zoo dua los ntawm kev pib. Yog xav paub ntxiv yuav ua li cas, saib cov xov no:

Pom zoo: