Cov txheej txheem:

GmailBox Nrog Zapier thiab Adafruit: 14 Kauj Ruam
GmailBox Nrog Zapier thiab Adafruit: 14 Kauj Ruam

Video: GmailBox Nrog Zapier thiab Adafruit: 14 Kauj Ruam

Video: GmailBox Nrog Zapier thiab Adafruit: 14 Kauj Ruam
Video: Episode #3 w/Nunzio Martinello – Building Akiflow, India's Startup Culture, Product Dev and More 2024, Hlis ntuj nqeg
Anonim
GmailBox Nrog Zapier thiab Adafruit
GmailBox Nrog Zapier thiab Adafruit

Hauv cov lus qhia no kuv yuav piav qhia koj ib kauj ruam zuj zus yuav ua li cas thiaj tsim Gmail ceeb toom nrog ESP8266.

Koj xav tau dab tsi:

- Gmail account

- Zapier tus account

- Adafruit tus account

- Arduino IDE

NodeMCU ESP8266

- Servomotor (Kuv siv SG90)

- LED teeb (Kuv siv Neopixel LED sawb, lwm lub teeb yuav ua haujlwm ib yam tab sis yuav xav tau lwm lub tsev qiv ntawv)

Kauj ruam 1: Teeb Zapier

Teeb tsa Zapier
Teeb tsa Zapier
Teeb tsa Zapier
Teeb tsa Zapier

Tsim Zapier tus lej thiab ua Zap tshiab. Koj yuav xav tau Zapier kom tau txais cov ntaub ntawv los ntawm Gmail thiab tom qab ntawd mus rau Adafruit. Ntau ntxiv txog qhov no tom qab.

Kauj ruam 2: Tsim kom muaj Trigger

Tsim kom muaj tus txhais
Tsim kom muaj tus txhais
Tsim kom muaj tus txhais
Tsim kom muaj tus txhais

Peb xav kom ntseeg tau tias yog tias koj tau txais email hauv Gmail, lwm yam yuav tshwm sim yog li koj yuav xav tau koj li Gmail account. Hauv koj qhov Zap tshiab xaiv Gmail raws li kev thov thiab kos npe rau hauv Gmail.

Kauj Ruam 3: Txuas Zapier Nrog Adafruit

Txuas Zapier Nrog Adafruit
Txuas Zapier Nrog Adafruit
Txuas Zapier Nrog Adafruit
Txuas Zapier Nrog Adafruit
Txuas Zapier Nrog Adafruit
Txuas Zapier Nrog Adafruit

Tam sim no koj xav xa cov ntaub ntawv uas koj tau txais hauv Gmail rau Adafruit. Hauv ntu "Ua qhov no" tshawb rau Adafruit thiab txuas nrog koj tus lej Adafruit. Tom qab ntawv xaiv "Tsim Cov Ntaub Ntawv" raws li kev tshwm sim.

Kauj Ruam 4: Teeb tsa Adafruit

Teeb tsa Adafruit
Teeb tsa Adafruit
Teeb tsa Adafruit
Teeb tsa Adafruit
Teeb tsa Adafruit
Teeb tsa Adafruit

Tam sim no mus rau io.adafruit.com thiab tsim ib tus as khauj yog tias koj tseem tsis tau muaj. Mus rau koj li Tsiaj thiab tsim Kev Pub Noj Tshiab. Hauv qhov no lub npe ntawm kuv pub yog "gmailbox", koj yuav xav tau qhov no tom qab.

Yog tias koj nrhiav tsis tau koj li Adafruit Key, koj tuaj yeem pom nws nyob rau saum kaum sab xis.

Kauj Ruam 5: Pub Cov Ntaub Ntawv Los Ntawm Zapier

Pub Cov Ntaub Ntawv Los Ntawm Zapier
Pub Cov Ntaub Ntawv Los Ntawm Zapier
Pub Cov Ntaub Ntawv Los Ntawm Zapier
Pub Cov Ntaub Ntawv Los Ntawm Zapier

Tam sim no rov qab mus rau Zapier los npaj koj cov ntaub ntawv pub khoom seem. Ntawm tus yuam sij pub zaub mov xaiv "Siv Tus Nqi Tus Kheej" xaiv. Qhov "Custum Tus Nqi Rau Qhov Ntsuas Pub" yuav tsum zoo ib yam li lub npe los ntawm koj Pub hauv Adafruit, yog li ceev faj nrog cov tsiaj ntawv loj.

Ntawm "Tus Nqi" sau rau hauv wat koj xav pom raws li tus nqi hauv Adafruit. Tus nqi zoo ib yam yuav pom tom qab nyob hauv cov saib hauv Arduino.

Kauj Ruam 6: Xeem Nrog Zapier, Adafruit thiab Gmail

Kev Xeem Nrog Zapier, Adafruit thiab Gmail
Kev Xeem Nrog Zapier, Adafruit thiab Gmail
Kev Xeem Nrog Zapier, Adafruit thiab Gmail
Kev Xeem Nrog Zapier, Adafruit thiab Gmail

Tam sim no koj tuaj yeem sim koj li Zap. Nyem rau Test & Continue (tsis txhob hnov qab qhib Zap tom qab). Tom qab ntawd rov qab mus rau Adafruit rau koj cov khoom noj thiab hauv qab kab ntawv koj tuaj yeem pom yog tias cov ntaub ntawv tuaj txog. Tom qab koj qhib koj Zap koj tseem tuaj yeem sim qhov no los ntawm kev xa koj tus kheej xa ntawv.

Kauj Ruam 7: Teeb Arduino

Teeb tsa Arduino
Teeb tsa Arduino

Txuas koj ESP8266 thiab qhib Arduino. Tsim cov duab kos tshiab thiab tab tshiab raws li qhia hauv daim duab saum toj no. Npe nws "config.h" (koj tuaj yeem sau nws txhua yam koj xav tau). Muab tshuaj txhuam cov cai hauv qab no hauv "config" tab.

Nrog tus lej no koj tuaj yeem txuas rau koj li WiFi thiab Adafruit. Kuv tau txais nws los ntawm qhov haujlwm uas tau siv yav tas los. Kuv tseem siv nws thiab nws ua haujlwm zoo rau kuv.

/************************ Adafruit IO Config ********************** *********/

// mus ntsib io.adafruit.com yog tias koj xav tsim tus as khauj, // lossis yog koj xav tau koj li Adafruit IO tus yuam sij. #define IO_USERNAME "koj lub npe siv adafruit" #define IO_KEY "adafruit key" /******************************* WIFI ** ************************************/ #define WIFI_SSID "koj lub wifi ssd" #define WIFI_PASS "wifi lo lus zais " #suav nrog" AdafruitIO_WiFi.h"

Kauj Ruam 8: Teeb Koj Li NodeMCU

Teeb Koj Li NodeMCU
Teeb Koj Li NodeMCU

Txuas tus servomotor thiab LED kab rau koj ESP8266.

Cov xov hlau los ntawm servomotor (SG90): Xim av mus rau hauv G (hauv av), Liab mus rau hauv 3V, Txiv kab ntxwv mus hauv D6 (lossis lwm tus lej digital). Kuv kuj tseem siv qee cov kab txuas ntxiv rau txuas ntxiv.

Cov xov hlau los ntawm Neopixel: GDN mus rau G (hauv av), DIN mus rau D4 (lossis lwm tus lej digital), +5V mus rau 3V.

Kauj Ruam 9: Teeb Cov Tsev Qiv Ntawv thiab Kho Vajtse

Tam sim no mus rau koj daim duab Arduino koj nyuam qhuav tsim. Ua ntej koj yuav tsum suav nrog cov tsev qiv ntawv koj xav tau hauv daim duab. Koj yuav xav tau qhov teeb tsa.h koj nyuam qhuav tsim, lub tsev qiv ntawv rau ESP8622 thiab rau Neopixel LED sawb.

Koj muab qhov no tso rau hauv qhov chaws raws li hauv qab no:

#suav nrog "config.h"

#ncig #ncig

Tom ntej no koj yuav suav nrog cov cuab yeej koj siv

#suav nrog

Servo tsav; #define PIXEL_PIN D4 #define PIXEL_COUNT 10 #define PIXEL_TYPE NEO_GRB + NEO_KHZ800 Adafruit_NeoPixel pixels = Adafruit_NeoPixel (PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

Ntxiv kab ntawv no los txuas qhov kos duab no rau pub hauv Adafruit:

AdafruitIO_Feed *gmailbox = io.feed ("koj lub npe pub");

Kauj ruam 10: Void teeb Code

Hauv "teeb tsa tsis muaj dab tsi" koj yuav txuas rau Adafruit, WiFi thiab teeb tsa servomotor mus rau tus lej pin. Tom qab qhov no koj tuaj yeem tshawb xyuas hauv kab ntawv saib seb puas muaj kev sib txuas.

Kuv qhia koj kom rov ntaus dua cov cai es tsis txhob theej nws. Qhov no ua rau nws nco tau yooj yim dua rau tom qab thiab koj pib kawm dab tsi koj sau raws nraim.

Cov cai yuav zoo li no:

void teeb tsa () {

// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug: // pib qhov txuas nrog cov lej txuas Serial.begin (115200) // tos rau cov saib txuas mus qhib thaum (! Serial); // txuas rau io.adafruit.com Serial.print ("Txuas rau Adafruit IO"); io.connect (); // teeb tsa tus tswj hwm cov lus rau 'koj lub npe pub mis' pub. // qhov kev ua haujlwmMessage (txhais hauv qab no) yuav raug hu thaum twg cov lus tau txais // tau txais los ntawm Adafruit. // tos rau kev txuas thaum (io.status () tau (); // tus pin ntawm servomotor servo.attach (D6); servo.write (0); nameofyourfeed-> onMessage (handleMessage);}

Kauj ruam 11: Void Loop Code

Tom ntej no koj yuav tsum paub tseeb tias Adafruit tau ua haujlwm tas li, peb yuav tsum muab qhov no tso rau hauv lub voj void kom kuv khiav tas li.

Ua qhov no raws li hauv qab no:

void voj () {

// tso koj tus lej tseem ceeb ntawm no, kom rov ua dua: io.run (); }

Kauj Ruam 12: Kev Ua Haujlwm rau Servomotor thiab LEDs Raws Li Tawm

Tam sim no peb yuav ua kom ntseeg tau tias thaum koj tau txais email, servomotor thiab LEDs yuav teb. Peb yuav tsim txoj haujlwm uas ua kom ntseeg tau qhov no. Txoj haujlwm yuav raug hu ua "handleMessage" peb tau siv ua ntej hauv txoj cai. Peb yuav siv tus nqi uas peb pom Adafruit ntawm no.

Yog tias koj tau txais email tshiab lub servomotor xav tau tig 90 degree thiab LEDs yuav tsum tau teeb. Rau cov LEDs peb siv liab ua xim tab sis koj tuaj yeem hloov nws txhua yam koj xav tau. Koj kuj tseem xav kom ntseeg tau tias tsis yog tsuas yog thawj LED ntawm kab txaij nyob, yog li koj yuav tsum muab nws tso rau hauv lub voj kom pom lub teeb tag nrho.

Thiab dua, sim rov ua dua cov cai tsis txhob luam-muab nws tso.

Cov cai yuav zoo li no:

tsis muaj dab tsi handleMessage (AdafruitIO_Data *cov ntaub ntawv) {

yog (cov ntaub ntawv> 0) {servo.write (90); ncua (1000); Serial.println ("Koj tau txais ntawv!"); rau (int i = 0; i

Kauj Ruam 13: Upload rau Koj NodeMCU thiab Xeem Nws

Upload rau Koj NodeMCU thiab Ntsuas Nws
Upload rau Koj NodeMCU thiab Ntsuas Nws

Rub cov duab kos rau koj ESP8266. Koj tuaj yeem ua qhov no los ntawm txhaj rau sab xis taw xub tom ntej ntawm tus cim kos nyob rau ntawm kaum sab laug.

Tom qab ntawd koj tuaj yeem sim xa koj tus kheej email los sim nws thiab kom ntseeg tau tias nws ua haujlwm.

Kauj Ruam 14: Tiav Kov

Koj tau ua tiav nrog ntu coding. Xav muaj tswv yim? Tsim lub tsev xa ntawv rau yam uas koj nyuam qhuav ua thiab lo tus chij ntawm lub servomotor. Tus chij yuav nce txhua zaus koj tau txais email!

Ua tsaug rau koj ua raws phau ntawv no thiab kuv vam tias nws tau pab.

Pom zoo: