Cov txheej txheem:

DIY Smart Home Nrog Google Assistant thiab Arduino: 6 Cov Kauj Ruam
DIY Smart Home Nrog Google Assistant thiab Arduino: 6 Cov Kauj Ruam

Video: DIY Smart Home Nrog Google Assistant thiab Arduino: 6 Cov Kauj Ruam

Video: DIY Smart Home Nrog Google Assistant thiab Arduino: 6 Cov Kauj Ruam
Video: Making a &#!$%ing Button 2024, Kaum ib hlis
Anonim
Image
Image
DIY Ntse Tsev nrog Google Assistant thiab Arduino
DIY Ntse Tsev nrog Google Assistant thiab Arduino

Leej twg tsis xav tau lub tsev ntse? Ib qho zoo tshaj plaws uas koj tuaj yeem ua yog hloov lub teeb lossis lwm yam khoom siv hauv koj lub tsev los ntawm kev tswj lub suab. Nrog kev pab los ntawm Google Tsev app thiab Google tus pabcuam qhov no yog ib qho khoom qab zib tiag tiag ……

Koj tsis xav tau ntau qhov rau nws thiab nws yog qhov kev sim zoo los tsim lub suab tswj koj tus kheej nrog tus hais lus ntse, Arduino lub khoos phis tawj me me thiab ob peb hloov pauv. Koj tseem tuaj yeem yuav ntau lub teeb ntse ntse pheej yig heev thiab qhov sib txuas ua ke tab sis ua rau koj tus kheej muaj kev lom zem dua. Kuv yuav piav qhia ib qib zuj zus tias koj tuaj yeem ua li cas. Koj yuav xav tau cov khoom siv hauv qab no:

Khoom siv

1 Tus hais lus ntse, piv txwv li Google Nest Mini.

2 Ib lub khoos phis tawj Arduino MKR1000 los hloov lub suab hais kom hloov pauv cov lus txib.

3 Ib lossis ntau dua 5 Volt hloov pauv, ib qho rau txhua lub teeb uas koj xav tswj.

4 USB fais fab mov rau Arduino MKR1000 nrog micro-USB ntsaws.

5 Cov xov hluav taws xob tseem ceeb (1.5 sqmm) thiab cov ntsaws rau kev nyab xeeb txuas ntawm lub teeb thiab lwm yam khoom siv.

6 Ib lub xov tooj Android rau Google Tsev app.

Kauj Ruam 1: Cov Txheej Txheem Hais Los Ntawm Internet

Cov Txheej Txheem Hais Txog Ntawm Internet
Cov Txheej Txheem Hais Txog Ntawm Internet

Hauv daim duab no koj tuaj yeem pom ib qib zuj zus tias tag nrho cov txheej txheem ua haujlwm li cas.

Hloov thiab tawm ntawm lub suab hais kom ua tiav ntawm internet. Peb (!) Huab kev pabcuam yuav tsum ua qhov no… Koj yuav tsum tsim tus as khauj rau txhua qhov kev pabcuam huab… Nws nyuaj me ntsis tab sis nws ua haujlwm!

Ua ntej koj yuav xav tau Google Tsev app. Rub tawm nws los ntawm Playstore ntawm koj lub xov tooj Android thiab nruab lub app. Nkag siab koj tus kheej cov lus txib nrog Google Tsev tsuas yog ua haujlwm nrog lus Askiv. Yog li teeb tsa cov lus rau Askiv ntawm kev teeb tsa / teeb tsa ntau dua / pabcuam / lus thiab tom qab ntawd xaiv Askiv (Tebchaws Meskas).

Google Nest Mini hnov lub suab hais kom ua, piv txwv li "Hav Google, hloov lub teeb tus lej ib ntawm". Lub suab sib piv no yog digitized thiab xa mus rau Google Assistant huab. Tom qab ntawv nws tau xa mus rau IFTTT huab uas qhov lus teb tau ua. IFTTT (Yog Qhov Zoo Tshaj Li lossis "yog tias koj ua ib yam lwm yam tshwm sim") yog hom chaw nres tsheb nruab nrab uas txheeb xyuas cov lus txib, muab cov lus teb thiab xa cov haujlwm mus rau huab tom ntej, Adafruit IO. Yog tias cov lus txib tau nkag siab tag nrho cov lus teb los ntawm IFTTT yuav raug xa rov qab digitally mus rau Google Nest Mini thiab nyob ntawd nws yuav hloov mus ua lub teeb liab. Yog tias cov lus txib tsis nkag siab, Google Assistant yuav xa lwm lo lus teb los qhia meej tias tsis muaj kev hloov pauv yuav ua raws. Cov lus nkag siab nkag siab yuav raug xa los ntawm IFTTT mus rau Adafruit lub vev xaib. Adafruit yog cov khoom siv hluav taws xob tswj hwm lub vev xaib los khaws cov ntaub ntawv hloov pauv ntse. Lawv hu nws ua "Pub". IFTTT xa cov cai cuam tshuam nrog cov lus txib (hauv peb kis "one_on") rau cov khoom noj no. Arduino MKR1000 tau teeb tsa los tshuaj xyuas lub vev xaib no tas li, nyeem tawm cov ntaub ntawv hauv kev pub mis thiab tom qab ntawd nws hloov qhov cuam tshuam hloov pauv hloov mus rau lossis tawm. Adafruit pub raug tiv thaiv rau kev nyab xeeb vim li cas nrog lub npe account thiab qhov tshwj xeeb Adafruit IOKEY tsuas yog paub rau tus tswv tus account.

Kauj ruam 2: Programming Arduino MKR1000

Lub cajmeem Arduino MKR1000
Lub cajmeem Arduino MKR1000
Lub cajmeem Arduino MKR1000
Lub cajmeem Arduino MKR1000

Siv tus txheej txheem IDE los ntawm Arduino lub vev xaib. Muab cov tsev qiv ntawv hauv qab no hauv IDE (ntawm: cov cuab yeej / tswj cov tsev qiv ntawv): ArduinoJson thiab WiFi101.

Yog tias koj tsis tau ua haujlwm yav dhau los MKR1000, koj yuav tsum xub ua kom lub rooj tsav xwm no nkag tau yooj yim hauv IDE. Rub tawm cov ntawv board "Arduino SAMD boards" ntawm cov ntawv qhia zaub mov / pawg thawj coj / tus thawj tswj hwm, tom qab ntawd koj tuaj yeem xaiv pawg MKR1000.

Cov duab kos kuj tseem siv cov ntawv ntxiv, arduino_secrets.h.

Nov yog cov ntawv sau uas koj tuaj yeem tsim nrog notepad. Cov ntaub ntawv no muaj cov lej nkag siv rau Wi-nkaus network (network SSID thiab password) thiab Adafruit IO lub vev xaib tus lej nkag mus tus lej (npe nyiaj thiab IOKEY code). Txuag cov ntawv no hauv phau ntawv teev npe tsev qiv ntawv arduino ntawm koj lub PC nrog lub npe arduino_secrets.h hauv cov npe cais. Ua ntej txuag, hloov tag nrho "xxx" nrog koj tus kheej lub network thiab Adafruit cov ntaub ntawv. Qhov no yuav tsum yog hauv cov ntaub ntawv arduino_secrets.h:

#define SECRET_SSID “xxx”

#define SECRET_PASS “xxx”

#define IO_USERNAME “xxx”

#define IO_KEY “xxx”

Luam daim duab Arduino hauv qab no thiab thauj nws mus rau hauv MKR1000 ntawm Arduino IDE program.

Kauj Ruam 3: Adafruit Pub

Adafruit Pub
Adafruit Pub

Tsim tus account ntawm www.io.adafruit.com. Adafruit yog cov khoom siv hluav taws xob tswj hwm lub vev xaib los khaws cov ntaub ntawv hloov pauv ntse.

Tsim ON_OFF pub uas cov lus txib yuav raug cawm tom qab. Adafruit muaj cov kev qhia dav dav uas qhia koj yuav ua li cas:

learn.adafruit.com/adafruit-io-basics-feeds/creating-a-feed

Nws yog qhov zoo tshaj los teeb tsa "pub" hauv keeb kwm pub rau OFF, nws tsis tas yuav tsum nco ntsoov qhov hloov pauv cov lus txib. (cov chaw nyob ntawm sab xis ntawm nplooj ntawv).

Kauj Ruam 4: Qhov Chaw IFTTT

IFTTT Chaw
IFTTT Chaw
IFTTT Chaw
IFTTT Chaw
IFTTT Chaw
IFTTT Chaw
IFTTT Chaw
IFTTT Chaw

Tsim tus account ntawm www. IFTTT.com. Mus rau "tshawb" (sab saum toj sab xis) thiab tom qab ntawd xaiv "ua koj tus kheej applets los ntawm kos". Nyem rau ntawm "NO" thiab tshawb rau google. Xaiv google pab. Tom qab ntawd xaiv thawj qhov kev xaiv "hais cov kab lus yooj yim". Tom qab ntawd nkag mus rau qhov kev xav tau cov lus piav qhia thiab cov lus teb yuav tsum tau muab.

(Hauv peb qhov xwm txheej "hloov txhua lub teeb rau" thiab "OK. Kuv yuav hloov txhua lub teeb rau. Ceev faj!"). Tom qab ntawd nyem "tsim txhais" thiab hauv lub vijtsam tom ntej nyem "YOG". Tom qab ntawd xaiv Adafruit thiab nyem rau "xa cov ntaub ntawv mus rau adafruit IO". ON-OFF pub tshwm rau thawj daim teb thiab tom qab ntawd nkag mus rau qhov chaws xav tau hauv daim teb thib ob (ntawm no yog piv txwv "tag nrho-on").

Thaum kawg, nyem rau ntawm "tsim kev nqis tes ua" thiab tom qab ntawd "ua tiav".

Koj tseem tuaj yeem tau txais cov lus ntawm koj lub xov tooj los tshuaj xyuas txhua lub sijhawm applet tau ua haujlwm, uas muaj txiaj ntsig zoo rau kev daws teeb meem tab sis thaum txhua yam ua haujlwm koj tuaj yeem tua qhov no.

Yog tias koj xav tswj ntau lub teeb lossis lwm yam khoom siv hauv tsev, koj yuav tsum tsim IFTTT applet rau txhua qhov hais kom ua, thiab cov lej khaws cia hauv Adafruit pub yuav tsum sib haum rau cov lej hauv Arduino kos duab.

Kauj Ruam 5: Kuaj Cov Kev Sib Txuas thiab Software

Kuaj Cov Kev Sib Txuas thiab Software
Kuaj Cov Kev Sib Txuas thiab Software

Txhawm rau sim cov kab ke, koj tuaj yeem ua qhov kev teeb tsa teeb tsa nrog LEDs hloov chaw txuas:

Kauj Ruam 6: Txuas Cov Khoom Siv Hauv Tsev

Txuas Cov Khoom Siv Hauv Tsev
Txuas Cov Khoom Siv Hauv Tsev
Txuas Cov Khoom Siv Hauv Tsev
Txuas Cov Khoom Siv Hauv Tsev

Txhawm rau hloov cov cuab yeej siv hauv tsev, koj yuav tsum txuas kev hloov pauv mus rau cov chaw nres nkoj ntawm Arduino MKR1000 tsis txhob siv cov ntsuas LEDs. Siv 1.5 mm2 thaiv ntawm qhov hluav taws xob tseem ceeb sab txuas rau cov cuab yeej siv thiab kev sib txuas lus sib txuas kom nyab xeeb.

Pom zoo: