Cov txheej txheem:

Hnub, Sijhawm & Kub Zaub Siv XinaBox: 8 Kauj Ruam
Hnub, Sijhawm & Kub Zaub Siv XinaBox: 8 Kauj Ruam

Video: Hnub, Sijhawm & Kub Zaub Siv XinaBox: 8 Kauj Ruam

Video: Hnub, Sijhawm & Kub Zaub Siv XinaBox: 8 Kauj Ruam
Video: tuav wb lub neej kom ruaj khov - Mang Vang ft. Christina Xyooj [Official Audio] 2021-22 2024, Kaum ib hlis
Anonim
Hnub, Sijhawm & Kub Zaub Siv XinaBox
Hnub, Sijhawm & Kub Zaub Siv XinaBox

Txias OLED zaub qhia hnub, sijhawm thiab ntsuas kub hauv Celsius thiab Fahrenheit siv Xinabox xChips raws li ESP8266.

Kauj Ruam 1: Yam Khoom Siv Hauv Txoj Haujlwm no

Cov khoom siv kho vajtse

  • XinaBox IP01 x 1 xChip USB Programmer raws FT232R Los ntawm FTDI Txwv
  • XinaBox CW01 x 1 xChip Wi-Fi Core raws li ESP8266 Wi-Fi Module
  • XinaBox SW01 x 1 xChip Kub, av noo thiab huab cua siab ntsuas raws BME280 los ntawm Bosch.
  • XinaBox OD01 x 1 xChip 128x64 Pixel OLED Display
  • XinaBox PU01 x 1 xChip USB (Hom A) Cov Khoom Siv Hluav Taws Xob
  • XinaBox XC10 x 1 xChip Tsheb Txuas
  • 5V USB Fais Fab Khoom x 1

Software apps thiab cov kev pabcuam online

Arduino IDE Cov

Kauj ruam 2: Zaj dab neeg

Taw qhia

Kuv ua qhov haujlwm no los tso saib hnub tim, UCT lub sijhawm thiab ntsuas kub siv XinaBox xChips uas siv I2C npav raws tu qauv. Lub sijhawm tau rov qab los ntawm google NTP server. Qhov ntsuas kub ib puag ncig tau ntsuas siv SW01 xChip thiab tau tshwm ntawm OD01 xChip OLED zaub hauv Celsius thiab Fahrenheit. Cov duab hauv qab no qhia pom OLED.

Duab
Duab

OLED tso tawm hnub, sijhawm thiab ntsuas kub

Kauj Ruam 3: Rub Cov Ntaub Ntawv Tsim Nyog

Koj yuav xav tau cov tsev qiv ntawv hauv qab no thiab software rau txoj haujlwm no.

  • Arduino IDE - Kev Txhim Kho Software uas koj yuav ua tus lej
  • xSW01 - Lub tsev qiv ntawv ntsuas kub
  • xCore - Lub tsev qiv ntawv tseem ceeb rau XinaBox xChips
  • xOD01 - OLED Display lub tsev qiv ntawv.
  • Timezone - Lub tsev qiv ntawv los xaiv koj lub sijhawm
  • Sijhawm - Txhawm rau siv sijhawm ua haujlwm
  • NTPClient - Pab kom koj tau txais sijhawm los ntawm server
  • Koj kuj tseem yuav tsum rub lub ESP8266 lub rooj tsavxwm thiab ua raws cov lus qhia uas txuas nrog nws txhawm rau txhawm rau teeb tsa lub rooj tsavxwm

Thaum rub tawm koj yuav nruab IDE thiab cov tsev qiv ntawv. Nws ncaj ncaj rau pem hauv ntej yog tias koj ua raws cov lus qhia.

Kauj ruam 4: Sib sau ua ke

Koj lub xChip tseem ceeb uas yuav ua thiab ua cov haujlwm yog CW01. Nws yog raws li ESP8266 WiFi Module thiab siv I2C cov txheej txheem tsheb npav. Txhawm rau ua haujlwm rau CW01, koj yuav xav tau lub program xChip. IP01 tso cai rau peb ua haujlwm CW01 ntawm USB chaw nres nkoj ntawm peb lub khoos phis tawj yooj yim los ntawm kev nyem ua ke ob lub xChips siv XC10 tsheb npav txuas thiab tso nws rau hauv USB chaw nres nkoj. Tsis muaj xov hlau thiab tsis muaj qhov yuav tsum tau siv. Ib yam uas yuav tsum nco ntsoov yog kev taw qhia ntawm xChip cov npe cim npe. Lawv txhua tus yuav tsum tau taw qhia rau tib txoj kev. Tam sim no koj yuav tsum muaj teeb tsa hauv qab no.

Duab
Duab

Nyem ua ke CW01 thiab IP01 thiab ntxig nws rau hauv USB chaw nres nkoj ntawm koj lub computer

Yog tias koj paub nrog xChips koj tuaj yeem txuas txhua xChip ua ke siv XC10 tsheb npav txuas uas koj xav siv rau koj txoj haujlwm thiab tom qab ntawd ntxig nws rau hauv USB chaw nres nkoj. Peb yuav siv SW01 ntsuas kub thiab OD01 OLED zaub.

Duab
Duab

Koj tuaj yeem txuas tag nrho koj cov chips ua ke thiab tom qab ntawd ntxig nws rau hauv koj lub USB chaw nres nkoj

Kauj Ruam 5: Txoj Haujlwm

Rub tawm lossis luam thiab muab cov cai hauv qab no tso rau hauv koj li Arduino IDE. Yog tias koj tsis hloov pauv cov cai yooj yim nkag koj li WiFi cov ntsiab lus hauv lawv cov haujlwm raws li qhia hauv qab no. Kuj nkag mus rau NTP lub sijhawm server ntseeg tau. Kuv tau siv Google lub sijhawm server rau txoj haujlwm no.

Duab
Duab

Cov ntsiab lus WiFi thiab NTP lub sijhawm server

Tam sim no sau thiab upload. Nco ntsoov tias koj tau xaiv qhov tseeb COM chaw nres nkoj thiab pawg thawj coj hauv qab cov cuab yeej ntawv qhia zaub mov hauv Arduino IDE. Ib zaug rub tawm, lub sijhawm, hnub tim thiab qhov kub thiab txias yuav tsum qhia raws li hauv qab no.

Duab
Duab

Tom qab upload koj yuav tsum pom cov hauv qab no

Kauj Ruam 6: Ua Nws Portable

Tam sim no koj tuaj yeem tshem chav nyob ntawm koj lub USB chaw nres nkoj thiab cais txhua xChip los ntawm kev rub nws sib nrug. Txij li cov phiaj xwm ua tiav, IP01 tsis xav tau ntxiv lawm. Tam sim no koj tuaj yeem txuas koj txoj haujlwm hauv txhua yam uas koj xav tau tsuav yog cov npe cim npe tau qhia txhua yam hauv tib txoj kev. Txhawm rau txhawb peb chav peb yuav siv PU01. Qhov no tso cai rau peb siv nws los ntawm lub txhab nyiaj ib txwm muaj lossis ib qho 5V USB fais fab mov. Kuv tau txuas nrog kuv li qhia hauv qab no.

Duab
Duab

Sib dhos zaum kawg. xChips tuaj yeem txuas nrog txhua txoj hauv kev uas koj xav tau.

Kauj Ruam 7: Xaus

Txoj haujlwm no yuav siv 20 feeb los ua kom tiav. Yog tias koj xav tau sijhawm nyob hauv koj qhov chaw nyob, txiav txim siab saib tus lej piv txwv hauv lub tsev qiv ntawv Timezone lossis ua qee qhov lej nrog UTC lub sijhawm. Tsis tau siv cov xov hlau thiab tsis tas yuav tsum tau siv cov laug.

Kauj ruam 8: Code

Date_Time_Temp.ino Arduino Cias sau koj li WiFi cov ntsiab lus hauv lawv cov haujlwm thiab muab xa mus rau koj lub rooj tsavxwm.

#suav nrog // suav nrog cov tsev qiv ntawv tseem ceeb rau XinaBox xCHIPS

#suav nrog // suav nrog OLED cov tsev qiv ntawv #suav nrog // suav nrog lub tsev qiv ntawv ntsuas kub #suav nrog // suav nrog ESP8266WiFi ua haujlwm #suav nrog // suav nrog lub sijhawm qiv ntawv #include #include #include #include #include xSW01 SW01; // txhais NTP cov khoom #define ntpOffset 60 * 60 // hauv vib nas this #define ntpInterval 60 * 1000 // nyob rau hauv miliseconds // ntxig rau ntseeg ntp lub sijhawm server nruab nrab ntawm ob nqe lus hais // ntawm no kuv tau siv google ntp server sijhawm # txhais ntpAddress "time1.google.com" // teeb tsa NTP UDP tus neeg siv WiFiUDP ntpUDP; NTPClient timeClient (ntpUDP, ntpAddress, ntpOffset, ntpInterval); // qhov kub thiab txias sib txawv ntab tempC; // C Celsius ntab tempF; // fahrenheit // your wifi details const char* wifi_ssid = "XinaBox"; // koj lub wifi ssid const char* wifi_pass = "RapidIoT"; // koj tus password wifi // hnub tim thiab sijhawm sib txawv Hnub txoj hlua; Txoj hlua clktime; // variables muaj hnub thiab hli const char * days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; const char * months = {"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov" "," Dec "}; const char * ampm = {"AM", "PM"}; teeb tsa tsis muaj dab tsi () {tempC = tempF = 0; // pib ntsuas kub kom xoom timeClient.begin (); // pib NTP UDP tus neeg siv // pib kev sib txuas lus txuas Serial.begin (115200); // pib i2c kev sib txuas lus thiab teeb pins Wire.begin (2, 14); // pib ntsuas kub SW01.begin (); // pib OLED zaub OLED.begin (); // meej OLED zaub OD01.clear (); // tsim wifi txuas wifi_connect (); ncua (1000); } void loop () {// khiav yog wifi txuas tau tsim yog (WiFi.status () == WL_CONNECTED) {SW01.poll (); // nyeem ntsuas kub tempC = SW01.getTempC (); // khaws cov khoom kub hauv celcius tempF = SW01.getTempF (); // khaws lub sijhawm hauv hnub fahrenheit = ""; // clear date variable clktime = ""; // meej lub sijhawm sib txawv // hloov kho ntp tus thov thiab tau txais unix utc timestamp timeClient.update (); unsigned ntev epochTime = timeClient.getEpochTime (); // hloov pauv tau txais lub sijhawm thwj rau lub sij hawm_t yam khoom time_t utc; utc = lub sijhawm; // utc time TimeChangeRule utcRule = {"UTC", Xeem, Hnub, Mar, 1, 0}; Timezone UTC (utcRule, utcRule); // format time variables date += days [weekday (utc) - 1]; hnub += ","; hnub += hli [hli (utc) - 1]; hnub tim += ""; hnub += hnub (utc); hnub += ","; hnub += xyoo (utc); // format lub sij hawm rau 12-teev hom nrog AM/PM thiab tsis muaj vib nas this clktime += hourFormat12 (utc); clktime += ":"; yog (feeb (utc)

Pom zoo: