Cov txheej txheem:
- Kauj ruam 1: Mus Tau Cov Khoom
- Kauj Ruam 2: Cov Taub Hau Solder
- Kauj ruam 3: Ntxig rau
- Kauj ruam 4: Resolder
- Kauj Ruam 5: Txuas tus kav hlau txais xov
- Kauj Ruam 6: Ntxig SIM Card
- Kauj ruam 7: Pib ua ntej
- Kauj Ruam 8: Cov Ntawv Xov Xwm
- Kauj Ruam 9: Suab
Video: Arduino Cellular Shield Tutorial: 9 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-02-02 14:56
Arduino Cellular Shield tso cai rau koj hu xov tooj ntawm tes, thiab xa xov. Lub hlwb ntawm daim ntaub thaiv no yog SM5100B uas yog lub xov tooj ntawm tes muaj zog muaj peev xwm ua tau ntau txoj haujlwm ntawm feem ntau ntawm cov xov tooj ntawm tes. Cov ntaub thaiv npog no yuav tsum siv daim npav SIM txuas rau lub xov tooj ntawm tes. Cov ntawv qhia uas ua hauv qab no yog cov pob txha liab qab qhia rau pib ua daim ntaub thaiv, thiab ob qho tib si xa thiab txais ntawv xov xwm, thiab hu xov tooj. Txhawm rau kawm paub ntau ntxiv txog tus qauv kev ua haujlwm, nco ntsoov txheeb xyuas cov ntawv teev tseg ntawm Sparkfun cov khoom nplooj ntawv.
Kauj ruam 1: Mus Tau Cov Khoom
Koj yuav xav tau:
(x1) Cov ntaub thaiv npog ntawm tes (x1) Stackable Arduino headers (x1) Quad band antenna (x1) Arduino Uno
(Nco ntsoov tias qee qhov txuas ntawm nplooj ntawv no yog cov koom nrog sib txuas. Qhov no tsis hloov pauv tus nqi ntawm yam khoom rau koj. Kuv rov nqis peev nyiaj dab tsi uas kuv tau txais los ua cov haujlwm tshiab. Yog tias koj xav tau cov lus qhia rau lwm tus neeg xa khoom, thov qhia rau kuv paub.)
Kauj Ruam 2: Cov Taub Hau Solder
Ntxig cov headers rau hauv daim ntaub thaiv thiab muab lawv tso rau hauv qhov chaw.
Kauj ruam 3: Ntxig rau
Ntxig cov header pins rau hauv lub qhov (socket) ntawm Arduino.
Kauj ruam 4: Resolder
Tus kav hlau txais xov txuas rau SM5100B tus qauv feem ntau tsis zoo. Resolder txhua tus cable txuas rau tus qauv kom ntseeg tau kev sib txuas.
Kauj Ruam 5: Txuas tus kav hlau txais xov
Txuas tus kav hlau txais xov rau tus kav hlau txais xov cable.
Kauj Ruam 6: Ntxig SIM Card
Ntxig daim npav SIM kom ruaj ntseg rau hauv daim npav SIM.
Kauj ruam 7: Pib ua ntej
Khiav cov cai hauv qab no ntawm Arduino:
/*
SparkFun Cellular Shield - Pass -Through Sample Sketch SparkFun Electronics Sau los ntawm Ryan Owens 3/Nqe lus piav qhia: Daim duab no tau sau rau cuam tshuam nrog Arduino Duemillanove rau Cellular Shield los ntawm SparkFun Electronics. Daim ntaub thaiv ntawm lub xov tooj ntawm tes tuaj yeem yuav tau ntawm no: https://www.sparkfun.com/commerce/product_info.php?products_id=9607 Hauv qhov kev kos duab no cov lus txib tau dhau los ntawm lub davhlau ya nyob twg rau SM5100B cellular module; thiab cov lus teb los ntawm cov xov tooj ntawm tes tau tshaj tawm hauv lub davhlau ya nyob twg. Cov ntaub ntawv ntau ntxiv muaj nyob hauv cov lus piav qhia. Ib daim npav SIM uas tau qhib yuav tsum tau muab tso rau hauv daim npav SIM ntawm lub rooj tsav khoom txhawm rau siv lub cuab yeej! Daim duab no siv NewSoftSerial lub tsev qiv ntawv sau los ntawm Mikal Hart ntawm Arduiniana. Lub tsev qiv ntawv tuaj yeem rub tawm ntawm qhov URL no: https://arduiniana.org/libraries/NewSoftSerial/ Tus lej no tau muab rau hauv Creative Commons Attribution License. Xav paub ntau ntxiv tuaj yeem nrhiav tau ntawm no: https://creativecommons.org/licenses/by/3.0/ (Siv peb cov lej dawb! Thov nco ntsoov nco ntsoov muab credit rau peb qhov twg yog lub sijhawm. Ua tsaug!) */#Include // suav nrog NewSoftSerial lub tsev qiv ntawv kom xa cov lus txib mus rau lub xov tooj ntawm tes. #include // Siv rau txoj kev hloov pauv char charinging_char = 0; // Yuav tuav tus cim tuaj ntawm Serial Port. SoftwareSerial ntawm tes (2, 3); // Tsim qhov 'fake' serial chaw nres nkoj. Tus pin 2 yog tus pin Rx, tus pin 3 yog tus pin Tx. tsis muaj teeb tsa teeb tsa () {// Pib qhov chaw nres nkoj txuas rau kev sib txuas lus. Serial.begin (9600); cell.begin (9600); // Cia peb pib! Serial.println ("Pib SM5100B Kev Sib Txuas …"); } void loop () {// Yog tias muaj tus cim los ntawm cellular module … yog (cell.available ()> 0) {incoming_char = cell.read (); // Tau txais tus cwj pwm los ntawm cov xov tooj ntawm tes. Serial.print (nkag mus_char); // Luam tus cim tuaj rau lub davhlau ya nyob twg. } // Yog tias muaj tus cim los ntawm lub davhlau ya nyob twg mus rau Arduino… yog (Serial.available ()> 0) {incom_char = Serial.read (); // Tau txais lub cim los ntawm lub davhlau ya nyob twg yog tias (khoom_char == '~') // Yog tias nws yog tilde … incom_char = 0x0D; //… hloov mus rau lub tsheb thauj khoom xa rov qab yog tias (khoom_char == '^') // Yog tias nws yog tus saib xyuas ntxiv … khoom_chaw = 0x1A; //… hloov mus rau ctrl-Z cell.print (nkag mus_char); // Xa tus cwj pwm mus rau lub xov tooj ntawm tes. Serial.print (nkag mus_char); // Ncha nws rov qab mus rau lub davhlau ya nyob twg}} / * SM5100B Quck Reference for AT Command Set * Tshwj tsis yog tias tau sau tseg AT cov lus txib tau xaus los ntawm kev nias qhov nkag. 1.) Xyuas kom tseeb tias cov qhab GSM raug xaiv raug xaiv rau koj lub tebchaws. Rau Asmeskas cov pab pawg yuav tsum tau teeb tsa rau 7. Txhawm rau teeb tsa pawg, siv cov lus txib no: AT+SBAND = 7 2.) Tom qab ua haujlwm ntawm Arduino nrog cov ntaub thaiv npog tau teeb tsa, txheeb xyuas tias tus qauv nyeem thiab lees paub SIM daim npav. Nrog lub qhov rai qhib siab thiab teeb tsa mus rau Arduino chaw nres nkoj thiab 9600 buad, lub zog ntawm Arduino. Qhov pib ua ntu zus yuav tsum zoo li no: Pib SM5100B Kev Sib Txuas … +SIND: 1 +SIND: 10, "SM", 1, "FD", 1, "LD", 1, "MC", 1, "RC", 1, "ME", 1 Kev sib txuas lus nrog tus qauv pib tom qab thawj kab tau tshwm. Kab thib ob ntawm kev sib txuas lus, +SIND: 10, qhia peb yog tus qauv tuaj yeem pom daim npav SIM. Yog tias daim npav SIM raug kuaj pom txhua lwm qhov chaw yog 1; yog tias daim npav SIM tsis pom nyob rau txhua qhov chaw yog 0. 3.) Tos kom muaj kev sib txuas hauv network ua ntej koj pib xa cov lus txib. Tom qab +SIND: 10 cov lus teb tus qauv yuav cia li pib sim txuas rau lub network. Tos kom txog thaum koj tau txais cov repsones hauv qab no: +SIND: 11 +SIND: 3 +SIND: 4 Cov +SIND cov lus teb los ntawm cov xov tooj ntawm tes qhia rau cov xwm txheej. Nov yog qhov nrawm nrawm ntawm cov lus teb lub ntsiab lus: 0 SIM daim npav tshem tawm 1 SIM daim npav tso 2 Lub suab paj nruag 3 AT module tau npaj ib nrab 4 AT module tau npaj txhij tag nrho 5 ID tso tawm hu 6 Tso tawm hu uas ID = 7 Lub network kev pabcuam yog muaj hu rau thaum muaj xwm txheej 8 Lub network ploj lawm 9 Suab ON 10 Qhia qhov xwm txheej ntawm txhua phau ntawv xov tooj tom qab pib kab lus 11 Sau npe rau network Tom qab sau npe hauv lub network koj tuaj yeem pib sib cuam tshuam. Nov yog qee qhov lus txib yooj yim thiab muaj txiaj ntsig kom pib: Txhawm rau hu: AT hais kom ua-ATDxxxyyyzzzz Tus lej xov tooj nrog hom ntawv: (xxx) yyy-zzz sim ---- cell.print ("ATDxxxyyyzzzz"); Yog tias koj hu xov tooj nco ntsoov siv cov ntaub ntawv xov tooj los txuas lub microphone thiab hais lus rau daim ntaub thaiv. Txhawm rau xa cov lus txt: AT hais kom ua - AT+CMGF = 1 Cov lus txib no teeb tsa cov ntawv xov xwm hom rau 'ntawv.' AT hais kom ua = AT+CMGS = "xxxyyyzzzz" (thauj rov qab) 'Cov ntawv xa' (CTRL+Z) Cov lus txib no tsis meej pem me ntsis los piav qhia. Tus lej xov tooj, hauv hom ntawv (xxx) yyy-zzzz nkag mus hauv ob nqe lus. Nias 'nkag' tom qab kaw cov lus hais tseg. Tom ntej no sau cov ntawv kom xa. Xaus qhov AT hais kom ua los ntawm kev xa CTRL+Z. Tus cim no tsis tuaj yeem xa los ntawm Arduino lub davhlau ya nyob twg. Siv lwm txoj haujlwm dav dav xws li Hyperterminal, Tera Term, Bray Terminal lossis X-CTU. SM5100B module tuaj yeem ua tau ntau dua li qhov no! Txheeb xyuas cov ntawv teev tseg ntawm nplooj ntawv khoom kom paub ntau ntxiv txog tus qauv.*/Qhib qhov chaw nres nkoj hauv lub davhlau ya nyob twg. Ntawm Mac qhov no ua tiav los ntawm kev ntaus ntawv: tshuaj ntsuam /dev/tty.usbmodemfa131 9600 (hloov tty.usbmodemfa131 nrog koj li Arduino tus lej chaw nyob) Tos kom pom cov ntu hauv qab no rov qab: Pib SM5100B Kev Sib Txuas … +SIND: 3 +SIND: 4 +SIND: 11 (Yog tias qhov xwm txheej no tsis rov qab los txheeb xyuas cov lej yuam kev teev nyob hauv qab ntawm cov cai saum toj no, thiab debug kom tsim nyog. +SIND 11)) Xa cov lus txib hauv qab no mus rau qhov chaw nres nkoj txuas: Xa qhov no rau North American siv: AT+SBAND = 7 Teem sijhawm tam sim no - yy/mm/dd: AT+CCLK = "13/05/15, 11: 02:00 "Xa daim ntawv xeem: ATD4155551212
Kauj Ruam 8: Cov Ntawv Xov Xwm
Rub tawm thiab teeb tsa SerialGSM rau hauv koj lub tsev qiv ntawv Arduino.
Txhawm rau xa xov tuaj ntsib Tronixstuff cellular module nyeem thiab siv piv txwv tus lej 26.3:
Yog tias koj xav khiav tus lej piv txwv kom tau txais cov ntawv, txuas lub LED rau tus pin 8 thiab muab tso ua ke nrog 220 ohm resistor rau hauv av.
Txhawm rau xa xov tuaj ntsib Tronixstuff cellular module nyeem thiab siv piv txwv tus lej 26.5:
Text ib qho ntawm cov lus txib hauv qab no rau koj lub xov tooj ntawm tes:
// tig lub LED ntawm #a1
// Tua lub LED tawm #a0
Kauj Ruam 9: Suab
Txuas lub microphone thiab tus hais lus rau daim ntaub thaiv uas siv cov kab hluav taws xob hauv av. Lub hauv paus teeb liab xaim yuav tsum mus rau lub suab ntxiv rau lub dav hlau thiab kev tiv thaiv yuav tsum mus rau qhov tsis zoo ib yam ntawm cov ntaub thaiv npog. Cov kab no yuav tsum txuas zoo ib yam ntawm lub microphone thiab sab tham.
Txhawm rau pib lub suab hu upload cov cai hauv qab no:
//**********************************************************************************
// Ua Tus Xov Tooj // // BUFFERING CODE BASED UPON: // // //********************************************************************************** #include #define BUFFSIZ 90 //Set up buffer array char at_buffer[BUFFSIZ]; char buffidx; //Network state variables int network_registered; int network_AT_ready; //Code state variables int firstTimeInLoop = 1; int firstTimeInOtherLoop = 1; int x; //Will hold the incoming character from the Serial Port. char incoming_char=0; //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin. SoftwareSerial cell(2, 3); void setup() { //Initialize Arduino serial port for debugging. Serial.begin(9600); //Initialize virtual serial port to talk to Phone. cell.begin(9600); //Hello World. Serial.println("Starting SM5100B Communication…"); delay(1000); //Set initial network state network_registered = 0; network_AT_ready = 0; } //Read AT strings from the cellular shield void readATString(void) { char c; buffidx= 0; // start at begninning for (x = 0; x 0) { c=cell.read(); if (c == -1) { at_buffer[buffidx] = '\0'; return; } if (c == '\n') { continue; } if ((buffidx == BUFFSIZ - 1) || (c == '\r')){ at_buffer[buffidx] = '\0'; return; } at_buffer[buffidx++]= c; } } } //Process the AT strings void ProcessATString() { if(strstr(at_buffer, "+SIND: 8") != 0) { network_registered = 0; Serial.println("network Network Not Available"); } if(strstr(at_buffer, "+SIND: 11") != 0) { network_registered=1; Serial.println("network Registered"); } if(strstr(at_buffer, "+SIND: 4") != 0) { network_AT_ready=1; Serial.println("network AT Ready"); } } void loop() { /* If called for the first time, loop until network and AT is ready */ if(firstTimeInLoop == 1) { firstTimeInLoop = 0; while (network_registered == 0 || network_AT_ready == 0) { readATString(); ProcessATString(); } } //LET'S MAKE A PHONE CALL! if(firstTimeInOtherLoop == 1){ //Change the 10 digit phone number to whatever you wish cell.println("ATD4155551212"); firstTimeInOtherLoop = 0; } }
To receive a voice call upload the following code
//**********************************************************************************
// ANSWER A CALL // // BUFFERING CODE BASED UPON: // // // ****************************************************** ************************************ #include #define BUFFSIZ 90 // Teeb tsa qhov tsis sib xws char at_buffer [BUFFSIZ]; char buffidx; // Network xeev hloov pauv int network_registered; int network_AT_ready; // Code state variables int firstTimeInLoop = 1; int firstTimeInOtherLoop = 1; tus x; // Yuav tuav tus cim tuaj ntawm Serial Port. char cov khoom nkag = 0; // Tsim qhov 'fake' serial chaw nres nkoj. Tus pin 2 yog tus pin Rx, tus pin 3 yog tus pin Tx. SoftwareSerial ntawm tes (2, 3); void teeb () {// Pib Arduino cov chaw nres nkoj rau kev debugging. Serial.begin (9600); // Pib qhov chaw nres nkoj virtual sib tham los tham nrog Xov Tooj. cell.begin (9600); // Nyob zoo ntiaj teb. Serial.println ("Pib SM5100B Kev Sib Txuas …"); ncua (1000); // Teeb tsa thawj lub xeev network network_registered = 0; network_AT_ready = 0; } // Nyeem AT cov hlua los ntawm daim npog tiv thaiv cellular tsis muaj dab tsi readATString (tsis muaj dab tsi) {char c; buffidx = 0; // pib ntawm begninning rau (x = 0; x 0) {c = cell.read (); yog (c == -1) {at_buffer [buffidx] = '\ 0'; rov qab; } yog (c == '\ n') {txuas ntxiv; } yog ((buffidx == BUFFSIZ - 1) || (c == '\ r')) {at_buffer [buffidx] = '\ 0'; rov qab; } at_buffer [buffidx ++] = c; }}} // Txheej txheem AT cov hlua tsis muaj txheej txheem ProcessATString () {yog (strstr (at_buffer, "+SIND: 8")! = 0) {network_registered = 0; Serial.println ("Network Network Tsis Muaj"); } yog (strstr (at_buffer, "+SIND: 11")! = 0) {network_registered = 1; Serial.println ("Network tau sau npe"); } yog (strstr (at_buffer, "+SIND: 4")! = 0) {network_AT_ready = 1; Serial.println ("network AT Ready"); }} void loop () { / * Yog hu ua thawj zaug, voj kom txog thaum network thiab AT npaj tau * / yog (firstTimeInLoop == 1) {firstTimeInLoop = 0; thaum (network_registered == 0 || network_AT_ready == 0) {readATString (); Txheej TxheemATString (); }} yog (firstTimeInOtherLoop == 1) {// Nrhiav kev hu tuaj yog (strstr (at_buffer, "+CPAS: 3")! = 0) {// Teb xov tooj cell.println ("ATA"); firstTimeInOtherLoop = 0; }}}
Koj puas pom qhov no muaj txiaj ntsig, lom zem, lossis lom zem? Ua raws @madeineuphoria kom pom kuv cov phiaj xwm tshiab kawg.
Pom zoo:
Teeb Duab Neeg Hlau Nrog Adafruit Shield (Ua Kom Nws Sib Tw): 10 Kauj Ruam (nrog Duab)
Teeb Duab Neeg Hlau Nrog Adafruit Shield (Ua Kom Nws Sib Tw): Nyob zoo kuv lub npe Jacob thiab kuv nyob hauv tebchaws Askiv. Hauv qhov haujlwm no kuv yuav tsim tus neeg hlau uas kos rau koj. *Kuv paub tseeb tias ntau tus ntawm koj xav pom nws yog li yog koj xav paub thov hla mus rau txoj cai thib ob mus rau kauj ruam kawg tab sis nco ntsoov rov qab los ntawm no kom pom
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
DS18B20 Shield Shield: 10 Kauj Ruam (nrog Duab)
DS18B20 Cov Khoom Siv Hluav Taws Xob: Nov yog qhov qhia me me. Qhov thaiv hluav taws xob no yuav siv rau hauv kuv qhov kev qhia "Arduino Weathercloud Weather Station". Lub hnub ci thaiv hluav taws xob tiv thaiv yog ib qho khoom siv ntau hauv cov chaw ntsuas huab cua txhawm rau thaiv ncaj qha tshav ntuj thiab yog li
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: Nov yog txoj hauv kev yooj yim heev thiab tus nqi qis mus rau cov duab thav duab digital - nrog qhov zoo ntawm kev ntxiv /tshem cov duab hla WiFi ntawm 'nyem thiab luag' siv (pub dawb) xa cov ntaub ntawv . Nws tuaj yeem siv tau los ntawm qhov me me £ 4.50 Pi Zero. Koj tseem tuaj yeem hloov pauv
DIY Multi-Purpose Robot Base thiab Shield Shield: 21 Cov Kauj Ruam (nrog Duab)
DIY Multi-Purpose Robot Base thiab Motor Shield: Nyob zoo txhua tus, tsis ntev los no kuv tau pib ua haujlwm ntawm cov phiaj xwm neeg hlau siv Arduino. Tab sis kuv tsis muaj lub hauv paus tsim nyog los ua haujlwm, qhov kawg tshwm sim tsis zoo thiab tsuas yog qhov kuv pom tau yog tag nrho kuv cov khoom cuam tshuam nrog cov xov hlau. Teeb meem tua ib qho er