Cov txheej txheem:
- Kauj Ruam 1: Yam Khoom Siv Hauv Txoj Haujlwm no
- Kauj ruam 2: Zaj dab neeg
- Kauj ruam 3: Kev npaj
- Kauj ruam 4: Kev teeb tsa
- Kauj ruam 5: Txhim kho
- Kauj ruam 6: Programming
- Kauj Ruam 7: Xeem
- Kauj Ruam 8: Kauj Ruam Tom ntej
- Kauj Ruam 9: Schematics
- Kauj ruam 10: Code
Video: Khawm Qhov Rooj Virtual Siv Mongoose OS thiab XinaBox: 10 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Siv Mongoose thiab qee qhov xChips, peb tau ua lub pob qhov rooj virtual. Hloov chaw ntawm lub cev khawm kom nrov cov neeg ua haujlwm hauv, tam sim no lawv tuaj yeem ua lawv tus kheej.
Kauj Ruam 1: Yam Khoom Siv Hauv Txoj Haujlwm no
Cov khoom siv kho vajtse
- XinaBox CW02 x 1 Koj tuaj yeem siv CW01 hloov chaw
- XinaBox IP01 x 1
- XinaBox PU01 x 1 Koj tsuas tuaj yeem siv IP01 rau lub zog, yog tias koj tsis npaj siab yuav tsim cov qauv ntau dua.
- XinaBox OC03 x 1
- XinaBox XC10 x 1 Qhov "kua nplaum" uas ua rau nws ua haujlwm tag nrho!
Software apps thiab cov kev pabcuam online
Mongoose OS Yeej txaus thiab yooj yim IoT cov cuab yeej txhim khoโฆ thiab pub dawb
Kauj ruam 2: Zaj dab neeg
Hauv peb qhov kev txais tos peb cov neeg ua haujlwm yuav tsum tau nrov nrov, yog li peb txiav txim siab noj peb tus kheej cov tshuaj thiab tsim lub pob virtual. Qhov chaws no tso cai rau koj xa RPC (Cov Txheej Txheem Hu Xov Tooj Nyob deb), uas zoo li ib txwm siv HTTP hu los ntawm txhua lub browser. Peb siv Mongoose, vim nws yooj yim heev thiab nrawm rau ua haujlwm nrog thiab nws tau tsim-hauv OTA (Tshaj Tawm Huab Cua) hloov kho cov cai, txhais tau tias peb tuaj yeem teeb tsa peb cov thev naus laus zis thiab tseem dhau sijhawm hloov kho lub firmware, yam tsis tawg nws rau kev rov ua dua tshiab.
Kauj ruam 3: Kev npaj
- Nruab Mongoose-OS: Ncaj nraim rau tom ntej, tsuas yog ua raws cov kauj ruam yooj yim no rau koj OS ntawm no:
- Nyem IP01 thiab CW02 ua ke siv XC10 txuas. Saib duab hauv qab no:
- Ntxig tus IP01 rau hauv koj lub USB chaw nres nkoj
- Nco ntsoov tias IP01 hloov pauv nyob hauv txoj haujlwm B thiab DCE.
- Nyem Mongoose-OS rau CW02 los ntawm koj kab hais kom ua. Zoo li no:
ua cd
export MOS_PORT = bin/mos flash esp32
Koj tuaj yeem tsuas yog nkag mus rau lub console thiab ua feem ntau los ntawm qhov ntawd, tab sis ntawm no peb ua los ntawm kab hais kom ua, yog li txoj haujlwm tau ua tiav sai. Txhawm rau nkag mus rau console:
ua cd
bin/mos
Kauj ruam 4: Kev teeb tsa
Thaum cov theem no tuaj yeem ua tiav hauv ib nqe lus ntev, peb tau txiav txim siab faib lawv, thiab txij li koj yuav theej thiab muab tshuaj txhuam rau lawv ib qho twg, cia ua kom yooj yim:
Teeb I2C tus pin rau tus qauv xChips:
bin/mos config-set i2c.scl_gpio = 14 i2c.sda_gpio = 2
Txuas koj CW02 rau koj li WiFi:
bin/mos wifi
Tshem tawm WiFi hauv AP hom thiab teeb lub npe sau npe, yog li koj tuaj yeem txuas rau CW01 los ntawm lub npe hostname tsis txhob nrhiav qhov chaw nyob IP raug. Qhov no yuav ua haujlwm tsuas yog:
- Koj tsis txuas WiFi hauv AP hom li peb ua hauv qab no.
- Xwb siv Mac lossis nruab Bonjour ntawm koj lub tshuab Windows.
bin/mos hu rau Config. Set '{"config": {"wifi": {"ap": {"pab": tsis tseeb}}}}
bin/mos hu rau Config. Set '{"config": {"dns_sd": {"enable": true}}}' bin/mos hu Config. Set '{"config": {"dns_sd": {"host- lub npe ":" xinabox_switch "}}}
Thiab thaum kawg koj yuav tsum rov pib dua CW02 txhawm rau txhawm rau teeb tsa ua haujlwm
bin/mos hu rau Config. Save '{"reboot": tseeb}'
Sai sai tom qab qhov no koj yuav tsum tuaj yeem ping xinabox_switch.local
Kauj ruam 5: Txhim kho
Tshem lub IP01 ntawm koj lub khoos phis tawj thiab sib sau ua ke raws li cov duab saum toj kawg nkaus.
Txuas lub PU01 (lossis yog tias koj txiav txim siab lo nrog IP01) rau hauv USB lub zog siv. Txuas cov xov hluav taws xob sib txuas los ntawm koj qhov kev hloov pauv tam sim no (tawm qhov ntawd, tsuas yog hauv rooj plaub) mus rau OC03 (qhov tsis sib xws tsis muaj teeb meem). Saib Fritzing daim duab.
Thaum muaj zog thiab pom tias koj tab tom tham nrog koj tus xCW02, ua li cas txog kev txheeb xyuas lub npav, aka lub tsheb npav I2C:
bin/mos --port ws: //xinabox_switch.local/rpc hu I2C. Scan
Yog tias txhua yam ua haujlwm thiab koj xOC03 tau teeb tsa raug, koj yuav tsum pom tus lej '56' raug xa rov qab. Ntawd yog I2C chaw nyob ntawm OC03 hauv zauv (hauv hex nws yog 0x38).
Kauj ruam 6: Programming
- Tam sim no qhib Mongoose hauv hom console, saib saum toj no. Nws yuav tsum qhib nrog Qhov rai uas nws nug tus lej chaw nres nkoj, nkag mus: ws: //xinabox_switch.local/rpc
- Nws yuav sib txuas lus nrog CW02, thiab paub tias chav tsev twb tau taws thiab txuas nrog WiFi, yog li nws tsuas yog muab 3 qhov cim tseg. Kaw lub qhov rais thiab rov ua dua daim ntawv teev npe
- Luam thiab paste cov cai hauv qab no rau hauv init.js, thiab nyem rau ntawm save+reboot
- Tam sim no koj teeb tsa lub program.
Kauj Ruam 7: Xeem
Tam sim no koj tau siv lwm qhov RPC hu los ntawm koj lub davhlau ya nyob twg koj tuaj yeem nkag mus:
bin/mos --port ws: //xinabox_switch.local/rpc hu Hloov
โฆ thiab koj lub suab nrov yuav tsum mus li 2 vib nas this. Koj kuj tseem tuaj yeem ua nws los ntawm - yuav luag - txhua lub browser:
xinabox_switch.local/rpc/Switch
โฆ nrog tib yam.
Kauj Ruam 8: Kauj Ruam Tom ntej
Koj tuaj yeem siv cov cuab yeej uas tuaj yeem tua tawm URL. Kuv ua nws los ntawm Apple App hu ua Workflow, uas tso cai rau kuv ua los ntawm kuv lub xov tooj lossis raws li qhov nyuaj los ntawm kuv Apple Watch, tab sis muaj ntau txoj hauv kev xaiv tawm muaj. Nov yog kuv tsab ntawv Workflow, tab sis nrog hardcoded IP chaw nyob: Txaus siab rau!
Apple App: Workflow - ntawm no nrog tus lej IP nyuaj
Kauj Ruam 9: Schematics
Buzzer Circuit Txhim kho OC03 ua ke nrog lub laub uas twb muaj lawm.
Download tau nws ntawm no.
OC03 Circuit Court Txhim kho OC03 ua ke nrog lub laub uas twb muaj lawm.
Download tau nws ntawm no.
Kauj ruam 10: Code
init.js JavaScript Koj lub ntsiab thiab tsuas yog tus lej rau txoj haujlwm no.
thauj khoom ('api_config.js');
thauj khoom ('api_gpio.js'); thauj khoom ('api_i2c.js'); thauj khoom ('api_net.js'); thauj khoom ('api_sys.js'); thauj khoom ('api_timer.js'); thauj khoom ("api_rpc.js"); cia coj = Cfg.get ('pins.led'); cia adr = 0x38; cia npav = I2C.get (); I2C.writeRegB (tsheb npav, adr, 3, 0); I2C.writeRegB (tsheb npav, adr, 1, 0); / * tua tsuas yog kom paub tseeb */ cia ncua = 2000; GPIO.set_mode (coj, GPIO. MODE_OUTPUT); RPC.addHandler ('Hloov', ua haujlwm (sib cav) {GPIO.toggle (coj); I2C.writeRegB (tsheb npav, adr, 3, 0); / * nyob rau hauv rooj plaub OC03 tau rov txuas dua * / I2C.writeRegB (tsheb npav, adr, 1, 1); Timer.set (ncua, tsis tseeb, muaj nuj nqi () {GPIO.toggle (coj); I2C.writeRegB (tsheb npav, adr, 1, 0);}, tsis muaj); rov muaj tseeb;});
Pom zoo:
DIY Ntse Qhov Rooj Qhov Rooj Qhov Rooj + Tsev Pabcuam Hauv Tsev: 5 Kauj Ruam
DIY Ntse Lub Qhov Rooj Qhov Rooj + Lub Tsev Pabcuam Kev Sib Koom: Tig koj lub qhov rooj qhov rooj ib txwm ntse siv qhov haujlwm DIY no. Kuv yuav qhia koj yuav tsim nws li cas thiab tswj nws siv Tsev Pabcuam (dhau MQTT) thiab muaj peev xwm qhib thiab kaw koj lub qhov rooj ntawm qhov chaw deb.Kuv yuav siv ESP8266 pawg thawj coj hu ua Wemos
Tig Koj Lub Qhov Rooj Qhov Rooj Mus Rau Hauv Qhov Rooj Ntse Nrog Nrog IFTTT: 8 Kauj Ruam
Tig Koj Lub Qhov Rooj Qhov Rooj Mus Rau Hauv Lub Ntsej Muag Qhov Rooj Nrog IFTTT: Lub WiFi Qhov Rooj Tswb tig koj lub qhov rooj uas twb muaj lawm mus rau hauv lub qhov rooj ntse. https://www.fireflyelectronix.com/product/wifidoor
Tig Koj Lub Qhov Rooj Hauv Qhov Rooj Mus Rau Hauv Qhov Rooj Ntse Nrog Lub Tsev Pabcuam: 6 Kauj Ruam
Tig Koj Lub Qhov Rooj Qhov Rooj Mus Rau Hauv Qhov Rooj Ntse Nrog Tus Pab Hauv Tsev: Hloov koj lub qhov rooj uas twb muaj lawm mus rau hauv lub qhov rooj ntse. Tau txais kev ceeb toom rau koj lub xov tooj lossis ua ke nrog koj lub koob yees duab lub qhov rooj uas twb muaj lawm kom tau txais daim duab lossis video ceeb toom txhua lub sijhawm ib tus neeg hu koj lub tswb
Tsis Siv Neeg Teeb Txuas nrog Qhov Rooj thiab Qhov Rooj Saib Xyuas: 5 Kauj Ruam
Tsis Siv Neeg Teeb Txuas nrog Lub Qhov Rooj thiab Qhov Rooj Saib Xyuas: Nws zoo li nyuaj rau nrhiav lub rooj hloov pauv hauv qhov tsaus ntuj tab sis txoj haujlwm no yeej pab tau daws qhov teeb meem no. Ua raws cov theem hauv qab no kom paub qhov kev daws teeb meem ntawm qhov no
Rooj Bluetooth Hais Lus Nrog Pom Pom Lub Suab, Khawm Khawm thiab NFC.: 24 Kauj Ruam (nrog Duab)
Rooj Bluetooth Hais Lus Nrog Pom Pom Suab, Khawm Khawm thiab NFC.: Nyob zoo! Hauv Cov Lus Qhia no Kuv yuav qhia yuav ua li cas kuv thiaj ua Lub Rooj Sib Tham Bluetooth hais lus no uas muaj Lub Suab Pom Zoo Zoo nrog kov cov nyees khawm thiab NFC. Ua tau yooj yim ua ke nrog NFC Enabled cov cuab yeej nrog tsuas yog kov. Tsis muaj lub cev khawm