Arduino Cellular Shield Tutorial : 9 Steps (with Pictures) - kearnsdureal
Introduction: Arduino Cellular Shield Tutorial
The Arduino Cellular Shield allows you to make cellular phone calls, and transmi text messages. The brains of this shield is the SM5100B which is a robust cellular faculty capable of performing galore of the tasks of most standard cell phones. This shield requires use of a SIM placard to connect to a pitted network. The tutorial that follows is a bare castanets tutorial for initializing the harbor, and both sending and receiving text messages, and phone calls. To learn Thomas More about the module's functionality, be sure to check into the datasheets happening Sparkfun's product Thomas Nelson Page.
Step 1: Kick the bucket Get Stuff
You will need:
(x1) Cellular shield
(x1) Stackable Arduino headers
(x1) Space band aerial
(x1) Arduino Uno
(Note that some of the golf links on this page are affiliate links. This does not change the cost of the item for you. I reinvest whatever proceeds I receive into making new projects. If you would like any suggestions for option suppliers, please let me know.)
Measure 2: Solder Headers
Stick in the headers into the cuticle and solder them into place.
Step 3: Insert
Insert the header pins into the sockets on the Arduino.
Step 4: Resolder
The antenna cable's connection to the SM5100B mental faculty is usually not identical good. Resolder each of the cable's connections to the module to ensure connectivity.
Step 5: Impound the Antenna
Thread the antenna to the antenna cable.
Step 6: Insert SIM Card
Insert the SIM card firmly into the SIM card socket.
Step 7: Format
Unresolved the serial port in the terminal. Along a Mac this is accomplished by typing:
screen /dev/tty.usbmodemfa131 9600
(replace tty.usbmodemfa131 with your Arduino's serial address)
Delay to see the following sequence returned:Protrusive SM5100B Communicating...
+SIND: 3
+SIND: 4
+SIND: 11
(If this sequence is not returned check the error codes enrolled at the bottom of the code above, and debug appropriately. You may motivation to set the module for North American employment -- see below -- before it registers to net (i.e. +SIND 11))
Send the following commands to the serial port wine:
Send this for Continent employment:
AT+SBAND=7
Set the current fourth dimension - yy/mm/dd:
AT+CCLK="13/05/15,11:02:00"
Send test shout:
ATD4155551212
Step out 8: Text Messages
Download and install SerialGSM into your Arduino library.
To send a text message chitchat the Tronixstuff cellular module instructor and use example code 26.3:
http://tronixstuff.wordpress.com/2011/01/19/teacher-arduino-and-gsm-honeycombed-part-one/
If you would like to run the model code to receive a text, connect an LED to immobilise 8 and put off it in serial publication with a 220 ohm resistance to ground.
To send a text message visit the Tronixstuff cellular faculty tutorial and use example code 26.5:
HTTP://tronixstuff.wordpress.com/2011/01/19/tutorial-arduino-and-gsm-multicellular-part-one/
Textbook one of the following commands to your cellular module:
//turns the LED on
#a1
//turns the LED off
#a0
Step 9: Part
Link a microphone and speaker to the shield using grounded audio cable. The center point wire should attend the sound plus terminals and the shielding should go to the respective negative terminals on the shell. These cables should be connected similarly happening the microphone and speaker root.
To initialize a voice anticipate upload the following cypher:
<pre>//********************************************************************************** // MAKE A CALL // // BUFFERING CODE BASED UPON: // <a href="HTTP://jayeshprojects.blogspot.com/2010/04/real-clock-mobile-gps-tracker-with.html"> http://jayeshprojects.blogspot.com/2010/04/real-t...> // //********************************************************************************** #include <SoftwareSerial.h> #delineate BUFFSIZ 90 //Assemble buffer array char at_buffer[BUFFSIZ]; charwoman buffidx; //Meshing 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 Ordination Port. char incoming_char=0; //Create a 'fake' serial port. Pin 2 is the Rx tholepin, pin 3 is the Tx pin. SoftwareSerial cell(2,3); void setup() { //Initialize Arduino serial port for debugging. Serial.get(9600); //Initialize virtual serial port to talk to Phone. cell.begin(9600); //Hello World. Serial.println("Starting SM5100B Communication..."); hold up(1000); //Set initial network state network_registered = 0; network_AT_ready = 0; } //Learn AT strings from the cellular shield nothingness readATString(void) { char c; buffidx= 0; // set forth at begninning for (x = 0; x < 10000; x ++) { if(cell.on tap() > 0) { c=cell.study(); if (c == -1) { at_buffer[buffidx] = '\0'; tax return; } if (c == '\n') { continue; } if ((buffidx == BUFFSIZ - 1) || (c == '\r')){ at_buffer[buffidx] = '\0'; return; } at_buffer[buffidx++]= c; } } } //Process the AT strings invalidate ProcessATString() { if( strstr(at_buffer, "+SIND: 8") != 0 ) { network_registered = 0; Serial.println("electronic network Network Not Available"); } if( strstr(at_buffer, "+SIND: 11") != 0 ) { network_registered=1; Serial.println("meshing 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 telephone number to any you wish cell.println("ATD4155551212"); firstTimeInOtherLoop = 0; } } To receive a voice call upload the following code:
<pre>//********************************************************************************** // Response A CALL // // BUFFERING CODE BASED UPON: // <a href="http://jayeshprojects.blogspot.com/2010/04/echt-metre-mobile-gps-tracker-with.html"> http://jayeshprojects.blogspot.com/2010/04/real-t...> // //********************************************************************************** #let in <SoftwareSerial.h> #define BUFFSIZ 90 //Set dormy buffer array char at_buffer[BUFFSIZ]; char buffidx; //Network state variables int network_registered; int network_AT_ready; //Code commonwealth variables int firstTimeInLoop = 1; int firstTimeInOtherLoop = 1; int x; //Leave hold the designate character from the Serial Port. char incoming_char=0; //Create a 'faker' series port. Pin 2 is the Rx trap, pin 3 is the Tx pin. SoftwareSerial cell(2,3); quash setup() { //Initialise Arduino consecutive port for debugging. Serial.begin(9600); //Initialize virtual serial port to talk to Phone. cell.begin(9600); //Hello World. Serial.println("Protrusive SM5100B Communication..."); delay(1000); //Limit first network state network_registered = 0; network_AT_ready = 0; } //Scan AT strings from the living thing shield void readATString(annul) { cleaning lady c; buffidx= 0; // offse at begninning for (x = 0; x < 10000; x ++) { if(cell.available() > 0) { c=prison 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 string section 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("meshwork Registered"); } if( strstr(at_buffer, "+SIND: 4") != 0 ) { network_AT_ready=1; Ordination.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(); } } if(firstTimeInOtherLoop == 1){ //Depend for incoming call if( strstr(at_buffer, "+CPAS: 3") != 0 ) { //Answer the phone cell.println("ATA"); firstTimeInOtherLoop = 0; } } }
Did you find this useful, fun, or entertaining?
Follow @madeineuphoria to see my latest projects.
Be the First to Share
Recommendations
Source: https://www.instructables.com/Arduino-Cellular-Shield-Tutorial/
Posted by: kearnsdureal.blogspot.com

0 Response to "Arduino Cellular Shield Tutorial : 9 Steps (with Pictures) - kearnsdureal"
Post a Comment