Taillieu.Info

More Than a Hobby..

Arduino - GSM - SIM900 - PhoneCall

Port open

initialize the lcd

Make Voice Call

LogOn using PIN=1360

initialize the lcd

Make Voice Call

LogOn using PIN=1360

AT%13%

0 9>AT%13%%13%%10%OK%13%%10%

AT+CPIN=1360%13%

9 28>AT+CPIN=1360%13%%13%%10%OK%13%%10%

AT+CGREG?%13%

28 59>AT+CGREG?%13%%13%%10%+CGREG: 0,0%13%%10%%13%%10%OK%13%%10%

AT+CGREG?%13%

59 90>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%

AT+CGREG?%13%

90 7>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%%13%%10%Call Ready%13%%10%

AT+CGREG?%13%

7 38>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%

AT+IFC=1,1%13%

38 55>AT+IFC=1,1%13%%13%%10%OK%13%%10%

AT+CMGF=1%13%

55 71>AT+CMGF=1%13%%13%%10%OK%13%%10%

AT+CLIP=1%13%

71 87>AT+CLIP=1%13%%13%%10%OK%13%%10%

ATE0%13%

87 98>ATE0%13%%13%%10%OK%13%%10%

AT+COLP=1%13%

98 104>%13%%10%OK%13%%10%

GSM initialized.

Enter phone number to call.

 


Port open

initialize the lcd

Make Voice Call

LogOn using PIN=1360

AT%13%

0 6>%13%%10%OK%13%%10%

AT+CPIN=1360%13%

6 15>%13%%10%ERROR%13%%10%

Not connected

LogOn using PIN=1360

AT%13%

15 21>%13%%10%OK%13%%10%

AT+CPIN=1360%13%

21 30>%13%%10%ERROR%13%%10%

Not connected

LogOn using PIN=1360

AT%13%

30 36>%13%%10%OK%13%%10%

AT+CPIN=1360%13%

36 45>%13%%10%ERROR%13%%10%

Not connected

 


57 103>%13%%10%RING%13%%10%%13%%10%+CLIP: "+32473990345",145,"",,"",0%13%%10%

103 21>%13%%10%RING%13%%10%%13%%10%+CLIP: "+32473990345",145,"",,"",0%13%%10%

21 35>%13%%10%NO CARRIER%13%%10%


 

Port open

initialize the lcd

Make Voice Call

LogOn using PIN=1360

AT%13%

0 109>%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%254%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%0%%254%%255%%255%%255%%255%%255%%255%%255%%255%%13%%10%RDY%13%%10%%13%%10%+CFUN: 1%13%%10%%13%%10%+CPIN: SIM PIN%13%%10%

Not connected

LogOn using PIN=1360

AT%13%

109 118>AT%13%%13%%10%OK%13%%10%

AT+CPIN=1360%13%

118 9>AT+CPIN=1360%13%%13%%10%OK%13%%10%

AT+CGREG?%13%

9 40>AT+CGREG?%13%%13%%10%+CGREG: 0,0%13%%10%%13%%10%OK%13%%10%

AT+CGREG?%13%

40 71>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%

AT+CGREG?%13%

71 116>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%%13%%10%Call Ready%13%%10%

AT+CGREG?%13%

116 19>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%

AT+IFC=1,1%13%

19 36>AT+IFC=1,1%13%%13%%10%OK%13%%10%

AT+CMGF=1%13%

36 52>AT+CMGF=1%13%%13%%10%OK%13%%10%

AT+CLIP=1%13%

52 68>AT+CLIP=1%13%%13%%10%OK%13%%10%

ATE0%13%

68 125>ATE0%13%%13%%10%OK%13%%10%%13%%10%RING%13%%10%%13%%10%+CLIP: "+32473990345",145,"",,"",0%13%%10%

 

125 43>%13%%10%RING%13%%10%%13%%10%+CLIP: "+32473990345",145,"",,"",0%13%%10%

 

43 57>%13%%10%NO CARRIER%13%%10%

 

 


/*

 Make Voice Call

 

 This sketch, for the Arduino GSM shield, puts a voice call to

 a remote phone number that you enter through the serial monitor.

 To make it work, open the serial monitor, and when you see the

 READY message, type a phone number. Make sure the serial monitor

 is set to send a just newline when you press return.

 

 Circuit:

 * GSM shield

 * Voice circuit.

 With no voice circuit the call will send nor receive any sound

 

 created Mar 2014

 by Francis Taillieu

 

 This example is in the public domain.

 */

 

// libraries

 

#include <Wire.h>

#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library

#include <GSM.h>

 

/*-----( Declare Constants )-----*/

#define I2C_ADDR    0x27  // Define I2C Address for the PCF8574A 

//---(Following are the PCF8574 pin assignments to LCD connections )----

// This are different than earlier/different I2C LCD displays

#define BACKLIGHT_PIN  3  //7

#define En_pin  2  //4

#define Rw_pin  1

#define Rs_pin  0  //6

#define D4_pin  4  //0

#define D5_pin  5  //1

#define D6_pin  6  //2

#define D7_pin  7  //3

/*-----( Declare objects )-----*/  

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,BACKLIGHT_PIN,POSITIVE ); //NEGATIVE, POSITIVE

 

 

#define pinBusyLed13

#define BusyLed_ON digitalWrite( pinBusyLed, HIGH ) // Turn of BusyLED

#define BusyLed_OFF digitalWrite( pinBusyLed, LOW ) // Turn on BusyLED

 

// PIN Number

#define PINNUMBER "1360"

 

// initialize the library instance

GSM gsmAccess(true); // include a 'true' parameter for debug enabled

GSMVoiceCall vcs;

 

String remoteNumber = "0473990345";  // the number you will call

char charbuffer[20];

 

void setup()

{

  // initialize serial communications and wait for port to open:

  Serial.begin(9600);

  while (!Serial) {

    ; // wait for serial port to connect. Needed for Leonardo only

  }

 

  // initialize the digital pin as an output.

  pinMode(pinBusyLed, OUTPUT); 

  BusyLed_ON ;

 

// initialize the lcd   

  Serial.println ("initialize the lcd");  

  lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines, turn on backlight

// Reset the display  

  lcd.clear();

  lcd.noBacklight();

  delay(100);

  lcd.home();

  lcd.backlight();// ------- Quick blinks of backlight  -------------

 

 

//-------- Write characters on the display ------------------

// NOTE: Cursor Position: (CHAR, LINE) start at 0  

  lcd.setCursor(0,0); //Start at character 4 on line 0

  Serial.println("Make Voice Call");

  lcd.print("Make Voice Call");

 

  // connection state

  boolean notConnected = true;

 

  // Start GSM shield

  // If your SIM has PIN, pass it as a parameter of begin() in quotes

  while (notConnected)

  {

    Serial.print("LogOn using PIN=");

Serial.println( PINNUMBER );

    if (gsmAccess.begin(PINNUMBER) == GSM_READY)

      notConnected = false;

    else

    {

      Serial.println("Not connected");

      delay(1000);

    }

  }

 

  Serial.println("GSM initialized.");

  Serial.println("Enter phone number to call.");

 

  BusyLed_OFF ;

 

}

 

void loop()

{

 

  // add any incoming characters to the String:

  while (Serial.available() > 0)

  {

    char inChar = Serial.read();

    // if it's a newline, that means you should make the call:

    if (inChar == '\n')

    {

      // make sure the phone number is not too long:

      if (remoteNumber.length() < 20)

      {

        // let the user know you're calling:

        Serial.print("Calling to : ");

        Serial.println(remoteNumber);

        Serial.println();

 

        // Call the remote number

        remoteNumber.toCharArray(charbuffer, 20);

 

 

        // Check if the receiving end has picked up the call

        if (vcs.voiceCall(charbuffer))

        {

          Serial.println("Call Established. Enter line to end");

          // Wait for some input from the line

          while (Serial.read() != '\n' && (vcs.getvoiceCallStatus() == TALKING));

          // And hang up

          vcs.hangCall();

        }

        Serial.println("Call Finished");

        remoteNumber = "";

        Serial.println("Enter phone number to call.");

      }

      else

      {

        Serial.println("That's too long for a phone number. I'm forgetting it");

        remoteNumber = "";

      }

    }

    else

    {

      // add the latest character to the message to send:

      if (inChar != '\r')

        remoteNumber += inChar;

    }

  }

}