Cov txheej txheem:

ESP8266 Automation Nrog Web Interface thiab DDNS: 8 Cov Kauj Ruam
ESP8266 Automation Nrog Web Interface thiab DDNS: 8 Cov Kauj Ruam

Video: ESP8266 Automation Nrog Web Interface thiab DDNS: 8 Cov Kauj Ruam

Video: ESP8266 Automation Nrog Web Interface thiab DDNS: 8 Cov Kauj Ruam
Video: Improved Cleaning Quality and Efficiency with Disruptive Technologies & Datec 2024, Hlis ntuj nqeg
Anonim
Image
Image
WiFi ESP8266 NodeMcu ESP-12E
WiFi ESP8266 NodeMcu ESP-12E

Hauv tsab xov xwm niaj hnub no, peb yuav qhia txog kev siv lub tshuab, uas tuaj yeem yog chaw nyob, siv DDNS (Dynamic Domain Name System) feature. Koj yuav nkag siab yuav teeb tsa daim ntawv thov uas koj yuav tso rau ESP8266, ntawm NodeMCU. Tsis tas li, peb yuav pom yuav teeb tsa DDNS li cas los tswj cov cuab yeej ntawm koj lub tsev los ntawm koj lub xov tooj.

Yeej, cov phiaj xwm ua haujlwm raws li hauv qab no: koj lub xov tooj smartphone yuav xa cov ntaub ntawv mus rau huab nrog DDNS cov kev pabcuam, uas yuav nkag mus rau koj li ESP8266 nyob hauv koj lub tsev.

Hauv qhov no, qhov chaws tau loj thiab siv ESP cov haujlwm los ua haujlwm ua tus vev xaib nws tus kheej. Vim li cas nws thiaj li muaj txiaj ntsig? Zoo, koj tsis tas yuav teeb tsa ib daim ntawv thov ntawm koj lub smartphone. Nws ua haujlwm zoo kawg nkaus ntawm iOS, khoos phis tawj, Android, lossis yuav luag txhua yam uas muaj qhov browser.

Kauj Ruam 1: WiFi ESP8266 NodeMcu ESP-12E

Kauj ruam 2: DDNS

DDNS
DDNS
DDNS
DDNS
DDNS
DDNS

Ua ntej, nws yog qhov tsim nyog los tsim tus as khauj ntawm NO-IP lub vev xaib, https://www.noip.com/. Nov yog qhov kev pabcuam uas peb yuav siv. Tom qab teeb tsa tus ID nkag mus thiab tus password, nkag mus rau hauv koj tus lej nyiaj thiab teeb tsa "hostname" thiab "Domain." Sau hom thiab tawm nws raws li yog (A). Tom qab populating, nyem rau ntawm "Ntxiv hostname." Tom qab ntawd mus rau qhov teeb tsa tus account los txhaj rau "Account." Hauv qhov no, peb siv "automacaoesp.ddns.net."

Tom qab ntawd, teeb tsa "USERNAME" thiab txuag qhov chaw.

Tam sim no mus rau lub router thiab nyem "Dynamic DNS". Sau rau hauv cov teb nrog lub npe siv uas koj tau hais hauv kev teeb tsa tus as khauj, tus password, thiab Lub Npe Lub Npe, uas qhov no yog "automacaoesp.ddns.net". Pab kom "Enable DDNS" xaiv thiab nyem tseg. Tam sim no, nws yuav muab cov lus "Ua tiav!" yog nws ua haujlwm.

Rov qab mus rau NO-IP nplooj ntawv, nyem rau ntawm "Hostnames" sab ntawv qhia zaub mov, thiab tshawb xyuas yog tias koj lub router sau npe tau tshwm sim, raws li qhia hauv qab no. Tus IP sab nraud ntawm koj lub router yuav tsum tshwm sim.

Kauj ruam kawg yog txhawm rau hloov chaw nres nkoj router mus rau lub cuab yeej network sab hauv. Peb txhais tus IP ntawm ESP (192.168.1.111), yog li peb yuav nkag mus rau "Xa mus" -> "Virtual Servers" tshuaj ntsuam ntawm lub router thiab nyem rau "Ntxiv tshiab".

Sau rau hauv qhov chaw nres nkoj uas yuav hloov pauv thiab tus IP ntawm lub cuab yeej network sab hauv, thiab tom qab ntawv txheej txheem yuav qhia "TXHUA" (tshwj tsis yog koj ua haujlwm nrog tsuas yog ib qho tshwj xeeb) thiab khaws Cov xwm txheej li "Enabled" kom nquag.

Kauj Ruam 3: Daim duab

Daim duab
Daim duab

Thaum qhov no ua tiav, nws yuav ua haujlwm. Tsis hais tus IP chaw nyob sab nraud, thaum koj nkag mus rau "automacaoesp.ddns.net" ntawm qhov chaw nres nkoj 80, koj yuav poob ntawm qhov chaw nres nkoj 80 ntawm cov cuab yeej siv sab hauv, uas muaj IP ntawm 192.168.1.111.

Nco ntsoov khaws qhov chaw nyob ruaj khov.

Kauj Ruam 4: Hloov kho hauv Automacao.ino Cov Ntaub Ntawv

Kev hloov kho hauv Automacao.ino Cov Ntaub Ntawv
Kev hloov kho hauv Automacao.ino Cov Ntaub Ntawv

Ua cov teeb tsa hauv qab no hloov pauv rau koj lub network teeb tsa thiab nkag mus rau tus lej GPIO siab tshaj plaws ntawm koj + 1 daim npav ntawm MAX_PIN_COUNT.

// Mude para os dados da sua rede #define SSID "TesteESP" #define SENHA "87654321" #define IP "192.168.1.111" #define GATEWAY "192.168.1.1" #define SUBNET "255.255.255.0" // Quantidade máxima de pinos, lembrando que os gpios // geralmente começam em 0. // Se o gpio máximo for 16, por exemplo, coloque 17 #define MAX_PIN_COUNT 17

Hauv cov ntawv automacao.html, hloov kab 117 qhov URL uas koj tau sau npe hauv lub vev xaib ntawm ddns no-ip.

Kauj ruam 5: Plugin Sau Cov Ntaub Ntawv

Koj yuav tsum suav nrog lub plugin hauv Arduino IDE los sau cov ntawv rau esp8266 flash. Rub tawm lub plugin ntawm no. Unzip cov ntawv, thiab yog tias nws nyob hauv Windows, muab cov ntawv.jar tso rau hauv:

C: / Cov neeg siv Cov Ntaub Ntawv Arduino cov cuab yeej ESP8266FS / cuab yeej / esp8266fs.jar

Yog tias siv Mac, muab cov ntawv.jar tso rau hauv:

~ / Cov ntaub ntawv / Arduino / cov cuab yeej / ESP8266FS / cov cuab yeej / esp8266fs.jar

Rov pib dua Arduino IDE. Tam sim no qhov kev xaiv tshiab yuav tshwm sim hauv Cov Cuab Yeej. Qhov kev xaiv no, hu ua "ESP8266 Sketch Data Upload" yuav sau cov ntsiab lus ntawm "cov ntaub ntawv" nplaub tshev hauv ESP8266 nyem.

Daim ntawv "hnub" yuav tsum nyob hauv daim nplaub tshev ntawm cov ntaub ntawv.ino tam sim no.

Yog tias koj xav khaws cov ntaub ntawv html, piv txwv li:

~ / Automation / Automation

~ / Automation / data / automation.html

Kauj Ruam 6: Txuag Cov Ntaub Ntawv Html

Txuag Html Cov Ntaub Ntawv
Txuag Html Cov Ntaub Ntawv

Nyem qhov kev xaiv no xa cov ntawv automacao.html uas nyob hauv "cov ntaub ntawv" nplaub tshev mus rau ESP file system

Kauj Ruam 7: Xeem

Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem

1. Tseem nyob hauv Arduino IDE, nyem qhov xub kom sau thiab xa cov cai rau ESP. Tam sim no mus rau qhov browser thiab ntaus qhov URL hauv kab ntawv chaw nyob uas koj tau sau npe ntawm tus tsis-ip site. Qhov tshwm sim yuav tsum yog ntawm daim duab.

2. Nyem "Tus lej Tus lej" thiab xaiv tus lej tus lej los ntawm cov npe uas tshwm.

3. Sau lub npe khawm uas yuav phim tus pin uas tau xaiv thiab nyem "+".

4. Ib lub pob nrog lub npe xaiv yuav tshwm nyob rau hauv cov npe.

5. Thaum koj nyem lub pob, nws yuav tig xiav thiab tus pin nrog tus lej koj tau xaiv yuav yog HIGH.

6. Yog koj xav kom tus pin rov qab mus rau LOW, tsuas yog nyem lub pob dua. Txhawm rau tshem lub pob nyem "-"

Kauj ruam 8: Rub tawm Cov Ntaub Ntawv

Rub tawm cov ntawv:

INO

PDF

Pom zoo: