Cov txheej txheem:

IoT Tsim Teeb Nrog IFTTT: 7 Cov Kauj Ruam (nrog Duab)
IoT Tsim Teeb Nrog IFTTT: 7 Cov Kauj Ruam (nrog Duab)

Video: IoT Tsim Teeb Nrog IFTTT: 7 Cov Kauj Ruam (nrog Duab)

Video: IoT Tsim Teeb Nrog IFTTT: 7 Cov Kauj Ruam (nrog Duab)
Video: Конфиденциальность, безопасность, общество – информатика для лидеров бизнеса 2016 2024, Hlis ntuj nqeg
Anonim
IoT Tsim Teeb Nrog IFTTT
IoT Tsim Teeb Nrog IFTTT
IoT Tsim Teeb Nrog IFTTT
IoT Tsim Teeb Nrog IFTTT

Hauv Cov Lus Qhia no, Kuv yuav coj koj hauv kev ua internet txuas nrog LED teeb uas ua haujlwm tau zoo thiab zoo nkauj.

Qhov kev tsim ua qhov lom zem no tuaj yeem tswj tau nrog lub vev-app lossis kev pabcuam online IFTTT. Qhov kawg ua rau nws muaj peev xwm nqes lub teeb mus rau txhua yam ntawm cov kev pabcuam sab nraud zoo li Google Assistant, Alexa, Android Cov Ntawv Ceeb Toom, Sijhawm & Hnub, Huab cua huab cua, thiab lwm yam. Txoj haujlwm no suav nrog kev paub yooj yim ntawm ESP8266 thiab tus kho Arduino.

Kauj ruam 1: Sau Electronics

Sib sau Electronics!
Sib sau Electronics!
Sib sau Electronics!
Sib sau Electronics!

Rau qhov haujlwm no koj yuav xav tau cov hauv qab no:

  • NodeMCU lossis lwm yam ESP8266 microcontroller
  • Neopixel/WS2812B LED-strip (1m 60LED/m)
  • Qib Shifter*
  • Dhia xov hlau (Txiv neej-rau-Poj niam)
  • Micro-USB cable
  • USB phab ntsa ntsaws (5V)

LED-strip muaj peb txoj kab hluav taws xob: 5V hauv (liab), GND (dawb) thiab DATA hauv (ntsuab). ESP8266 ua haujlwm ntawm 3.3V tab sis muaj VU tus pin. Tus pin no txuas ncaj qha rau lub zog USB, yog li yog tias koj lub zog koj lub rooj tsav xwm nrog 5V hla USB, qhov hluav taws xob no tseem yuav muaj nyob ntawm VU tus pin. Peb yuav siv tus pin no los ua lub zog LED sawb. Yog li, hauv luv:

  • Txuas hauv av rau hauv av (GND TO G)
  • Txuas 5V+ rau Vu
  • Txuas Din rau D2

* = Nyob ntawm koj cov cuab yeej tshwj xeeb, cov hlua no yuav tsis ua haujlwm. Txij li ESP8266 ua haujlwm ntawm 3.3V, cov ntaub ntawv teeb liab nws muab tseem yuav yog ntawm 3.3V. Vim tias WS2812B tau siv nrog 5V cov ntaub ntawv teeb liab yuav tsis muaj zog txaus kom tau txais los ntawm kab txaij. Yog tias cov xov hlau saum toj no tsis ua haujlwm, koj yuav xav tau Qib Shifter uas hloov cov ntaub ntawv teeb liab los ntawm 3.3V txog 5V. Saib cov txheej txheem txuas txuas.

Nco tseg! Qee qhov LED-Strips muaj feem cuam tshuam ntau dua li lwm tus. Yog tias koj tsis tau ua haujlwm nrog cov kab no Kuv pom zoo kom nyeem Neopixel Überguide rau cov lus qhia txog kev nyab xeeb txuas Neopixel LED-strip.

Kauj ruam 2: FastLED

FastLED
FastLED

Txhawm rau tswj cov LEDs peb tuaj yeem siv lub tsev qiv ntawv FastLED. Yog tias koj tsis tau muaj, ntxiv lub tsev qiv ntawv no rau koj ib puag ncig Arduino (Sketch> Include Library> Manage libraries> 'FastLED').

Kom paub tseeb tias koj cov xov hlau ua haujlwm, koj yuav xav sim ib qho ntawm ntau qhov piv txwv uas tuaj nrog FastLED lub tsev qiv ntawv (Cov Ntaub Ntawv> Piv txwv> FastLED). Nco ntsoov hloov qhov teeb tsa hauv txhua qhov piv txwv (tus lej ntawm LEDs = 60, Cov ntaub ntawv tus pin = 2), ua ntej xa lawv mus rau koj lub rooj tsavxwm.

Ceev faj nrog teeb tsa LEDs ci heev thaum lub rooj tsav xwm tau txuas nrog koj lub khoos phis tawj. Thaum kos ntau dua 500mA, koj lub khoos phis tawj yuav kaw qhov chaw nres nkoj. Yog tias koj xav siv lub sawb ntawm qhov ci ntsa iab, ua lub zog nrog USB phab ntsa ntsaws uas tuaj yeem muab lub zog txaus txaus.

Kauj ruam 3: Software

Software
Software

Tam sim no nws yog lub sijhawm rau kev cai software. Lub software muaj nyob ntawm GitHub:

github.com/dpkn/lamp/tree/master/software

Rub tawm cov software software, unzip nws, thiab qhib cov software.ino cov ntaub ntawv hauv koj li Arduino editor. Nco ntsoov tias koj muaj txhua lub tsev qiv ntawv uas tau hais hauv cov ntawv no tau teeb tsa.

Mus rau Config tab thiab ntxiv koj li WiFi lub npe network thiab tus password rau cov kab no:

const char* ssid = "";

const char* lo lus zais = "";

Koj kuj tseem yuav xav hloov cov hauv qab no, nyob ntawm koj lub router:

const IPAddress zoo li qubIp (192, 168, 178, 101); // Qhov xav tau zoo ib yam IP hauv zos ntawm lub cuab yeej

const IPAddress rooj vag (192, 168, 178, 1); // Gateway IP ntawm tus router constIPAddress subnet (255, 255, 255, 0, 0); // Subnet ntawm tus router

Ntawm MacOS, koj tuaj yeem pom cov kev teeb tsa no nyob hauv System Preferences> Network> Advanced> TCP/IP

Upload cov ntaub ntawv rau koj lub rooj tsavxwm. Yog tias txhua yam mus tau zoo, kab txaij yuav ci dawb thaum nws txuas nrog koj li WiFi network. Qhib Serial Monitor ntawm 115200 baud txhawm rau tshuaj xyuas cov ntaub ntawv ntxiv.

Kauj Ruam 4: Tswj Nws Hauv Zos

Txhawm rau ua kom pom kev ua haujlwm ntawm lub teeb, Kuv tau ua me ntsis web-app uas muaj nyob ntawm https://lamp-app.surge.sh (qhov chaw ntawm Codepen). Cov app no xa JSON thov ncaj qha mus rau ESP8266, uas yog hloov tshiab LEDs.

Qhov saum toj no tsuas yog ua haujlwm yog tias koj lub teeb thiab xov tooj txuas nrog tib lub network WiFi vim tias koj tab tom hais lub teeb los ntawm nws tus IP chaw nyob. Txhawm rau tuaj yeem tswj lub teeb los ntawm txhua qhov chaw, koj yuav tsum khawb rau hauv koj lub router teeb tsa.

Kauj Ruam 5: Tswj Nws Los Ntawm Txhua Qhov Chaw

Txhawm rau qhib koj lub teeb mus rau qhov txuj ci tseem ceeb uas yog World Wide Web, peb yuav tsum ua qee yam hu ua chaw xa mus. Yeej, qhov no yuav xa cov lus thov hais txog ntawm koj tus IP chaw nyob (tus uas tau muab los ntawm koj tus ISP) thiab tus lej chaw nres nkoj (hauv qhov piv txwv no tau txiav txim siab txog 300) rau sab hauv, tus IP chaw nyob koj tus ESP8266 yog qhov chaw nyob.

Cov txheej txheem no txawv rau txhua lub cuab yeej, yog li koj tsis paub yuav ua li cas ntawm koj lub router tshwj xeeb, nco ntsoov google 'chaw nres nkoj xa mus' + lub npe ntawm koj lub router. Nov yog cov chaw koj xav tau:

Sab Nraud Pib/Xaus Chaw Nres Nkoj: 300

Sab Hauv Pib/Xaus Chaw Nres Nkoj: 300

Internal IP Adress: 192.168.178.101 (qhov chaw nyob uas tau qhia hauv Serial Monitor)

Cov txheej txheem: TCP/UDP

Ceeb toom! Tom qab ua qhov no, koj lub teeb tuaj yeem tswj hwm los ntawm ib tus neeg uas paub koj tus IP pej xeem thiab chaw nres nkoj uas lub teeb ua haujlwm. Yog tias koj tsis xav tias yog lub tswv yim zoo, siv qee txheej kev nyab xeeb raug pom zoo

Txhawm rau ntsuas yog txhua yam tau teeb tsa kom raug, sau cov hauv qab no rau hauv koj tus browser: (yog tias koj tsis paub koj tus IP chaw nyob yog, mus rau lub vev xaib no.)

[KOJ PUBLIC IP]: 300

Koj yuav tsum pom JSON cov lus pom zoo. Tam sim no koj tuaj yeem sim siv lub app nrog koj tus IP chaw nyob.

Kauj Ruam 6: IFTTT

IFTTT
IFTTT
IFTTT
IFTTT
IFTTT
IFTTT
IFTTT
IFTTT

Nov yog qhov pib kev lom zem tiag tiag. Tam sim no tias peb lub teeb txuas nrog ~~ internet ~~, peb tuaj yeem siv lub vev xaib IFTTTto txuas nws mus rau txhua yam kev pabcuam sib txawv.

Hauv qhov piv txwv no, peb yuav teeb tsa Google Assistant hais kom hloov lub teeb liab, tab sis koj tuaj yeem xaiv lwm qhov kev pabcuam uas ua rau koj xav.

  1. Mus rau IFTTT.com thiab tsim ib tus as khauj yog tias koj tsis tau ua dua
  2. Mus rau 'Kuv Applets'> 'Applet Tshiab'
  3. Rau qhov kev pabcuam cuam tshuam, tshawb rau 'Google Assistant'
  4. Xaiv 'Hais Ib Lo Lus Yooj Yim'
  5. Tuaj nrog ob peb nqe lus tshwj xeeb
  6. Rau qhov kev pabcuam nqis tes, tshawb rau 'Webhooks'
  7. Siv cov chaw hauv qab no:

URL: https:// [KOJ-PUBLIC-IP]: 300/api

Txoj Kev: QHIA Cov ntsiab lus Hom: thov/json

Thiab rau lub cev:

Tam sim no thaum peb hais peb cov kab lus xaiv, Google Assistant yuav thov rau IFTTT, uas nyob rau hauv yuav xa JSON thov peb lub teeb. Nco ntsoov sim nws! Dhia rau hauv txoj cai kom pom dab tsi ntxiv uas koj tuaj yeem ua rau cov hlua ua.

Kauj Ruam 7: Ua Nws Zoo Nkauj

Ua Nws Zoo Nkauj
Ua Nws Zoo Nkauj
Ua Nws Zoo Nkauj
Ua Nws Zoo Nkauj
Ua Nws Zoo Nkauj
Ua Nws Zoo Nkauj

Qhov feem kim tshaj plaws ntawm txoj haujlwm no yog cov ntaub thaiv uas nyob hauv tsev LED sawb. Yog tias koj tsuas yog xav sim qhov haujlwm no yam tsis tas siv nyiaj ntau dhau rau nws, koj tseem tuaj yeem txiav txim siab lwm yam duab lossis yooj yim ua lub raj tawm ntawm cov ntawv luam ntawv dawb. Txuas nrog koj yuav pom daim kab xev uas koj tuaj yeem luam tawm ntawm daim ntawv txhawm rau qee qhov sawv ntsug rau lub raj, raws li pom hauv cov duab saum toj no.

Rau qhov ua kom khov dua kuv tau siv cov khoom hauv qab no:

  • Frosted acrylic raj (ntev = 1160mm, taub = 40mm, phab ntsa tuab = 2mm)
  • 2x Yas Cap
  • 20x2x30mm thaiv ntawm softwood
  • 10x1160x2mm hlau sawb

LED sawb nws tus kheej yog 1000mm, tawm 80mm ntawm ob qho kawg ntawm lub raj kom zais cov khoom siv hluav taws xob. Kuv siv lub tshuab luam ntawv ntawv yob rau hauv lub raj ntawm ob qho kawg kom lawv tsis pob tshab. Txhawm rau ua kom ntxaws yooj yim dua, Kuv tau kaw cov hlua LED mus rau cov hlau ntev ntev

Kuv milled cov sawv tawm ntawm ib pawg ntawm softwoods. Yog koj xav ua tib yam, cov ntaub ntawv.stl tau muab hauv qab no. Koj tseem tuaj yeem txiav txim siab 3D luam ntawv sawv ntsug.

Pom zoo: