Cov txheej txheem:

Rooj Sib Tham Saib Xyuas Kev Siv Particle Photon: 8 Cov Kauj Ruam (nrog Duab)
Rooj Sib Tham Saib Xyuas Kev Siv Particle Photon: 8 Cov Kauj Ruam (nrog Duab)

Video: Rooj Sib Tham Saib Xyuas Kev Siv Particle Photon: 8 Cov Kauj Ruam (nrog Duab)

Video: Rooj Sib Tham Saib Xyuas Kev Siv Particle Photon: 8 Cov Kauj Ruam (nrog Duab)
Video: coj sawv daws mus saib lawv khawb vaj pov cov nyiaj nyob zos noom taj xeev khuam 2024, Hlis ntuj nqeg
Anonim
Kev Sib Tham Hauv Chav Sib Tham Siv Particle Photon
Kev Sib Tham Hauv Chav Sib Tham Siv Particle Photon

Taw qhia

Hauv qhov kev qhia no peb yuav ua lub rooj sib tham saib xyuas siv Particle Photon. Hauv Qhov Kev Sib Tham no tau koom ua ke nrog Slack siv Webhooks kom tau txais lub sijhawm hloov tshiab ntawm seb puas muaj chav nyob lossis tsis muaj. PIR sensors tau siv los txheeb xyuas qhov hloov pauv hloov hauv lub teeb infrared kom nkag siab tib neeg.

Ua ntej tshaj, teeb tsa Slack

Qhov thib ob, teeb tsa Particle

Kauj Ruam 1: Cov Cheeb Tsam Xav Tau

Kho vajtse

  • Particle Photon ==> $ 19
  • PIR sensor ==> $ 7
  • LED ==> $ 2

Software

  • Particle Web IDE
  • Slack

Tus nqi tag nrho yog kwv yees $ 28

Kauj Ruam 2: Teeb tsa Slack Incoming Webhook

Ib Slack Tuaj Txog Webhook mloog cov ntaub ntawv los ntawm lwm qhov chaw thiab tom qab ntawv tshaj tawm nws mus rau Slack channel.

Thawj zaug mus rau https://slack.com/intl/en-in/ tom qab ntawd nkag mus rau koj tus email chaw nyob. Koj yuav pom nplooj ntawv zoo li no

Duab
Duab

Tsim qhov chaw ua haujlwm tshiab. Koj yuav pom nplooj ntawv zoo li no

Duab
Duab

Ua channel rau Webhook los tshaj tawm. Kuv tsim lub npe channel hu ua #conferenceroom

Duab
Duab

Tom ntej no, nyem lub iav icon thiab xaiv "Ntxiv ib qho app"

Duab
Duab

Tam sim no, tsim Webhook nws tus kheej. Ntaus cov webhooks nkag rau hauv lub npov tshawb nrhiav, tom qab ntawd nyem Cov Khoom WebHooks tuaj

Duab
Duab

Nyem rau ntawm lub webhooks tuaj koj yuav pom nplooj ntawv zoo li no

Duab
Duab

Tom qab ntawd nyem rau ntawm "ntxiv teeb tsa". Koj yuav pom nplooj ntawv zoo li no

Duab
Duab

Xaiv cov channel los tshaj tawm rau. Hauv qhov no, nws yog #conferenceroom

Duab
Duab

Nrhiav koj lub Webhook URL. Qhov URL no xa cov ntaub ntawv mus rau ntawm Particle Device Cloud

Duab
Duab

Scroll cia rau Kev Sib Koom Chaw thiab muab koj lub webhook sau cov ntawv piav qhia, lub npe, thiab lub cim, tom qab ntawv nyem Txuag Chaw

Duab
Duab
Duab
Duab

Peb ua tiav nrog Slack teeb tsa.

Kauj Ruam 3: Particle Photon

Photon yog pawg neeg IOT uas nrov tshaj plaws. Lub rooj tsav xwm hauv tsev STM32F205 120Mhz ARM Cortex M3 microcontroller thiab muaj 1 MB nco lub cim xeeb, 128 Kb RAM thiab 18 lub teeb liab sib xyaw ua ke lub hom phiaj tso zis tawm (GPIO) pins nrog cov khoom siv siab tshaj. Tus qauv muaj nyob rau ntawm board Cypress BCM43362 Wi-Fi nti rau Wi-nkaus txuas thiab Ib leeg band 2.4GHz IEEE 802.11b/g/n rau Bluetooth. Lub rooj tsavxwm tau nruab nrog 2 SPI, ib I2S, ib I2C, ib tus tuaj yeem thiab ib qho USB interface.

Nws yuav tsum tau sau tseg tias 3V3 yog cov lim dej tau siv rau kev ntsuas analog. Tus pin no yog qhov tso tawm ntawm tus tswj hwm ntawm lub rooj tsavxwm thiab txuas nrog sab hauv nrog VDD ntawm Wi-nkaus module. Thaum fais fab Photon ntawm VIN lossis USB chaw nres nkoj, tus pin no yuav tso tawm qhov hluav taws xob ntawm 3.3VDC. Tus pin no tseem tuaj yeem siv los txhawb lub zog Photon ncaj qha (cov tswv yim siab tshaj 3.3VDC). Thaum siv los ua qhov tso tawm, qhov siab tshaj plaws ntawm 3V3 yog 100mA. PWM cov cim muaj kev daws teeb meem ntawm 8-ntsis thiab ua haujlwm ntawm 500 Hz.

Pin Diagram

Duab
Duab

Nqe lus piav qhia

Duab
Duab

Kauj Ruam 4: Particle Web IDE

Txog kev sau cov phiaj xwm txheej txheem rau ib qho Photon, tus tsim tawm yuav tsum tsim tus as khauj hauv Particle lub vev xaib thiab sau npe rau Photon board nrog nws tus lej siv. Txoj cai program yuav tuaj yeem sau rau ntawm Web IDE ntawm Particle lub vev xaib thiab xa mus rau daim ntawv sau npe hauv internet. Yog tias pawg thawj coj saib xyuas xaiv, Photon ntawm no, tau hloov pauv thiab txuas nrog huab kev pabcuam ntawm Particle, cov cai tau hlawv mus rau pawg tswj hwm xaiv hla huab cua ntawm kev sib txuas hauv is taws nem thiab pawg thawj coj pib ua haujlwm raws li qhov hloov pauv. Txog kev tswj hwm pawg thawj coj hauv is taws nem, nplooj ntawv web tau tsim los uas siv Ajax thiab JQuery xa cov ntaub ntawv mus rau pawg thawj coj siv HTTP POST method. Lub vev xaib txheeb xyuas lub rooj tsavxwm los ntawm tus lej ntaus ntawv thiab txuas rau Particle's Cloud Service los ntawm kev nkag mus rau token.

Yuav ua li cas txuas photon nrog Internet1. Fais fab koj ntaus ntawv

  • Txuas lub USB cable rau hauv koj lub hwj chim.
  • Sai li nws tau ntsaws, RGB LED ntawm koj lub cuab yeej yuav tsum pib ntsais muag xiav. Yog tias koj lub cuab yeej tsis ntsais muag xiav, tuav lub pob SETUP. Yog hais tias koj lub cuab yeej tsis ntsais muag tag nrho, lossis yog tias lub LED kub hnyiab txiv kab ntxwv xim, nws yuav tsis tau txais lub zog txaus. Sim hloov koj lub zog lossis USB cable.

2. Txuas koj Photon rau Is Taws Nem

Muaj ob txoj hauv kev yog koj siv web application lossis mobile app

a Kev siv web daim ntawv thov

  • Kauj ruam 1 Mus rau setup.particle.io
  • Kauj ruam 2 Nyem rau teeb tsa Photon
  • Kauj Ruam 3 Tom qab nyem rau NEXT, koj yuav tsum tau nthuav tawm nrog cov ntawv (photonsetup.html)
  • Kauj ruam 4 Qhib cov ntawv.
  • Kauj Ruam 5 Tom qab qhib cov ntawv txuas koj lub PC rau Photon, los ntawm kev txuas mus rau lub network npe PHOTON.
  • Kauj Ruam 6 Kho koj li ntaub ntawv pov thawj Wi-Fi. Ntau: Yog tias koj ua yuam kev koj li ntawv pov thawj, Photon yuav ntsais xiav xiav lossis ntsuab. Koj yuav tsum mus dhau cov txheej txheem dua (los ntawm kev rov ua nplooj ntawv lossis nyem rau ntawm qhov txheej txheem rov ua dua)
  • Kauj ruam 7 Hloov koj lub cuab yeej. Koj tseem yuav pom qhov kev lees paub yog tias lub cuab yeej tau thov lossis tsis yog.

b. Siv smartphone

  • Qhib lub app ntawm koj lub xov tooj. Nkag mus lossis kos npe rau tus as khauj nrog Particle yog tias koj tsis muaj.
  • Tom qab nkag mus, nias lub cim ntxiv thiab xaiv lub cuab yeej koj xav ntxiv. Tom qab ntawd ua raws cov lus qhia ntawm lub vijtsam txhawm rau txuas koj lub cuab yeej rau Wi-nkaus. Yog tias qhov no yog koj li Photon thawj zaug sib txuas, nws yuav ntsais liab doog rau ob peb feeb thaum nws rub tawm tshiab. Nws yuav siv sijhawm 6-12 feeb rau qhov hloov tshiab kom ua tiav, nyob ntawm koj li kev txuas hauv is taws nem, nrog Photon rov pib dua ob peb zaug hauv tus txheej txheem. Tsis txhob rov pib dua lossis tshem koj lub Photon lub sijhawm no.

Thaum koj tau txuas koj lub cuab yeej, nws tau kawm lub network ntawd. Koj lub cuab yeej tuaj yeem khaws txog tsib lub network. Txhawm rau ntxiv lub network tshiab tom qab koj teeb tsa thawj zaug, koj yuav tso koj lub cuab yeej rau hauv Hom Mloog dua thiab ua raws li saum toj no. Yog tias koj zoo li koj lub cuab yeej muaj ntau lub network ntawm nws, koj tuaj yeem so koj lub cuab yeej nco ntawm ib qho Wi-nkaus tes hauj lwm nws tau kawm. Koj tuaj yeem ua tau los ntawm kev txuas ntxiv tuav lub pob teeb tsa rau 10 vib nas this kom txog thaum RGB LED ntsais muag xiav sai, qhia tau tias txhua qhov profile tau raug tshem tawm.

Hom

  • Cyan, koj Photon txuas nrog Internet.
  • Magenta, tam sim no nws tau rub tawm app lossis hloov kho nws cov firmware. Lub xeev no tau tshwm sim los ntawm kev hloov kho firmware lossis los ntawm qhov ua kom pom tseeb los ntawm Web IDE lossis Desktop IDE. Koj yuav pom hom no thaum koj txuas koj Photon rau huab thawj zaug.
  • Ntsuab, nws tau sim txuas rau hauv is taws nem.
  • Dawb, Wi-nkaus module raug kaw.

Web IDEParticle Tsim yog Kev Txhim Kho Ib Leeg Ib puag ncig, lossis IDE uas txhais tau tias koj tuaj yeem tsim kho software hauv daim ntawv thov siv tau yooj yim, uas tsuas yog tshwm sim los ua haujlwm hauv koj lub vev xaib.

Txhawm rau qhib tsim, nkag mus rau koj tus lej nyiaj thiab tom qab ntawd nyem rau ntawm Web IDE raws li qhia hauv duab

Duab
Duab

Thaum koj nyem koj yuav pom console zoo li no

Duab
Duab

Txhawm rau tsim qhov tsim tshiab app, nyem rau ntawm tsim app tshiab

Duab
Duab

Txhawm rau txheeb xyuas qhov program. Nyem rau qhov tseeb

Duab
Duab

Txhawm rau upload cov cai, nyem rau nyem tab sis ua ntej ua qhov ntawd xaiv lub cuab yeej. Nyem rau ntawm "Devices" lub cim nyob rau hauv qab sab laug ntawm lub pane navigation, tom qab ntawd thaum koj yuj hla lub npe ntaus ntawv lub hnub qub yuav tshwm ntawm sab laug. Nyem rau nws kom teeb tsa lub cuab yeej uas koj nyiam hloov kho (nws yuav tsis pom yog tias koj tsuas muaj ib lub cuab yeej). Thaum koj tau xaiv lub cuab yeej, lub hnub qub cuam tshuam nrog nws yuav tig daj. (Yog tias koj tsuas muaj ib lub cuab yeej, tsis tas yuav xaiv nws, koj tuaj yeem txuas ntxiv mus

Duab
Duab
Duab
Duab

Kauj Ruam 5: Tsim Particle Webhook

Ntau Slack kev koom ua ke xav tau nplooj siab web servers khiav PHP cov ntawv sau los ua cov ntaub ntawv mus thiab los ntawm Slack. Txawm li cas los xij, hauv peb qhov xwm txheej peb tsuas yog siv Particle webhook los qhia rau Slack webhook seb puas muaj chav sib tham lossis tsis muaj.

Peb xav tau ob lub webhooks ib qho rau conf_avail thiab thib ob rau conf_inuse (koj tuaj yeem siv lub npe twg).

Mus rau Particle Console thiab nyem rau Kev Sib Koom tab, tom qab ntawd nyem Tshiab Kev Sib Koom

Duab
Duab

Nyem Webhook kom pib Webhook Builder

Duab
Duab

Hauv Webhook Builder hauv qab Lub Npe Lub Npe sau conf_avail. Muab tshuaj txhuam koj Slack webhook URL hauv qab URL. Hloov Thov Hom Ntawv rau JSON

Duab
Duab
Duab
Duab

Nthuav Advanced Chaw thiab xaiv Kev Cai raws li JSON Cov Ntaub Ntawv. Muab tshuaj txhuam cov cai hauv qab no

Duab
Duab

Rov ua tib cov kauj ruam rau conf_inuse

Duab
Duab
Duab
Duab

Nco tseg:- Lub npe ntawm qhov xwm txheej tau tshaj tawm tau ua raws qhov xwm txheej lub npe txheej xwm hauv webhook.

Kauj Ruam 6: Daim duab Circuit Court

Particle Photon ==> PIR sensor

Vin ==> Vcc

GND ==> GND

D0 ==> Cov zis

Particle Photon ==> LED

  • D2 ==> +Ve (Anode)
  • GND ==> -Ve (Cathode)
Duab
Duab

Kauj Ruam 7: Txoj Haujlwm

Kauj Ruam 8: Qhov tshwm sim

Qhov tshwm sim
Qhov tshwm sim
Qhov tshwm sim
Qhov tshwm sim
Qhov tshwm sim
Qhov tshwm sim
Qhov tshwm sim
Qhov tshwm sim
Duab
Duab
Duab
Duab
Duab
Duab
Duab
Duab
IoT Kev Sib Tw
IoT Kev Sib Tw
IoT Kev Sib Tw
IoT Kev Sib Tw

Khiav Tawm hauv IoT Challenge

Pom zoo: