Cov txheej txheem:

Sensor Stations Network rau Teeb Pom Kev Zoo thiab Kev Ruaj Ntseg: 5 Cov Kauj Ruam (nrog Duab)
Sensor Stations Network rau Teeb Pom Kev Zoo thiab Kev Ruaj Ntseg: 5 Cov Kauj Ruam (nrog Duab)

Video: Sensor Stations Network rau Teeb Pom Kev Zoo thiab Kev Ruaj Ntseg: 5 Cov Kauj Ruam (nrog Duab)

Video: Sensor Stations Network rau Teeb Pom Kev Zoo thiab Kev Ruaj Ntseg: 5 Cov Kauj Ruam (nrog Duab)
Video: ЕЖЕНЕДЕЛЬНЫЕ СТРАННЫЕ НОВОСТИ - НЛО - Паранормальные явления - Космос - Странная наука 2024, Hlis ntuj nqeg
Anonim
Sensor Stations Network rau teeb pom kev zoo thiab tswj kev nyab xeeb
Sensor Stations Network rau teeb pom kev zoo thiab tswj kev nyab xeeb
Sensor Stations Network rau teeb pom kev zoo thiab tswj kev nyab xeeb
Sensor Stations Network rau teeb pom kev zoo thiab tswj kev nyab xeeb
Sensor Stations Network rau teeb pom kev zoo thiab tswj kev nyab xeeb
Sensor Stations Network rau teeb pom kev zoo thiab tswj kev nyab xeeb

Nrog lub ntsuas hluav taws xob no lub network teeb tsa hauv tus tswv/qhev hom, koj yuav tuaj yeem ua teeb pom kev zoo thiab tswj kev nyab xeeb hauv koj lub tsev. Cov chaw nres tsheb sensor (Node01, Node02 hauv qhov haujlwm no) txuas nrog lub chaw nres tsheb loj (Node00) txuas nrog koj lub network wifi hauv zos. Kuv tau teeb tsa Node01 hauv kuv chav khaws khoom thiab Node02 hauv kuv lub nkas -las tswj teeb thiab ua haujlwm. Tus tswv chaw nres tsheb tau teeb tsa hauv peb chav dinig txuas nrog peb lub router wifi. Kuv tau teeb tsa lub tswb nyob hauv qhov chaw nres tsheb thiab lub suab nrov me me hauv tus tswv chaw nres tsheb kom nrov thaum lub suab pom los ntawm qee qhov chaw nres tsheb sensor hauv lub network.

Cov yam ntxwv tseem ceeb ntawm lub network yog:

  • Nws muaj peev xwm teeb tsa lub network nrog ntau dua ob lub chaw nres tsheb sensor (chaw qhev) (Node01, Node02, Node03, ….)
  • Vim hais tias kev siv wireless transceivers nrog kav hlau txais xov, lub network muaj peev xwm npog thaj tsam dav
  • Koj tuaj yeem tswj hwm tag nrho lub network los ntawm lub xov tooj ntawm tes
  • Xa email (Gmail account) thaum kuaj pom lub suab thiab lub tswb hom tau qhib. Yog li yog tias koj ua kom Gmail thawb cov ntawv ceeb toom hauv koj lub xov tooj ntawm tes koj yuav paub thaum pom kev txav chaw hauv koj lub network

rau lub hom phiaj domotic:

  • Hloov ntawm lub teeb thaum pom lub suab txav / hloov ib txwm ntawm lub teeb (rau tag nrho cov network lossis rau txhua qhov chaw qhev)
  • Hloov lub sijhawm hauv feeb feeb lub teeb tau qhib tom qab tau pom lub zog rau txhua qhov chaw qhev

rau kev ruaj ntseg lub hom phiaj:

  • Pab thiab lov tes taw lub tswb hom
  • Txhua qhov chaw nres tsheb qhev tuaj yeem xa lub teeb liab mus rau lub chaw nres tsheb tseem ceeb (Node00) thaum lub tswb hom tau qhib thiab pom lub suab
  • Tus tswv chaw nres tsheb tuaj yeem qhib lub tswb thiab xa email thaum ib qho ntawm cov teeb liab no tau txais los ntawm ib qho chaw nres tsheb qhev thiab lub tswb hom tau qhib. Tus tswv chaw nres tsheb (Node00) txuas nrog internet siv kev sib txuas wifi los tswj tag nrho cov kab ke siv xov tooj ntawm tes. Nws tau teeb tsa zoo li WifiWebServer

Kauj Ruam 1: Cov Npe Khoom

Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv

Cov npe khoom siv uas kuv tau siv los tsim Node01 thiab Node02 (cov chaw qhev) yog cov hauv qab no:

  • Mega 2560 R3 pawg thawj coj saib
  • Kev txhawb nqa yas rau MEGA 2560 R3
  • HC-SR501 PIR sensor
  • Kev txhawb nqa yas rau HC-SR501
  • 5V Kev Tshaj Tawm
  • Wireless Transceiver Module 2.4G 1100m NRF24L01+PA+LNA nrog Kav hlau txais xov LKY67
  • 8Pin NRF24L01 adapter (txhawm rau txhim kho cov yam ntxwv ntawm NRF24L01)
  • HLK-PM01 AC DC 220V rau 5V Cov Khoom Siv Hluav Taws Xob

Cov npe khoom siv los tsim Node00 (tus tswv tsev) yog cov hauv qab no:

  • Mega 2560 R3 pawg thawj coj saib
  • Kev txhawb nqa yas rau MEGA 2560 R3
  • WiFi module NodeMCU Lua Amica V2 ESP8266
  • Wireless Transceiver Module 2.4G 1100m NRF24L01+PA+LNA nrog Kav hlau txais xov LKY67
  • 5v-3.3v VCC adapter board rau NRF24L01 (txhawm rau txhim kho cov yam ntxwv ntawm NRF24L01)
  • Adapter AC-DC, 9V, 1A (2, 1 mm x 5, 5mm)

Ntxiv mus kuv tau siv cov ntaub ntawv hauv qab no:

  • 2 Pin 5 hli PCB txuas
  • Jumper xov hlau
  • Breadboard MB-102 (800 tus neeg hu)
  • Mini Solderless Breadboard 170 hu
  • Teeb ntawm leds thiab resistences
  • PCB cov laug cam
  • Tin Soldering Hlau Khoom
  • Phom phom
  • Pob tshab methacrylate
  • Tswb

Kauj Ruam 2: Yuav Ua Li Cas Txuas thiab Ua Haujlwm Node01 thiab Node02 (Cov Chaw Qhev)

Yuav Ua Li Cas Txuas thiab Kev Pabcuam Node01 thiab Node02 (Cov Chaw Qhev)
Yuav Ua Li Cas Txuas thiab Kev Pabcuam Node01 thiab Node02 (Cov Chaw Qhev)
Yuav Ua Li Cas Txuas thiab Kev Pabcuam Node01 thiab Node02 (Cov Chaw Qhev)
Yuav Ua Li Cas Txuas thiab Kev Pabcuam Node01 thiab Node02 (Cov Chaw Qhev)

Txhawm rau tsim cov duab kos "SlaveSation.ino" Kuv xav tau RF24 lub tsev qiv ntawv thiab RF24 Network tsev qiv ntawv.

Hauv daim phiaj ntws saum toj no koj tuaj yeem pom lub logic ntawm lub chaw nres tsheb sensor thiab cov lus sib pauv ntawm tus qhev sensor chaw nres tsheb thiab tus tswv.

Ua ntej koj thauj cov duab kos koj yuav tsum teeb tsa qhov chaw nyob ntawm tus qhev nyob ntawm hom octal

const uint16_t this_node = 01; // Chaw nyob ntawm peb cov node nyob rau hauv hom octal (qhev): 01, 02, 03…

Lub ntsiab lus ntawm kev coj hauv txhua qhov chaw qhev yog cov hauv qab no:

  • Xiav coj. Nws yuav nyob thaum PIR sensor tus pin siab.
  • Ntsuab coj. Nws yuav nyob thaum lub tswb txuas nrog.

Kauj Ruam 3: Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)

Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)
Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)
Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)
Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)
Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)
Yuav Ua Li Cas Txuas thiab Program Node00 (Master Station)

Hauv Node00 chaw nres tsheb peb tuaj yeem pom ob lub rooj sib txawv:

  • MEGA 2560 R3 pawg thawj coj saib. Cov cuab yeej no tau siv los txais cov lus los ntawm chaw nres tsheb qhev thaum lub suab pom tau siv kev sib txuas lus wireless. Nws yuav qhib lub tswb thaum pom lub zog thiab lub tswb txuas nrog. Txhawm rau nres lub tswb tsuas yog txuas lub tswb hom. Ntxiv mus nws xa mus rau cov qhev chaw nres tsheb cov lus los ntawm NodeMCU txhawm rau pab lossis lov tes taw nrhiav kom pom, tig ib txwm nyob ntawm lub teeb, kom ib txwm tua lub teeb, …
  • NodeMCU Lua Amica V2 ESP8266 board. Nws ua haujlwm zoo li Wifi Web Server kom xa thiab tau txais cov lus txib los ntawm qhov chaw nyob deb uas siv lub Vev Xaib hauv lub xov tooj ntawm tes. Ntxiv mus xa e-mail lus thaum pom lub suab thiab lub tswb hom tau qhib.

Ob lub cuab yeej tau npaj rau kev sib tham nrog ib leeg hauv tus Xib Hwb (NodeMCU)/Qhev (MEGA) teeb tsa los ntawm I2C synchronous serial raws tu qauv siv Wire Library. I2C cov txheej txheem cuam tshuam nrog siv ob kab xa thiab txais cov ntaub ntawv: tus lej xov tooj txuas (SCL) thiab tus lej xov tooj (SDA) uas cov ntaub ntawv raug xa ntawm ob lub cuab yeej.

Raws li koj tuaj yeem pom hauv kev kos duab, ob tus pin rau I2C kev sib txuas lus hauv MEGA 2560 R3 pawg thawj coj yog:

  1. SDA -> pin 20 SDA
  2. SCL -> pin 21 SCL

thiab lwm qhov hauv NodemMCU yog:

  1. SDA -> digital pin 1
  2. SCL -> tus lej digital 2

Ua ntej koj thauj khoom kos duab rau ESP8266 koj yuav tsum teeb tsa ESP8266 lub rooj tsavxwm. Txhawm rau ua qhov no koj yuav tsum nkag mus "https://arduino.esp8266.com/stable/package_esp8266com_index.json" mus rau "Tus Thawj Saib Xyuas Haujlwm Ntxiv URLs" nyob rau hauv lub qhov rai nyiam hauv Arduino IDE. Tom qab ntawd koj yuav tsum qhib tus thawj tswj hwm pawg thiab teeb tsa "esp8266"

Kuv siv cov khoom siv hluav taws xob sab nraud (9V, 1A) rau MEGA 2560 R3 board (DC fais fab nkaus, 2, 1mm x 5, 5 mm) thiab kuv txuas NodeMCU board rau 3V3 tus pin hauv MEGA board.

Kauj Ruam 4: WifiWebServer (NodeMCU hauv Master Station)

WifiWebServer (NodeMCU hauv Chaw Nres Tsheb)
WifiWebServer (NodeMCU hauv Chaw Nres Tsheb)
WifiWebServer (NodeMCU hauv Chaw Nres Tsheb)
WifiWebServer (NodeMCU hauv Chaw Nres Tsheb)

Cov duab kos nkag rau hauv NodeMCU (Node00 lossis tus tswv chaw nres tsheb) tau teeb tsa zoo li WebServer txuas nrog koj lub network wifi hauv tsev. Nws muaj peev xwm nkag mus tau deb yog tias koj teeb tsa chaw nres nkoj xa mus hauv koj lub router.

Ua ntej koj thauj khoom WifiWebServerV3.ino kos duab rau NodeMCU koj yuav tsum ua cov hauv qab no:

  1. Hloov kho qhov chaw nres nkoj koj yuav teeb tsa hauv koj lub router (chaw xa khoom xa mus) kom nkag mus tau deb ntawm NodeMCU
  2. Hloov kho tus neeg siv thiab tus lej nkag mus nkag rau koj lub network wifi hauv tsev
  3. Hloov kho tus ID nkag mus thiab tus lej zais ntawm koj tus lej Gmail kom xa e-mail thaum pom cov lus tsa suab thiab lub tswb txuas nrog
  4. Hloov kho e-mail chaw nyob uas koj yuav tau txais e-mail

Txhawm rau hloov tus neeg siv, tus password thiab chaw nres nkoj tus neeg rau zaub mov yuav siv los mloog, koj yuav tsum tshawb nrhiav cov cai hauv qab no hauv WifiWebServerV3.ino kos duab thiab hloov kho nws:

const char*ssid = "*** koj ssid ***";

const char*password = "*** koj tus password ***"; WiFiServer server (80);

Txhawm rau hloov chaw nyob e-mail uas koj yuav tau txais e-mail koj yuav tsum tshawb nrhiav cov cai hauv qab no thiab hloov kho nws:

const char*to_email = "*** e-mail chaw nyob uas koj yuav tau txais cov lus ***";

Txhawm rau hloov tus neeg siv thiab tus lej zais ntawm koj tus lej Gmail kom tau txais e-mail koj yuav tsum tshawb nrhiav cov cai hauv qab no hauv cov ntawv "Gsender.h" thiab hloov kho nws:

const char*EMAILBASE64_LOGIN = "*** koj li e-mail chaw nyob encode hauv BASE64 ***";

const char*EMAILBASE64_PASSWORD = "*** koj tus password nkag rau hauv BASE64 ***"; const char*FROM = "*** koj li email chaw nyob ***";

Txhawm rau nkag los lossis txiav txim cov ntaub ntawv hauv BASE64 Kuv tau siv www.base64encode.org

Yog tias koj xav tau cov ntaub ntawv ntau ntxiv txog kev xa thiab tau txais e-mail nrog ESP8266 muaj "Qhia" txog nws ntawm no

Thaum koj tuaj yeem ua nws, koj tuaj yeem sim qhov kev sib txuas hauv koj lub router. Yog tias lub cuab yeej txuas nrog koj yuav tsum tseg tus IP chaw nyob rau lub cuab yeej no. Ntxiv mus nws yog lub tswv yim zoo los tham nrog koj tus muab kev pabcuam Is Taws Nem txhawm rau teeb tsa tus IP zoo li qub ntawm koj lub router.

Txhawm rau nkag mus rau nplooj ntawv web ze ntawm koj lub router wifi, tsuas yog ntaus tus IP chaw nyob uas tau muab los ntawm koj lub router tom qab qhov chaw nres nkoj koj tab tom siv hauv lub web navigator. Piv txwv li: 192.168.40.15:800. Yog tias koj sim nkag mus nyob deb koj yuav tsum ntaus tus IP chaw nyob ntawm koj lub router tom qab qhov chaw nres nkoj koj siv zoo li saum toj no.

Lub vev xaib kuv qhia koj hauv cov duab yog programmed los tswj lub network nrog ob lub chaw haujlwm qhev.

Thawj qhov teeb tsa tau teeb tsa los tswj 5 qhov chaw qhev ntau tshaj plaws, tab sis koj tuaj yeem hloov kho nws. Tsuas yog tshawb nrhiav cov cai hauv qab no hauv WifiWebServerV3.ino thiab SlaveStation.ino

#define tus lej_max_slaves 5

Lub vev xaib pib tau muab faib ua 4 ntu:

  1. Ntu "Xeev" qhov twg nws qhia koj yog tias lub tswb txuas nrog lossis tsis yog
  2. Tshooj "Lub tswb ceeb toom" qhov twg nws qhia koj tus lej ntawm kev txav mus los hauv txhua lub chaw haujlwm qhev
  3. Ntu "Tswb" qhov twg koj tuaj yeem txuas lossis tshem tawm (txuas txuas lub tswb/DISCONNECT ALARM) lub tswb thiab rov pib lub tswb tswb (RESET COUNTERS)
  4. Ntu "Teeb Pom Kev" qhov twg koj tuaj yeem tswj teeb ntawm txhua lub chaw haujlwm qhev. Koj tuaj yeem tswj cov hauv qab no:

    • Hloov lub teeb nyob rau txhua qhov chaw qhev / hloov ntawm lub teeb tsuas yog thaum pom cov lus tsa suab nyob hauv txhua qhov chaw qhev (NETWORK YUAV TSUM ON / NETWORK thaum txav)
    • Hloov lub sijhawm hauv feeb cov teeb tau qhib rau txhua qhov chaw qhev (NODExx ON 1 MINUTE/NODEXX ON 2 MINUTE)
    • Hloov lub teeb rau txhua lub chaw haujlwm qhev (NODExx ib txwm nyob)
    • Hloov lub teeb rau txhua lub chaw haujlwm qhev tsuas yog thaum pom cov lus tsa suab (NODExx_MOV)

Koj tsis tas yuav hloov dab tsi vim tias nws yuav ua haujlwm txawm lub npe ntawm cov chaw qhev koj teeb tsa. Ntxiv mus nws yuav cia li txheeb xyuas tus naj npawb ntawm qhev chaw sib txuas hauv lub network.

Tau kawg, koj tuaj yeem rub tawm daim duab thiab yooj yim los hloov cov cai tsim nyog los qhia koj tus kheej lub vev xaib tswj hwm nplooj ntawv.

Kauj ruam 5: Los ntawm Pib …

Nov koj yog cov kauj ruam uas koj yuav tsum ua raws los tsim koj lub network:

  1. Yuav tag nrho cov khoom siv hauv qab cov npe kuv muab rau koj hauv "Kauj Ruam 1"
  2. Txuas cov khoom hauv qab cov duab koj tuaj yeem rub tawm hauv "Kauj Ruam 2" thiab "Kauj Ruam 3"
  3. Tsim cov thawv rau txhua lub chaw haujlwm qhev thiab tus tswv chaw nres tsheb. Kuv tau tsim cov thawv methacrylate.
  4. Txhim kho txhua qhov chaw qhev:

    Rub tawm thiab thauj cov duab "SlaveStation.ino" hauv ib qho MEGA 2560 R3 board. Koj tsuas yog yuav tsum hloov kho cov duab kos thiab hloov chaw nyob ntawm chaw nres tsheb qhev raws li koj tuaj yeem pom hauv "Kauj Ruam 2"

  5. Teeb tsa tus tswv chaw nres tsheb:

    • Rub tawm thiab thauj cov duab "SlaveStation.ino" hauv ib qho MEGA 2560 R3. Koj tsis tas yuav hloov dab tsi txawm tias muaj pes tsawg tus qhev ntawm koj lub network. Thaum pib daim duab tau teeb tsa rau qhov siab tshaj ntawm 5 tus qhev chaw nres tsheb.
    • Rub tawm thiab thauj cov duab kos "WifiServerV3.ino" hauv NodeMCU. Koj yuav tsum hloov kho cov duab kos tom qab kev teeb tsa hauv "Kauj Ruam 4"
  6. Kho koj lub router kom nkag tau mus rau NodeMCU (chaw nres nkoj xa mus, IP zoo li qub …)

Pom zoo: