Cov txheej txheem:

Tswj ESP8266 Los ntawm Google Tsev Siv GBridge.io: 4 Cov Kauj Ruam
Tswj ESP8266 Los ntawm Google Tsev Siv GBridge.io: 4 Cov Kauj Ruam

Video: Tswj ESP8266 Los ntawm Google Tsev Siv GBridge.io: 4 Cov Kauj Ruam

Video: Tswj ESP8266 Los ntawm Google Tsev Siv GBridge.io: 4 Cov Kauj Ruam
Video: PIR motion sensor | How do they Work? 2024, Hlis ntuj nqeg
Anonim
Tswj ESP8266 Los ntawm Google Tsev Siv GBridge.io
Tswj ESP8266 Los ntawm Google Tsev Siv GBridge.io

Muaj ntau txoj hauv kev los tswj ESP8266 los ntawm Google Tsev, tab sis feem ntau ntawm cov kev daws teeb meem koj tuaj yeem pom hauv Is Taws Nem siv IFTT, uas tsis yog tus neeg siv tiag tiag rau teeb tsa.

gBridge.io tso cai ua kom cov txheej txheem yooj yim dua thiab ua haujlwm tau zoo.

Hauv phau ntawv qhia no-kuv yuav qhia koj li cas kuv teeb tsa kuv li ESP01 tus qauv los teb rau cov lus txib xws li "Qhib lub teeb" thiab "Puas yog lub teeb tau qhib?". Txoj haujlwm tsuas yog qhib thiab tua lub built-in LED, tab sis nws yooj yim mus ntxiv tom qab ntawd.

Cov ntaub ntawv xav tau:

  • 1 * ESP8266 module (https://www.sparkfun.com/products/13678)
  • 2 * laub-khawm (https://www.sparkfun.com/products/97)
  • 1 * 10k resistor
  • 1 * FTDI cable 3.3V (https://www.sparkfun.com/products/14909)

Kauj Ruam 1: FTDI Cable rau ESP8266

FTDI Cable rau ESP8266
FTDI Cable rau ESP8266

Txhawm rau sib txuas lus ntawm ESP8266 thiab koj lub PC, koj yuav tsum ua FTDI rau ESP8266 adapter.

  1. Koj yuav tsum tsim lub Circuit Court pom hauv daim duab txuas yog tias koj muaj 5V FTDI cable:
  2. Yog tias koj muaj 3.3V FTDI cable, koj tuaj yeem zam lub 78xxl nti, thiab ntsaws 3.3V ncaj qha rau ESP8266.
  3. Sab laug khawm yog "programing" khawm thiab sab xis yog "reset" khawm
  4. Thaum koj xav muab nws tso rau hauv "programing" hom, koj yuav tsum tuav ob lub pob nyem thiab xub tso lub pob pib dua, thiab tom qab ntawd, qhov thib ob.
  5. Lub pob qhov haujlwm yuav raug siv hauv txoj haujlwm no txhawm rau qhib thiab kaw lub built-in LED ntawm tus kheej.

Kauj Ruam 2: Programming ESP8266 Nrog Arduino IDE

Programming ESP8266 Nrog Arduino IDE
Programming ESP8266 Nrog Arduino IDE
Programming ESP8266 Nrog Arduino IDE
Programming ESP8266 Nrog Arduino IDE

Cov kauj ruam thib ob yog kom tuaj yeem ua haujlwm ESP01 module nrog Arduino IDE. Qhov no yuav ua kom yooj yim tom qab siv MQTT Library los ntawm Adafruit. Kuv tau tshoov siab los ntawm phau ntawv qhia no rau cov theem no:

  1. Txhim kho qhov tseeb Arduino IDE version. Hauv kuv qhov xwm txheej nws yog v1.8.8.
  2. Mus rau Cov Ntaub Ntawv Nyiam thiab ntxiv qhov txuas https://arduino.esp8266.com/stable/package_esp8266com_index.json mus rau Tus Thawj Saib Xyuas Ntxiv URLS.
  3. Nkag mus rau Tus Thawj Saib Xyuas Cov Cuab Yeej Cuab Yeej
  4. Tam sim no koj yuav tsum muaj qhov esp8266 ua qhov kev xaiv muaj txij li koj tau ntxiv nws rau Cov Txheej Txheem Ntxiv.
  5. Xaiv nws thiab nias Nruab.
  6. Tam sim no koj yuav tsum muaj ESP8266 module teev ua "Generic ESP8266" module.
  7. Hauv kuv qhov xwm txheej, kuv yuav tsum xaiv qee qhov tsis raws li qhia hauv cov duab txuas.
  8. Xaiv Qhov Chaw Nres Nkoj uas koj lub FTDI cable txuas.
  9. Koj tuaj yeem sim qhov "Blink piv txwv" (Cov Piv Txwv Cov Ntaub Ntawv ESP8266 Blink).
  10. Muab koj ESP8266 tso rau hauv "programing" hom los ntawm kev ua ob lub pob nyem thiab thawj zaug tso lub pob pib dua, thiab tom qab ntawd, qhov thib ob.

Kauj Ruam 3: Teeb Up GBridge

Teeb tsa GBridge
Teeb tsa GBridge
Teeb tsa GBridge
Teeb tsa GBridge
  1. Mus rau
  2. Sau npe tus account
  3. Nkag mus rau koj tus account
  4. Tsim lub cuab yeej tshiab
  5. Nias Ntxiv.
  6. Hauv koj daim ntawv teev npe khoom, koj yuav tsum muaj koj lub cuab yeej tshiab muaj npe.

  7. Koj yuav xav tau ob qhov chaw nyob rau tom qab.
  8. Txhawm rau txuas Google Assistant, koj tuaj yeem ua raws phau ntawv qhia muaj nyob hauv gBridge cov ntaub ntawv:

Kauj Ruam 4: Tau Txais Adafruit MQTT Library los Ua Haujlwm Nrog GBridge

Lub tsev qiv ntawv Adafruit MQTT yuav siv los sib txuas lus ntawm ESP866 thiab gBridge.io

  1. Hauv Arduino IDE, Mus rau Cov Cuab Yeej -> Tus Thawj Saib Xyuas Tsev Qiv Ntawv
  2. Nruab Adafruit MQTT Library
  3. Nkag mus rau cov ntaub ntawv hauv thawj feem ntawm txoj cai thiab xa nws. Koj yuav tsum sawv thiab khiav.

/************************* WiFi Access Point ********************* ************ / #define WLAN_SSID "Koj SSID lub npe" #define WLAN_PASS "Koj li SSID Password" / ******************** ***** Gbridge Teeb *********************************/#txhais AIO_SERVER "mqtt.gbridge.kappelt.net "#define AIO_SERVERPORT 1883 // siv 8883 rau SSL #define AIO_USERNAME" koj lub gBridge username "#define AIO_KEY" koj tus lej gBridge "/******************** ********** Tsau *************************************** /Adafruit_MQTT_Publish qhib tawm = Adafruit_MQTT_Publish (& mqtt, "gBridge/u341/d984/onoff/set"); // Hloov los ntawm koj lub npe noj Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe (& mqtt, "gBridge/u341/d984/onoff"); // Hloov los ntawm koj lub npe noj

Pom zoo: