Cov txheej txheem:

Tseeb Binary Moos Nrog NTP Sync: 4 Cov Kauj Ruam
Tseeb Binary Moos Nrog NTP Sync: 4 Cov Kauj Ruam

Video: Tseeb Binary Moos Nrog NTP Sync: 4 Cov Kauj Ruam

Video: Tseeb Binary Moos Nrog NTP Sync: 4 Cov Kauj Ruam
Video: Yog hmoov dab tsi - Gao Nou Kue ft. Mang Vang (Official Music Video) New song 2020 2024, Hlis ntuj nqeg
Anonim
Tseeb Binary Moos Nrog NTP Sync
Tseeb Binary Moos Nrog NTP Sync
Tseeb Binary Moos Nrog NTP Sync
Tseeb Binary Moos Nrog NTP Sync

Ib lub moos binary tseeb qhia lub sijhawm ntawm ib hnub raws li qhov sib npaug ntawm binary feem ntawm ib hnub, tsis zoo li ib txwm "binary moos" uas qhia sijhawm raws li binary-encoded decimal digits sib npaug rau teev/feeb/vib nas this. Tsoos "binary moos" yeej siv binary-encoded-decimal-encoded-sexagesimal. Dab tsi tsis meej pem! Qhov tseeb binary moos ua kom yooj yim rau ntau yam.

Hauv lub moos binary tseeb, thawj tus lej qhia koj yog ib nrab hnub, tus lej thib ob yog lub hlis thib peb, tus lej thib peb yog yim ntawm ib hnub, thiab lwm yam. Nws tuaj yeem nyeem rau txhua qhov kev daws teeb meem sai (nrog kev xyaum). Thawj tus lej suav tau zoo suav nrog AM piv rau PM, tus lej thib ob nkag siab tias nws yog ntxov AM/PM lossis lig AM/PM lig, thiab ntxiv rau.

Hauv kev tsim kuv lub sijhawm tiag tiag binary, kuv siv kaum ob tus lej ntawm kev daws teeb meem, yog li hnub tau muab faib ua 2^12 = 4096 ntu (txhua qhov nce yog kwv yees li 20 vib nas this). Tsis txhob khaws txhua tus lej hauv kab, 12 tus lej tau muab cais ua 3 kab ntawm 4 tus lej. Txawm hais tias tus lej binary tiag tiag tsis hloov pauv, qhov no tso cai rau lub moos nyeem raws li 3 tus lej binary-encoded hex tus lej, thawj kab uas qhia txog 16 ntawm ib hnub (1.5hrs), kab thib ob qhia 256ths ntawm ib hnub (~ 5 feeb), thiab kab thib peb qhia 4096ths ntawm ib hnub (~ 20seconds).

Lub moos tau ua tiav rau NTP (Network Time Protocol) siv ESP8266. ESP8266 tau teeb tsa kom yog li, thaum pib, nias lub pob ntawm lub moos yuav xa nws mus rau qhov chaw teeb tsa. Hauv cov chaw teeb tsa, lub moos yuav tsim WiFi network uas ua haujlwm rau lub vev xaib uas tuaj yeem siv nkag mus rau koj tus kheej teeb tsa wifi, NTP server, thiab sijhawm sijhawm. Cov ntaub ntawv no tau khaws cia hauv EEPROM ntawm ESP8266 thiab tau nyeem thaum lub moos pib hauv lub moos hom yog li nws tuaj yeem txuas rau internet thiab khaws lub sijhawm.

Khoom siv:

  • NodeMCU ESP8266
  • WS2812B LED sawb
  • Pushbutton
  • 470 Ohm tus tiv thaiv
  • 10K Ohm resistor
  • 470 uF capacitor
  • Popsicle sticks
  • Marbles
  • Ntoo (lossis lwm daim ntawv ntawm cov khoom) rau rooj plaub

Kauj ruam 1: Circuit Court

Circuit Court
Circuit Court
Circuit Court
Circuit Court
Circuit Court
Circuit Court
Circuit Court
Circuit Court

Txhawm rau kom muaj cov zaub, txoj haujlwm no siv RGB coj kab txaij tso rau hauv 3 kab. Kuv txiav 3 kab ntawm 8 leds los ntawm kab txaij ntawm WS2812B leds thiab muab lawv ua ke. (Lawv tsis yooj yim thiab siv cov pawm me me tuaj yeem nyuaj. Kuv qhwv cov hlua txuas hauv kab xev hluav taws xob txhawm rau txhawm rau tiv thaiv lawv los ntawm kev khoov.) Txawm hais tias kuv tsuas xav tau 4 leds ib kab, Kuv txiav tawm ib daim hlab ntawm 8 kom kuv tuaj yeem muaj qhov sib nrug ntau dua ntawm lub teeb los ntawm kev siv txhua lwm coj. Cov kab no tau raug daig rau hauv lub hauv paus uas ua los ntawm cov popsicle sticks. Hauv nruab nrab ntawm txhua kab, ob txheej txheej ntawm popsicle sticks muab cov ntaub ntawv kom lub ntsej muag pem hauv ntej tuaj yeem tiv thaiv sab hauv ntawm rooj plaub ntawm lub moos (saib duab).

Cov hlua coj tau siv los ntawm VU thiab GND ntawm NodeMCU. VU yog lub zog los (yuav luag) ncaj qha los ntawm USB, yog li nws muab 5V rau WS2812B LEDs txawm hais tias ESP8266 ua haujlwm ntawm 3.3V. Kuv tso 470 uF capacitor hla lub zog rau WS2812B sawb los tiv thaiv cov coj. Cov ntaub ntawv rau cov hlua coj tau txuas nrog D3 tus pin ntawm NodeMCU ntawm 470 Ohm resistor. Xa mus rau cov lus qhia no kom paub ntau ntxiv txog yuav ua li cas tswj WS2812B leds nrog ESP8266. Lub voj voog tau muab muag rau ntawm daim phiaj-nrog qee tus txiv neej-rau-poj niam lub taub hau rau NodeMCU.

Lub laub khawm tseem tau txuas rau D6 ntawm NodeMCU. Lub pob nyem no tuaj yeem nias thaum lub moos tab tom pib xa nws mus rau qhov chaw teeb tsa (hauv qhov chaw teeb tsa wifi, NTP neeg rau zaub mov, thiab lub sijhawm nyiam tuaj yeem hloov kho). Ntawm ib qho kawg lub laub khawm txuas nrog D6 thiab tseem rau GND ntawm 10K Ohm resistor thiab ntawm qhov kawg nws txuas nrog lub zog. Thaum lub pob tsis muaj zog, D6 nyeem qis; thaum nws nias, D6 nyeem siab.

Kauj ruam 2: Software

Software
Software

Lub software rau ESP8266 tau sau siv Arduino code. Cov LEDs tau ua haujlwm siv lub tsev qiv ntawv FastLED thiab NTP sib txuas ua tiav los ntawm NTPClient lub tsev qiv ntawv. Lub sijhawm sib txuas los ntawm NTP txhua teev.

Thaum pib ua haujlwm teeb tsa, qhov kev zov me nyuam tshuaj xyuas seb lub pob txuas nrog D6 raug nias. Yog tias nws yog, ESP8266 tsim lub network wifi (SSID thiab password tuaj yeem hloov pauv hauv tus lej, lub hauv paus SSID yog "TrueBinary" thiab tus password yog "thepoweroftwo"). Txuas rau lub network no los ntawm ib lub cuab yeej twg thiab mus rau 192.168.1.1. ESP8266 yuav ua haujlwm rau lub vev xaib nrog cov ntawv uas koj tuaj yeem nkag mus rau koj tus lej wifi SSID thiab tus password, nyiam NTP server, thiab lub sijhawm nyob ntawm UTC. Tom qab cov ntawv no xa mus rau ESP8266, nws yuav khaws cov ntaub ntawv mus rau nws sab hauv EEPROM cia.

Yog tias lub pob tsis raug nias, lub moos pib ua haujlwm ib txwm, nyeem cov teeb tsa los ntawm EEPROM, txuas rau wifi siv NTP, thiab pib tso saib lub sijhawm.

NCO TSEG: kev ua haujlwm setDisplay (int index) siv tus lej tus lej los ntawm 0-11 qhov 0 yog thawj tus lej (ib nrab hnub) thiab 11 yog qhov kawg (1/4096 ntawm ib hnub) thiab tig rau qhov sib txuas LED siv " leds "array. Txoj haujlwm no yuav tsum tau ua kom tiav raws li qhov koj teeb tsa cov zaub. Kuv tau hais tawm qhov piv txwv sib xws li cas kuv tau muab cov kab ua zig-zag zam ntau dua li qhov kawg-rau-kawg thiab hla txhua lwm qhov LED.

Kauj Ruam 3: Vaj Tsev

Vaj tse
Vaj tse
Vaj tse
Vaj tse
Vaj tse
Vaj tse

Los tsev lub moos, Kuv siv lub kaum xim ntoo uas kuv tau tshwm sim muaj. Ntawm ib lub ntsej muag sab nrauv, Kuv tau hlais 12 qhov hauv kab sib chaws sib luag rau txoj haujlwm ntawm LEDs. Tom qab ntawd kuv tau teeb lub LEDs rau sab hauv ntawm lub kaum sab xis los ntawm gluing lub ntsej muag tsa ntawm cov popsicle sticks hauv-nruab nrab kab mus rau ntoo (raws li qhia). Txhawm rau nthuav lub teeb los ntawm LEDs, Kuv daig iav pob zeb saum toj ntawm lub qhov. Kuv ua tiav qhov no los ntawm kev nqes hauv qab ib nrab ntawm txhua pob zeb hauv epoxy cob thiab tom qab ntawd muab lawv tso rau hauv qhov. NodeMCU thiab pawg thawj coj tau raug ntsia mus rau lwm sab hauv lub ntsej muag ntawm lub kaum ntse ntse. Ob sab tau npog siv cov voos me me ntawm cov ntoo, txuas nrog cov kua nplaum ntoo. Ib ntawm ob sab muaj lub qhov rau micro USB chaw nres nkoj ntawm NodeMCU thiab txiav hauv lub ces kaum rau lub laub khawm.

Kauj ruam 4: Ua tiav

Ua tiav!
Ua tiav!
Ua tiav!
Ua tiav!

Peb qhov tseeb binary moos tau ua tiav! Txhawm rau teeb tsa nws, khaws lub pob nyem thaum ntsaws nws rau hauv nws kom teeb tsa hom thiab tom qab ntawd nkag mus rau WiFi daim ntawv pov thawj ntawm nws lub vev xaib. Thaum teeb tsa, lub moos tuaj yeem txuas rau txhua qhov chaw thiab yuav cia li txuas rau hauv is taws nem thiab pib tso saib lub sijhawm hauv binary.

Nws siv sijhawm ntawm kev xyaum los nyeem lub sijhawm hauv hom binary tseeb, tab sis nws yog kev tawm dag zog lom zem thiab tom qab ib pliag nws dhau los ua txoj hauv kev nrawm kom tau txais lub sijhawm nrog tsuas yog saib ib muag!

Pom zoo: