Saturday, January 17, 2015

Arduino Code for GSM Module basic program to find the network information

GSM Basic code to find the firmwire version, Network list, Network information, and baud rate. This uses the AT commands with the arduino command to communicate with the GSM module. I test these code with sim900a gsm module.

___________________________________________________________________________________

/*
Press--> a: AT Command.
f: To get Firmware Version.
l: To get List of Network.
i: To get Network Info.
v: To get VBAT voltage .
b: To get Baud rate Info.
*/

#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 8);

void setup()
{
  mySerial.begin(9600);               // the GPRS baud rate
  Serial.begin(9600);    // the GPRS baud rate
  delay(500);
}


void loop()
{
  if (Serial.available()>0)
   switch(Serial.read())
  {
    case 'a':
      AT();
      break;
    case 'i':
      Network();
      break;
    case 'f':
      FirmVersion();
      break;
    case 'l':
      NetworkList();
      break;
    case 'v':
      Battery();
      break;
    case 'b':
      Baud();
      break;
  }

 if (mySerial.available()>0)
   Serial.write(mySerial.read());
}

void AT()
{
  mySerial.println("AT");
  delay(100);
}

void Network()
{
  mySerial.println("AT+CSQ");
  delay(1000);

  mySerial.println("AT+COPS?");
  delay(1000);
}

void FirmVersion()
{
  mySerial.println("ATI");
  delay(100);
}

void NetworkList()
{
  mySerial.println("AT+COPS=?");
  delay(100);
}

void Battery()
{
  mySerial.println("AT+CBC");
  delay(100);
}

void Baud()
{
  mySerial.println("AT+IPR=0");
  delay(1000);
  mySerial.println("AT+IPR?");
  delay(100);
}

____________________________________________________________________________________



2 comments :

  1. LabVIEW software is ideal for any measurement or control system, and the heart of the NI design platform.
    Integrating all the tools that engineers and scientists need to build a wide range of applications in dramatically less time,
    LabVIEW is a development environment for problem solving, accelerated productivity, and continual innovation


    labview programming

    ReplyDelete
  2. A proper idea gives you positive result that you need to share a lifetime of your programming,
    we can give you some information on the importance labview programming,
    understanding, and reacting appropriately to your main idea.see more,

    labviewprogramming

    ReplyDelete