Cov txheej txheem:

IOT CA2 Ruaj Ntseg Tsev/Chav: 8 Kauj Ruam
IOT CA2 Ruaj Ntseg Tsev/Chav: 8 Kauj Ruam

Video: IOT CA2 Ruaj Ntseg Tsev/Chav: 8 Kauj Ruam

Video: IOT CA2 Ruaj Ntseg Tsev/Chav: 8 Kauj Ruam
Video: 8th Std Science | Anu amaippu | அணு அமைப்பு | Term 2 | part 2 2024, Kaum ib hlis
Anonim
IOT CA2 Ruaj Ntseg Tsev/Chav
IOT CA2 Ruaj Ntseg Tsev/Chav
IOT CA2 Ruaj Ntseg Tsev/Chav
IOT CA2 Ruaj Ntseg Tsev/Chav

Cov Ntsiab Lus

1 Txheej txheem cej luam ntawm Ntse Tsev Ruaj Ntseg

2 Kho vajtse xav tau + teeb tsa

3 Software xav tau + teeb tsa

4 Sau npe raspberrypi ua ib yam

5 Tsim S3 Thoob

6 teeb tsa DynamoDB + Cov Cai

7 Qhov kev cia siab yuav tshwm sim

8 Codes (Los ntawm Pastebin)

9 Cov neeg ua tim khawv

Txheej txheem cej luam

Txais tos! Qhov haujlwm Raspberry Pi no yog "lub tsev ntse" kev tswj hwm, nrog rau qee yam kev nyab xeeb. Txoj haujlwm no tuaj yeem ntsuas ntau yam txiaj ntsig xws li kub thiab lub teeb. Tshooj kev nyab xeeb suav nrog Buzzer, daim npav scanner system (Tso cai daim npav), lub koob yees duab sab hauv thiab sab nraud nrog rau SMS ceeb toom system. Cov lus qhia hauv qab no yuav npog qhov teeb tsa ntawm tag nrho txoj haujlwm.

Yeej, peb muaj lub teeb diode resistor thiab DHT11 sensor kom tau txais qhov kub thiab ntxiv rau lub teeb pom kev. Cov txiaj ntsig yuav raug tshaj tawm rau 'smartroom/sensors/values' thiab yuav muaj kev tso npe rau lub ncauj lus los tshuaj xyuas yog tias qhov txiaj ntsig tau tshaj tawm. Thaum qhov txiaj ntsig tau tshaj tawm, qhov tseem ceeb yuav raug xa mus rau peb lub rooj DynamoDB. Cov txiaj ntsig khaws cia hauv DynamoDB tuaj yeem muab rho tawm thiab npaj rau hauv daim duab uas qhia txog lub sijhawm tiag tiag hauv peb lub vev xaib. (Teeb duab) Dhau li siv cov ntsuas ntsuas kom tau txais txiaj ntsig los npaj peb lub teeb rau kev tshuaj xyuas lub hom phiaj, peb lub dht11 lub ntsuas kuj tseem siv ua lub peev xwm "tua hluav taws". Thaum nws tsoo qhov kub uas yuav yog hluav taws, peb muaj tsab ntawv hu ua publishHeat.py uas yuav tshaj tawm qhov kub thiab txias mus rau lub ncauj lus 'smartroom/sensor/hluav taws', lub khob cij uas ua piv txwv sab nrauv ntawm chav tsev yuav sau npe mus rau qhov ntawd. lub ncauj lus thiab muaj lub teeb ci LED los qhia tias yuav muaj peev xwm tua hluav taws. Lub tswb yuav tawm ib yam nrog rau SMS ceeb toom rau tus tswv tsev thaum muaj tej zaum yuav muaj hluav taws tuaj.

Txhawm rau nkag mus hauv tsev/chav, tus neeg siv yuav tsum coj mus rhaub lawv daim npav ntawm RFID scanner. Yog tias daim npav tapped tsis raug, lub tswb nrov yuav nrov mus txog thaum daim npav uas muaj daim ntawv pov thawj raug cai raug teeb tsa. Ib qho ntxiv, thaum siv daim npav tsis raug, lub koob yees duab saib xyuas sab nraud yuav yees duab ntawm tus neeg siv uas tau siv daim npav thiab muab daim duab tso rau hauv S3 thoob. Tus tswv tsev tseem yuav tau txais SMS hais tias ib tus neeg tau sim nkag mus hauv nws lub tsev. Chav tsev tseem muaj qhov taw qhia LED sab nraud rau daim ntawv lo yog lub qhov rooj xauv/xauv. Thaum lub qhov rooj raug kaw, lub teeb daj daj tau taws. Thaum xauv, lub ntsuab LED yuav taws. Thaum daim npav tso cai raug coj mus rhaub, lub qhov rooj yuav qhib rau 15 vib nas this thiab nrog lub teeb ntsuab ntsuab lit tom qab ntawd rov qab mus rau hauv lub xauv hom nrog lub teeb daj daj.

Cov neeg siv tuaj yeem saib cov ntaub ntawv sau los ntawm Dashboard hauv Node-Liab uas qhia txog qhov ntsuas tam sim no ntxiv rau cov duab sawv cev ntawm qhov ntsuas thiab daim duab keeb kwm. Lub Dashboard tseem suav nrog cov yam ntxwv ntxiv xws li lub moos uas qhia txog cov ntaub ntawv tam sim no thiab sijhawm thiab hloov mus rau kev tswj hwm ntau yam khoom siv hluav taws xob, uas tau sawv cev ua LEDs thiab lub suab nrov.

Thaum kawg, peb kuj muaj tus lej xov tooj bot feature. Telegram bot muaj peev xwm rub duab deb ntawm txhua yam uas tau tshwm sim hauv chav thiab khaws nws rau hauv S3 thoob. Cov duab no yuav sau nrog sab hauv daim nplaub tshev npe Homed/User Telegram bot yuav tuaj yeem tswj hwm lub teeb ci LED nyob hauv chav ib yam nkaus.

Kauj Ruam 1: Yuav Tsum Kho Vajtse + Teeb

Kev Kho Vajtse Yuav Tsum + Teeb
Kev Kho Vajtse Yuav Tsum + Teeb
Kev Kho Vajtse Yuav Tsum + Teeb
Kev Kho Vajtse Yuav Tsum + Teeb

Txuas cov khoom hauv qab no nrog koj 2 raspberry pis raws li qhia hauv daim duab fritzing saum toj no.

2 x Raspberry Pi

3 x Breadboard

1 x MCP3008 ADC

1 x DhT 11 sensor

1 x LDR

1 x RFID/NFC MFRC522 Daim Npav Nyeem Ntawv

4 x lwd

1 x LCD Screen

3 x 10k Resistor

4 x 220/330 Resistor

1 x Khawm

1 x Buzzer

34 x Txiv neej rau txiv neej cables

11 x Txiv neej rau poj niam cables

Kauj ruam 2: Software Yuav Tsum Tau + Teeb

Software Yuav Tsum + Teeb
Software Yuav Tsum + Teeb
Software Yuav Tsum + Teeb
Software Yuav Tsum + Teeb
Software Yuav Tsum + Teeb
Software Yuav Tsum + Teeb

Ntaus cov lus txib hauv qab no rau hauv koj lub raspberry pi davhlau ya nyob twg kom ntseeg tau tias lawv tau teeb tsa.

Yog tias ib qho ntawm cov software hauv qab no twb rub tawm rau hauv koj tus pi, sudo pip install (Software name) -hloov kho yuav ua qhov dag ntawm kev hloov kho nws.

- sudo pip nruab gevent

- sudo pip nruab flask

- sudo pip nruab nexmo

-sudo pip nruab-hloov kho-yuam-rov nruab pip == 9.0.3

-sudo pip nruab AWSIoTPythonSDK-hloov kho -disable-pip-version-check

-sudo pip nruab -hloov kho pip

-sudo apt-tau nruab python-dev

- sudo pip nruab boto3

- sudo pip nruab botocore

- sudo pip nruab numpy

- cd ~ ib

git clone

cd ~/SPI-Py

sudo python setup.py nruab"

- cd ~ ib

git clone

cd ~/MFRC522-nab hab sej

sudo python setup.py nruab"

- sudo nano /boot/config.txt, kos yog kab device_tree_param = spi = on

dtoverlay = spi-bcm2835 yog sab hauv, ntxiv rau ntxiv.

Kauj Ruam 3: Sau Npe Ib Yam

Sau Npe Ib Yam
Sau Npe Ib Yam
Sau npe Ib Yam
Sau npe Ib Yam
Sau npe Ib Yam
Sau npe Ib Yam
Sau npe Ib Yam
Sau npe Ib Yam

a) Ua ntej, mus rau IoT Core hauv AWS lub vev xaib los ntawm txhaj rau cov kev pabcuam, tom qab ntawd IoT Core.

b) Ntawm qhov bar qhia hauv kev tswj hwm, xaiv yam thiab xaiv sau npe yam khoom.

c) Xaiv Tsim ib yam nkaus.

d) Sau lub npe rau koj yam, piv txwv li, MyRaspberryPi2. Tawm qhov seem ntawm cov teb los ntawm lawv cov txiaj ntsig qub. Nyem txuas ntxiv hauv qab ntawm nplooj ntawv.

e) Nyem tsim daim ntawv pov thawj. Rub tawm tag nrho plaub cov ntaub ntawv. Txog cov hauv paus CA cov ntawv, rub tawm Amazon Root CA 1 thiab khaws nws hauv cov ntawv sau.

f) Thaum ua tiav, txav plaub daim ntawv mus rau hauv phau ntawv teev npe hauv raspberry pi.

g) Nyem qhib.

h) Tom qab nyem rau ntawm txoj cai txuas, koj yuav raug coj mus rau nplooj ntawv hauv qab no. Nyem rau npe khoom, txoj cai yuav tsim tom qab.

i) Ntawm iot dashboard, mus rau cov cai hauv qab ntu kev nyab xeeb. Nyem tsim txoj cai.

j) Sau lub npe rau koj txoj cai, rau qhov piv txwv no nws yuav yog MyRaspberryPiSecurityPolicy thiab qhov tseem ceeb hauv qab no hauv qab Ntxiv nqe lus. Tom qab ntawv nyem rau Tsim.

k) Ntawm iot dashboard, mus rau daim ntawv pov thawj raws li ntu ruaj ntseg. Xaiv daim ntawv pov thawj uas koj tau tsim yav dhau los, thiab nyem txuas txoj cai los ntawm kev nqis tes ua nqis. Txuas txoj cai koj tau tsim yav tas los.

l) Xaiv daim ntawv pov thawj uas koj tau tsim yav tas los dua, thiab nyem qhov txuas. Txuas txoj cai uas koj tau tsim yav tas los. Txuas qhov uas koj tau tsim yav tas los.

Kauj Ruam 4: Tsim S3 Thoob

Tsim S3 Thoob
Tsim S3 Thoob
Tsim S3 Thoob
Tsim S3 Thoob
Tsim S3 Thoob
Tsim S3 Thoob
Tsim S3 Thoob
Tsim S3 Thoob

a) Peb yuav pib nrog kev siv tshawb nrhiav hauv AWS tswj kev tswj hwm thiab tshawb rau "s3".

b) Nyem rau tsim lub thoob.

c) Ntaus lub npe rau lub thoob. Rau qhov piv txwv no, peb yuav siv lub npe "sp-p1703263". Peb yuav xaiv thaj av "US EAST (N. VIRGINIA)" uas yog peb-sab hnub tuaj-1. Tom qab ua tiav, nyem rau Tsim.

d) Lub thoob tsim tshiab yuav tshwm nyob rau ntawm lub dashboard.

Kauj Ruam 5: Tsim DynamoDB Table thiab Teeb Cov Cai

Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai
Tsim DynamoDB Table thiab Teeb Cov Cai

a) Ua ntej, taw mus rau AWS kev pabcuam los ntawm txhaj rau

cov kev pabcuam, tom qab ntawd DynamoDB. Nyem tsim cov lus.

b) Nkag mus rau lub npe lub npe "iotdata" thiab thawj qhov tseem ceeb "deviceid" nrog cov lej yuam sij "datetimeid", tom qab ntawd nyem tsim nyob hauv qab ntawm nplooj ntawv.

c) Tom qab ntawd, rov qab mus rau IoT Core nplooj ntawv. Nyem Txoj Cai, tom qab ntawd nyem rau tsim txoj cai tshiab.

d) Tsim txoj cai nrog lub npe “MyDynamoDBRule”. Hauv qab txoj cai nug nqe lus nug nqe lus, sau "sensors/light".

e) Hauv qab Teeb ib lossis ntau qhov kev nqis tes ua, nyem rau ntawm qhov ua ntxiv, nyem rau ntawm "cais cov lus rau ntau kab ntawm cov lus database". Nyem rau teeb tsa kev nqis tes ua. Hauv qab lub npe npe, xaiv iotdata. Hauv qab IAM lub luag haujlwm lub npe, xaiv lub luag haujlwm uas koj tau tsim yav dhau los uas yog "dynamodb_role". Nyem ntxiv ua, tom qab ntawd tsim txoj cai.

f) Nyem rau tsim txoj cai.

Kauj Ruam 6: Kev Cia Siab Tau Txais

Kev Cia Siab Tau Txais
Kev Cia Siab Tau Txais
Kev Cia Siab Tau Txais
Kev Cia Siab Tau Txais

Sab nraum zoov

rau tus pi sawv cev rau sab nraum zoov ntawm chav, cov ntawv sau heatdetector.py thiab AccessDoor.py yuav khiav. Yog tias daim npav tsis raug coj mus rhaub ntawm RFID lub tshuab luam ntawv, lub tswb yuav tawm mus, nrog lub teeb daj daj tseem pom. Ib qho SMS yuav raug xa mus rau tus tswv tsev lub xov tooj kom ceeb toom txog qhov muaj peev xwm nkag mus tau. Tswb yuav suab ib yam nkaus. Ib daim duab tseem yuav raug coj mus thiab muab xa mus rau hauv S3 thoob. Yog tias daim npav tau txais kev tso cai, LED ntsuab yuav ci thiab tus neeg siv nkag tau. Lub qhov rooj yuav raug kaw dua tom qab 15 vib nas this (Ntsuab LED yuav tawm thiab LED daj daj rov qab). Yog tias qhov kub hauv chav/tsev tau siab dhau (Rau qhov kub peb pom tias yog lub tsev/chav uas muaj hluav taws), peb yuav xa SMS ceeb toom rau tus tswv tsev. Tswb tseem yuav ua suab nrog liab LED sab nraum lub teeb.

Nyob sab hauv tsev

rau tus pi sawv cev rau sab hauv ntawm chav, cov ntawv tshaj tawmHeat.py, server.py, pubsub.py, telegrambot.py yuav raug khiav. Pubsub.py yuav khaws lub sijhawm tiag tiag rau hauv DynamoDB. thaum server.py khiav, ntaus hauv rpi tus IP chaw nyob: 5000 hauv qhov browser, koj yuav raug coj mus rau peb lub vev xaib sib tham. Peb muaj daim duab uas qhia txog lub sijhawm tiag tiag qhov txiaj ntsig tau los ntawm peb cov ntsuas hauv pubsub.py rau hauv DynamoDB. Ib qho ntxiv, cov txiaj ntsig keeb kwm yav dhau los tseem yuav tshwm rau hauv peb lub vev xaib. luam tawm Heat.py yuav tshaj tawm qhov ntsuas kub rau sab nraum lub khob cij rau lub hom phiaj ntsuas hluav taws. telegrambot.py yuav pab kom cov neeg siv tswj kev nyob deb ntawm qhov qhib/tua ntawm lub teeb LED hauv chav/tsev thiab ntxiv rau daim duab ntawm dab tsi tshwm sim sab hauv thiab xa cov duab rau hauv S3 thoob.

Kom pom kev zoo dua ntawm qhov kev cia siab yuav tsum zoo li cas:

Kauj Ruam 7: Cov Cim Cim (Pastebin)

Cov Cai Codes (Pastebin)
Cov Cai Codes (Pastebin)

Nyem rau qhov txuas. Suav nrog txhua qhov xav tau qhov chaws:

Kauj Ruam 8: Cov neeg ua tim khawv

Cov neeg ua tim khawv
Cov neeg ua tim khawv

Iotguider. (2019). Xa SMS los ntawm Raspberry Pi siv Python. [online] Muaj nyob ntawm: https://iotguider.in/raspberrypi/send-sms-from-raspberry-pi-python/ [Nkag mus rau 21 Lub Yim Hli 2019].

Pom zoo: