Cov txheej txheem:

Lub Suab Siv Cov Khoom Siv Media Siv Alexa: 9 Kauj Ruam (nrog Duab)
Lub Suab Siv Cov Khoom Siv Media Siv Alexa: 9 Kauj Ruam (nrog Duab)

Video: Lub Suab Siv Cov Khoom Siv Media Siv Alexa: 9 Kauj Ruam (nrog Duab)

Video: Lub Suab Siv Cov Khoom Siv Media Siv Alexa: 9 Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Lub Suab Qhib Cov Khoom Siv Media Siv Alexa
Lub Suab Qhib Cov Khoom Siv Media Siv Alexa

Chav tsev tsim los ntawm no ua rau koj cov cuab yeej siv xws li TV, lub suab nrov, CD thiab DVD players tswj nrog lub suab txib siv Alexa thiab Arduino. Qhov zoo ntawm chav tsev no yog tias koj yuav tsum tsuas yog muab lub suab hais kom ua. Chav tsev no tuaj yeem ua haujlwm nrog txhua yam khoom siv uas siv RS-232 chaw nres nkoj chaw nres nkoj. Cov chaw nres nkoj no muaj txiaj ntsig zoo heev hauv kev sib txuas. Lawv feem ntau siv hauv kev tshaj xov xwm. Tam sim no, tsis tas yuav siv IR remotes.

Chav tsev tsis kim. Nws muaj, Arduino Board. Koj tuaj yeem siv txhua lub rooj tsav xwm arduino tab sis kuv nyiam Arduino Nano vim tias nws yog kev cog lus. Lwm yam yog ESP 8266, Amazon Alexa, RS 232-TTL Converter. Kuv kuj tau suav nrog cov lus qhia rau Particle.

Kauj Ruam 1: Yam Koj Yuav Tsum Tau

1. Particle Photon

2. Amazon Alexa

3. Amazon Echo Dot

4. ESP 8266

5. RS232-TTL Hloov

6. Arduino UNO/Nano/Micro…

Kauj Ruam 2: Txuas Arduino rau ESP 8266

Txuas Arduino rau ESP 8266
Txuas Arduino rau ESP 8266

Txuas Arduino's 3v3 (3.3V) cov zis rau ESP8266. ESP8266 ua haujlwm nrog 3.3V thiab tsis yog 5V, yog li qhov no yog qhov tsim nyog.

Txuas RES lossis RESET tus pin, Thaum koj tsaws tus pin rov pib dua, Arduino ua haujlwm li dumb USB rau txuas txuas, uas yog yam peb xav tham nrog ESP8266.

Txuas RXD tus pin ntawm Arduino mus rau RX tus pin ntawm ESP8266.

Txuas TXD tus pin ntawm Arduino rau TX tus pin ntawm ESP. Thaum peb xav tau ob yam los tham rau ib leeg dhau ntawm qhov txuas, peb txuas TX tus pin ntawm ib qho rau RX ntawm lwm tus (xa mus tau txais thiab rov qab). Nov peb tsis muaj Arduino tham nrog ESP8266 tab sis, peb lub khoos phis tawj tham nrog nws nrog Arduino. Txuas GND thiab VCC.

Thaum kawg CH_PD txuas.

Kauj Ruam 3: Txuas RS 232-TTL Converter

Tam sim no, nws yog qhov yooj yim los txuas RS 232-TTL hloov pauv rau Arduino thiab ESP uas peb txuas nrog ua ntej raws li kev sib txuas tau hais hauv qab no:

Txuas GND ntawm Arduino/Particle rau GND ntawm kev hloov pauv

Txuas VCC ntawm Arduino/Particle rau VCC ntawm kev hloov pauv

Txuas TX ntawm Arduino/Particle rau TX ntawm kev hloov pauv

Txuas RX ntawm Arduino/Particle rau RX ntawm kev hloov pauv

Kauj Ruam 4: Tsim Amazon Kev Txawj Ntse

Tsim Amazon Txuj Ci
Tsim Amazon Txuj Ci
Tsim Amazon Txuj Ci
Tsim Amazon Txuj Ci
Tsim Amazon Txuj Ci
Tsim Amazon Txuj Ci

Yog tias koj tab tom siv particle Board Ua raws cov theem no.

Koj xav tau tus account tsim tawm nrog Amazon, yog tias koj tsis muaj ib tus koj tuaj yeem kos npe dawb. Mus rau

Hauv tus account tsim tawm mus rau Alexa cov khoom siv txuj ci.

Tom qab ntawv nyem "Tsim cov txuj ci tshiab"

Koj yuav tsum xaiv cov hauv qab no: "Ntse Tsev Txawj Ntse API" hauv Hom Kev Txawj Ntse

Hauv payload version, xaiv v3

Thiab ces nyem Txuag.

Kauj Ruam 5: Kho Qhov Rai

Kho qhov rai
Kho qhov rai
Kho qhov rai
Kho qhov rai

Thaum txuag tau, cov kauj ruam tom ntej qhia koj koj daim ntawv thov ID.

Nyem rau tom ntej khawm Tom qab ntawd los rau lub qhov rai teeb tsa. Ntawm no koj yuav tsum siv cov lus txib curl nyob qhov twg hauv tus neeg siv tus ID tso tus lej nkag mus thiab hauv www.example.com koj yuav tsum muab lub vev xaib me me.

Kauj ruam 6: Amazon AWS

Rau qhov no koj yuav tsum nkag mus rau

Xaiv Tus Sau Daim Ntawv Xaiv.

Tom qab ntawd, theej cov cai uas yog hauv cov ntawv sau.

Teem koj tus lej ID hauv koj txoj haujlwm. Koj yuav tsum hloov cov lus txib rau koj lub cuab yeej tshwj xeeb.

Tom qab ua txhua kauj ruam, sim cov txuj ci hauv Lambda Configuration.

Kauj Ruam 7: Rau Arduino

Txhawm rau siv kev paub suab nrog Arduino, koj yuav tsum tau siv Amazon Echo Dot

Txuas rau wifi siv tus lej hauv qab no:

#suav nrog "debug.h" // Serial debugger luam ntawv #suav nrog "WifiConnection.h" // Wifi txuas // cov ntawv no yog ib feem ntawm kuv cov lej qhia #include // IR library

Wifi Kev sib txuas* wifi; // wifi txuas IRsend* irSend; // infrared xa

// SET KOJ WIFI CREDS const char*myWifiSsid = "***"; const char*myWifiPassword = "*******";

// Teem kom phim koj HARDWARE #define SERIAL_BAUD_RATE 9600

// PIN 0 yog D3 ntawm CHIP #txhais IR_PIN 0

/*---------------------------------------*/// Khiav ib zaug, thaum ntaus ntawv yog siv rau lossis tus lej nyuam qhuav raug teeb tsa qhov tsis muaj teeb meem () {// yog teeb tsa tsis raug, koj cov lej debugger yuav tsis nyeem Serial.begin (SERIAL_BAUD_RATE);

// pib wifi txuas wifi = tshiab WifiConnection (myWifiSsid, myWifiPassword); wifi-> pib ();

// txuas rau wifi yog (wifi-> txuas ()) {debugPrint ("Wifi Txuas"); }}

/*---------------------------------------*/// Ua haujlwm tas li tsis muaj dab tsi voj () {}

Kauj Ruam 8: Txuas WEMO Server

Tom qab ntawd, khiav WEMO server, nws yog txoj hauv kev zoo tshaj rau ESP8266.

Tam sim no, peb yuav tsum teeb tsa ESPAsyncTCP lub tsev qiv ntawv.

Code rau Xeem:

#suav nrog "debug.h" // Serial debugger luam ntawv #suav nrog "WifiConnection.h" // Wifi txuas #suav nrog "Wemulator.h" // Peb Wemo emulator #suav nrog // IR tsev qiv ntawv

Wifi Kev sib txuas* wifi; // wifi txuas Wemulator* wemulator; // wemo emulator IRsend* irSend; // infrared xa

// SET YOUR WIFI CREDS const char*myWifiSsid = "***"; const char*myWifiPassword = "*******";

// Teem kom phim koj HARDWARE #define SERIAL_BAUD_RATE 9600

// PIN 0 yog D3 ntawm CHIP #define IR_PIN 0 /*----------------------------------- ----*/// Khiav ib zaug, thaum lub cuab yeej tau qhib lossis cov cai tau nyuam qhuav raug teeb tsa tsis muaj dab tsi teeb tsa () {// yog teeb tsa tsis raug, koj cov lej debugger yuav tsis tuaj yeem nyeem tau Serial.begin (SERIAL_BAUD_RATE);

// pib wifi txuas wifi = tshiab WifiConnection (myWifiSsid, myWifiPassword); wifi-> pib ();

// initialize IR irSend = tshiab IRsend (IR_PIN, cuav); irSend-> pib ();

// initialize wemo emulator wemulator = tshiab Wemulator ();

// txuas rau wifi yog (wifi-> txuas ()) {wemulator-> pib ();

// pib wemo emulator (nws ua haujlwm ua ntu ntawm webservers) wemulator-> addDevice ("tv", WemoCallbackHandler tshiab (& commandReceived)); wemulator-> addDevice ("TV", WemoCallbackHandler tshiab (& commandReceived)); wemulator-> addDevice ("kuv lub tv", tshiab WemoCallbackHandler (& commandReceived)); wemulator-> addDevice ("kuv lub TV", WemoCallbackHandler tshiab (& commandReceived)); }}

/*---------------------------------------*/// Ua haujlwm tas li tsis muaj dab tsi voj () {// cia tus wemulator mloog lub suab txib yog (wifi-> yog txuas) {wemulator-> mloog (); }}

Kauj Ruam 9: Ua Tsaug

Tam sim no, koj tau ua koj lub suab qhib lub cuab yeej los tswj koj li Media Devices.

Sim hais "Alexa Turn on TV"

Yog li, hauv txoj kev no koj tuaj yeem ua koj tus kheej lub suab tswj hwm chav siv Arduino lossis Particle.

Ua tsaug rau koj los ntawm!

Pom zoo: