Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau
- Kauj Ruam 2: NTP yog Dab Tsi thiab Nws Yuav Ua Haujlwm Li Cas?
- Kauj Ruam 3: Txhim Kho Tsev Qiv Ntawv ntawm Arduino IDE
- Kauj Ruam 4: Coding Tshooj
- Kauj Ruam 5: Tau SIJHAWM
Video: Tau Sijhawm Los Ntawm Internet Siv ESP8266 - NTP Clock Project Nrog ESP8266 Nodemcu: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv qhov kev qhia no peb yuav pom yuav siv sijhawm li cas siv ESP8266/nodemcu nrog Arduino IDE. Tau txais lub sijhawm tshwj xeeb tshaj yog muaj txiaj ntsig hauv cov ntaub ntawv nkag mus rau lub sijhawm cim koj nyeem. Yog tias koj txoj haujlwm ESP8266 tau nkag mus rau Is Taws Nem, koj tuaj yeem tau txais sijhawm siv Network Sijhawm raws tu qauv (NTP) - koj tsis xav tau lwm yam khoom siv ntxiv. Koj tuaj yeem txuas koj li ESP8266 rau koj lub network wifi thiab nws yuav yog lub moos uas yuav ua tiav nrog network, yog li yog tias ib zaug koj tau tshaj tawm cov cai nws yuav tau txais sijhawm los ntawm internet yog li nws ib txwm tso saib lub sijhawm raug.
Kauj Ruam 1: Yam Koj Xav Tau
Txog qhov haujlwm no koj yuav xav tau ob peb yam: ESP8266/NODEMCUA USB cable rau program nws.
Kauj Ruam 2: NTP yog Dab Tsi thiab Nws Yuav Ua Haujlwm Li Cas?
NTP yog dab tsi: NTP sawv cev rau Network Time Protocol. Nws yog tus txheej txheem Internet Txheej Txheem (IP) rau synchronizing lub khoos phis tawj moos mus rau qee qhov siv hla lub network. Cov txheej txheem tuaj yeem siv los ua kom sib txuas txhua yam khoom siv sib txuas mus rau Kev Sib Koom Thoob Ntiaj Teb (UTC). NTP teeb tsa lub moos ntawm cov khoos phis tawj rau UTC, txhua lub sijhawm hauv zos cheeb tsam offset lossis hnub lub sijhawm txuag lub sijhawm offset tau thov los ntawm tus neeg siv khoom. Qhov no cov neeg siv khoom tuaj yeem sib koom ua ke rau cov servers tsis hais txog qhov chaw thiab lub sijhawm sib txawv li cas. Nws yuav ua haujlwm li cas rau peb: Cov neeg siv khoom xws li ESP8266 txuas rau tus neeg siv khoom siv Tus Neeg Siv Datagram raws tu qauv (UDP) ntawm chaw nres nkoj 123. tus neeg siv khoom xa mus thov pob ntawv mus rau NTP server Hauv kev teb rau qhov kev thov no NTP server xa lub sijhawm thim pob ntawv. Ntau lub pob ntawv ntim khoom muaj ntau cov ntaub ntawv xws li UNIX timestamp, qhov tseeb, ncua lossis sijhawm sijhawm.
Kauj Ruam 3: Txhim Kho Tsev Qiv Ntawv ntawm Arduino IDE
Hauv koj Arduino IDE mus rau Libraries tus thawj coj thiab tshawb rau NTP thiab tsuas yog rub NTP cov tsev qiv ntawv raws li kuv rub tawm, xa duab rau kev pab ntxiv.
Kauj Ruam 4: Coding Tshooj
Thov luam cov cai hauv qab no & muab koj daim ntawv pov thawj network nyob hauv koj tus lej ces koj yuav tsum tau teem sijhawm ua haujlwm rau kuv nws yog 19800 Vim tias kuv lub sijhawm siv yog utc+5: 30 yog li UTC +5: 30 = 5.5*60*60 = 19800UTC+1 = 1*60*60 = 3600CALCULATE koj lub sijhawm hauv cheeb tsam thiab kho nws thiab tom qab ntawd upload cov cai.#Suav nrog "NTPClient.h" #include "ESP8266WiFi.h" #include "WiFiUdp.h" const char*ssid = "***** ****** "; const char*password =" *********** "; const ntev utcOffsetInSeconds = 19800; char daysOfTheWeek [7] [12] = {" Hnub Sunday "," Monday ", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; // Txhais NTP Client kom tau sijhawmWiFiUDP ntpUDP; NTPClient timeClient (ntpUDP, "pool.ntp.org", utcOffsetInSeconds); tsis muaj teeb meem () {Serial.begin (115200); WiFi.begin (ssid, password); thaum (WiFi.status ()! = WL_CONNECTED) {ncua (500); Serial.print ("."); } timeClient.begin ();} void loop () {timeClient.update (); Serial.print (daysOfTheWeek [timeClient.getDay ()]); Serial.print (","); Serial.print (timeClient.getHours ()); Serial.print (":"); Serial.print (timeClient.getMinutes ()); Serial.print (":"); Serial.println (timeClient.getSeconds ()); //Serial.println (timeClient.getFormattedTime ()); ncua (1000);}
Kauj Ruam 5: Tau SIJHAWM
Tom qab Kev Tshaj Tawm cov cai rau Esp8266 koj tuaj yeem qhib cov ntawv xov xwm thiab yog tias txhua yam zoo, tom qab ntawd koj yuav tuaj yeem tau txais lub sijhawm ntawm tus saib xyuas raws li kuv muaj peev xwm tau txais lub sijhawm hauv kuv cov ntawv saib. Yog li nrog txoj haujlwm no koj tuaj yeem txuas ib qho tso saib thiab ua kom lub moos network raug. Yog li muaj kev lom zem ua koj lub moos network.
Pom zoo:
ESP8266 OLED - Tau Txais Sijhawm thiab Hnub Los Ntawm Internet: 8 Kauj Ruam
ESP8266 OLED - Tau Txais Sijhawm thiab Hnub Los Ntawm Is Taws Nem: Hauv qhov kev qhia no peb yuav kawm paub yuav ua li cas kom tau txais hnub thiab sijhawm los ntawm NIST TIME server siv ESP8266 OLED thiab Visuino, Saib cov vis dis aus
Visuino - Tau Txais Lub Sijhawm Los Ntawm Internet NIST Server Siv NodeMCU: 8 Kauj Ruam
Visuino - Tau Txais Sijhawm Los Ntawm Internet NIST Server Siv NodeMCU: Hauv qhov kev qhia no peb yuav siv NodeMCU Mini, OLED Lcd, thiab Visuino los tso saib lub sijhawm nyob hauv internet los ntawm NIST Server ntawm Lcd. Saib daim vis dis aus. Cov nyiaj qiv rau kev tshoov siab mus rau tus neeg siv youtube "Ciprian Balalau"
Siv DS1307 thiab DS3231 Lub Sijhawm Teev Sijhawm Sijhawm Nrog Arduino: 3 Kauj Ruam
Siv DS1307 thiab DS3231 Lub Sijhawm Caij Nyoog Sijhawm Nrog Arduino: Peb tseem tau txais kev thov yuav siv DS1307 thiab DS3231 lub sijhawm teev sijhawm nrog Arduino los ntawm ntau qhov chaw-yog li qhov no yog thawj ntawm ob ntu kev qhia yuav siv li cas. Txog qhov kev qhia Arduino no peb muaj ob lub sijhawm teev sijhawm ua haujlwm rau peb
Lub Sijhawm Teem Sijhawm Teem Sijhawm ntawm RaspberryPi-4: 6 Cov Kauj Ruam (nrog Duab)
Lub Sijhawm Teem Sijhawm Teem Sijhawm ntawm RaspberryPi-4: Hauv Cov Lus Qhia no peb yuav ua lub ntsej muag-paub lub sijhawm tiag tiag ntawm Raspberry Pi 4 nrog Shunya O/S siv Shunyaface Library. Koj tuaj yeem ua tiav qhov ntsuas pom ntawm 15-17 ntawm RaspberryPi-4 los ntawm kev ua raws cov lus qhia no
Yuav Ua Li Cas Tau Txais Cov Nkauj Los Ntawm Txhua Qhov (Haha) Lub Vev Xaib (Ntev Li Koj Tau hnov Nws Koj Yuav Tau Txais Nws Ok Zoo Yog Nws Tau Ntxig Hauv Flash Koj Yuav Tsis Muaj Peev Xwm) EDITED !!!!! Ntxiv Info: 4 Cov Kauj Ruam
Yuav Ua Li Cas Tau Txais Cov Nkauj Los Ntawm Txhua Qhov (Haha) Lub Vev Xaib (Ntev Li Koj Tau hnov Nws Koj Yuav Tau Txais Nws … Ok Zoo Yog Nws Tau Ntxig Hauv Flash Koj Yuav Tsis Muaj Peev Xwm) EDITED !!!!! Ntxiv Cov Lus Qhia: yog tias koj tau mus rau lub vev xaib thiab nws ua nkauj nkauj uas koj nyiam thiab xav tau nws ntawm no yog cov lus qhia rau koj tsis yog kuv qhov txhaum yog tias koj cuam tshuam qee yam (tsuas yog txoj hauv kev nws yuav tshwm sim yog tias koj pib tshem cov khoom yam tsis muaj laj thawj. ) Kuv tuaj yeem tau txais cov nkauj rau