Cov txheej txheem:

Yuav Ua Li Cas Xa Ntawv SMS Los Ntawm Koj Arduino ESP Project: 6 Kauj Ruam
Yuav Ua Li Cas Xa Ntawv SMS Los Ntawm Koj Arduino ESP Project: 6 Kauj Ruam

Video: Yuav Ua Li Cas Xa Ntawv SMS Los Ntawm Koj Arduino ESP Project: 6 Kauj Ruam

Video: Yuav Ua Li Cas Xa Ntawv SMS Los Ntawm Koj Arduino ESP Project: 6 Kauj Ruam
Video: cas tus me ntxhais ntawv thooj li koj. Tub Huas xyooj.MV 2023 2024, Hlis ntuj nqeg
Anonim
Yuav Xa SMS Li Cas Los Ntawm Koj Arduino ESP Project
Yuav Xa SMS Li Cas Los Ntawm Koj Arduino ESP Project

Cov lus qhia no qhia yuav ua li cas xa SMS cov ntawv los ntawm koj txoj haujlwm arduino siv ESP8266 lub cuab yeej thiab txuas WiFi. Vim li cas siv SMS? * SMS kuj tseem tuaj yeem tau txais qhov sib txuas ntawm cov ntaub ntawv xov tooj tsis muaj * Tsis muaj daim ntawv thov thib peb yuav tsum tau teeb tsa ntawm lub xov tooj ntawm tes. * SMS yog qhov tseem ceeb rau cov lus siv tseem ceeb. rau ESP ntaus ntawv. Rau koj qhov phiaj xwm no tuaj yeem ua rau qee qhov cuam tshuam lossis xwm txheej xwm txheej

Kauj Ruam 1: Qhov Chaw

Qhov
Qhov
Qhov
Qhov

Rau qhov kev ua yeeb yaj kiab no, koj yuav xav tau:* ESP8266 ntaus ntawv. Kuv xaiv ESP-01 pob, tab sis lwm yam ESP pob/ntaus ntawv yuav tsum ua haujlwm ib yam nkaus.* 3.3v muab* WiFi txuas* Kapow SMS account* Arduino IDE* ESP8266 Programming module.

Kauj Ruam 2: Tus Muab Kev Pabcuam SMS

Hauv txoj haujlwm no, SMS cov lus tau xa los ntawm SMS rooj vag hauv internet. Rau qhov no koj yuav tsum tau sau npe mus rau tus muab kev pabcuam SMS. Cov neeg siv npe ib txwm raug them nqi ntawm ib nqe lus hauv xov tooj. Kuv xaiv tus muab kev pabcuam SMS yog KAPOW. Kuv pom tias feem ntau cov chaw muab SMS hauv tebchaws Askiv tsuas yog cuam tshuam nrog Cov Tuam Txhab Txwv, thiab tsis yog tib neeg. Txawm li cas los xij, KAPOW ua, thiab muab kev pabcuam zoo thiab raug nqi. Txhawm rau qhib Kapow SMS tus account, mus saib qhov txuas hauv qab no.

www.koobpov.co.uk

Kauj Ruam 3: Txuas Nws

Txuas Nws
Txuas Nws

Cov kab hluav taws xob txuas rau qhov haujlwm no yog saud

Kauj ruam 4: Txoj Cai

// ESP8266 Demo Project xa SMS ntawm KAPOW (www.kapow.co.uk)

// https://www.instructables.com/id/How-to-Send-SMS-… #include #include char _sKapow_Host = "kapow.co.uk"; int _iKapow_Port = 80; / * <<<< Hloov DETAILS hauv qab no */ // Koj li WiFi ntsiab lus: char _sWiFi_SSID = "YourWifiPoint"; // <--- CHANGE !!! char _sWiFi_Password = "YourWifFiPassword"; // <--- CHANGE !!! // Koj Tus Kapow Tus Neeg Siv Khoom Paub meej: char _sKapow_User = "YourKapowAccount"; // <--- CHANGE !!! char _sKapow_Password = "YourKapowPassword"; // <--- CHANGE !!! char _sKapow_Mobile = "Koj Lub Xov Tooj"; // >>> CHANGE DETAILS SAWV DAWS */ // khawm txuas nrog GP0 Pin const int gp0_Pin = 0; const koj iMaxAttempts = 10; int gp0_State = 0; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); Serial.println ("\ nDemo: Xa SMS ntawm KAPOW"); // pib lub khawm khawm ua lub tswv yim // thiab rub nws siab (sab hauv) pinMode (gp0_Pin, INPUT_PULLUP); // tsim Wifi txuas WifiConnect (); } void loop () {// nyeem lub xeev khawm gp0_State = digitalRead (gp0_Pin); // yog laub khawm nias qis? yog (gp0_State == 0) {Serial.println ("Nias Nias Kom Xa SMS …"); SendSmsKapow (_sKapow_Mobile, "Qhov no yog+a+Xeem+SMS+Xov+xa+los ntawm+koj+ESP+ntaus ntawv"); } Serial.println ("Tsaug zog rau 1 thib ob"); ncua (1000); } void WifiConnect () {Serial.print ("\ n Txuas rau WiFi:"); Serial.println (_sWiFi_SSID); WiFi.begin (_sWiFi_SSID, _sWiFi_Password); thaum (WiFi.status ()! = WL_CONNECTED) {// rov sim dua tom qab Serial.print thib ob ("."); ncua (1000); } yog (WiFi.status () == WL_CONNECTED) Serial.println ("Txuas rau WiFi"); } bool SendSmsKapow (char* sMobile, char* sMessage) {WiFiClient clientSms; int iAttempts = 0; Serial.print ("Txuas rau KAPOW host"); thaum (! clientSms.connect (_sKapow_Host, _iKapow_Port)) {Serial.print ("."); iAttempts ++; yog (iAttempts> iMaxAttempts) {Serial.println ("\ n Ua tsis tau txuas mus rau KAPOW"); rov muaj tseeb; } ncua (1000); } Serial.println ("\ n Txuas nrog KAPOW"); ncua (1000); Serial.println ("Xa HTTP thov mus rau KAPOW:"); // Ib qho piv txwv GET thov yog: //https://www.kapow.co.uk/scripts/sendsms.php?username=test&password=test&mobile=07777123456&sms=Test+message char sHttp [500] = ""; strcat (sHttp, "Tau txais /cov ntawv sau /sendsms.php?username="); strcat (sHttp, _sKapow_User); strcat (sHttp, "& tus password ="); strcat (sHttp, _sKapow_Password); strcat (sHttp, "& xov tooj ="); strcat (sHttp, sMobile); strcat (sHttp, "& sms ="); strcat (sHttp, sMessage); strcat (sHttp, "& returnid = TRUE / n / n"); Serial.println (sHttp); clientSms.print (sHttp); Serial.println ("Tos kom teb (10 secs) …"); ncua (10 * 1000); char sReply [100] = ""; int iPos = 0; thaum (clientSms.available ()) {char c = clientSms.read (); Serial.print (c); sReply [iPos] = c; iPos ++; yog (iPos == 99) so; } sReply [iPos] = '\ 0'; // kos yog tias teb muaj OK bool bResult = (strstr (sReply, "OK")! = NULL); yog (bResult) Serial.println ("\ nSMS: Ua tiav xa"); lwm yam Serial.println ("\ nSMS: Ua tsis tau tejyam xa"); yog (! clientSms.connected ()) {Serial.println ("Disconnecting from KAPOW"); clientSms.stop (); } rov bResult; }

Kauj ruam 5: Nyem rau Code

Nyem rau Code
Nyem rau Code
Nyem rau Code
Nyem rau Code

Muaj ntau ntau yam qhia ntxaws qhia yuav ua li cas nyem qhov program ESP8266. Yog li kuv tsuas yog muab cov ntsiab lus ntawm kuv kev teeb tsa hauv qhov yooj yim, Kuv siv aUSB rau Serial FTDI interface, thiab rub GP0 qis rau kev rov pib dua kom pib lub bootloader flashing txheej txheem. Kuv tsim kuv tus kheej lub tshuab ntaus ntawv ntaus ntawv kom yooj yim. Nws muaj* lub qhov (socket) rau ESP-01 ntaus ntawv* lub qhov (socket) rau lub liab FTDI interface los ntsaws rau hauv PC host ntawm USB.* Nyees khawm rau RESET, GP0, GP2 RAU GROUND Koj tuaj yeem nyem ESP ntaus ntawv siv 3.3v muab los ntawm FTDI interface. Xyuas kom FTDI jumper teeb tsa kuj tau teeb tsa rau 3.3v.

Kauj Ruam 6: Nias Lub Khawm

Nias lub khawm!
Nias lub khawm!
Nias lub khawm!
Nias lub khawm!
Nias lub khawm!
Nias lub khawm!
Nias lub khawm!
Nias lub khawm!

Koj tuaj yeem sim qhov phiaj xwm txuas nrog FTDI rau kev tso tawm cov ntawv txuas, lossis nyob ib leeg (ntawm lub khob cij nrog cov khoom siv hluav taws xob sab nraud). Nws tau rov ua dua tshiab rau koj siv lwm 3.3v khoom siv, raws li FTDI cov khoom siv tam sim no yog tshem tawm. Txawm li cas los xij, FTDI 3.3v cov khoom kuj tseem ua haujlwm rau kuv, vim tias kuv lub router wifi nyob hauv caj npab ncav cuag. Leave ESP txuas nrog lub serial/usb chaw nres nkoj yog li koj tuaj yeem saib xyuas kev ua haujlwm debug cav siv Arduino IDE's Serial Monitor. On powerup … Nias khawm txuas nrog GP0. Qhov no yuav xa tawm SMS cov lus raws li hauv qab no. Txheeb xyuas koj lub xov tooj rau qhov tau txais SMS ntawv xov xwm. Ua haujlwm tiav.

Pom zoo: