Introduction

With the blooming development of IoT (Internet of Things), more and more people are dedicated to pursue their own IoT dreams. However traditional IoT technologies are mainly evolved on the basis of Wi-Fi features, which leads to a barrier of development related to Geo-limitations that IoT projects cannot be implemented in to outdoor. In light of the popularity of bike-shared system, GSM Data Communication has been reconsidered as the best choice for outdoor IoT solution. The Gravity: A6 GSM & GPRS Module is a new GSM & GPRS communication module presented by DFRobot. Differ from traditional IoT developing modules, Gravity: A6 GSM & GPRS Module enables its functions depend on GSM instead of Wi-Fi. It can make a call and send text message with a small and portable GSM SIM card. This technological advantage expand the space of IoT application area, especially for the outdoor scene. In addition, you can DIY a telephone with a 3.5mm headphone port; it also works well in different situations with onboard 1500uF electrolytic capacitor and without any external power supplies even in the instantaneous high current . The module Uart port level is only 2.8V, which means it is compatible with Arduino, Raspberry-Pi and other controllers.

NOTE:
Please plug in a standard SIM card in this module. Users of Micro-SIM and Nano-SIM should use a card set.
Only support GSM Network.

Specification

Board Overview

Gravity: UART A6 GSM & GPRS Module Overview

Num Label Description
1 TX TX (2.8V HIgh Level)
2 RX RX
3 GND GND
4 VCC Power + (5V)

Arduino GSM & GPRS Tutorial

In this tutorial, we'll use Arduino UNO Software Serial Port to connect A6 GSM & GPRS module

Requirements

Connection Diagram

Arduino A6 GSM & GPRS Module Connection

GSM initialization

#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 10);  // TX-Pin11, RX-Pin10
void updateSerial()
{
  delay(2000);
  while (Serial.available()) {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }

}

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop()
{
  mySerial.println("AT");          //Once the handshake test is successful, it will back to OK
  updateSerial();

  mySerial.println("AT+CSQ");      //Signal quality test, value range is 0-31, 31 is the best
  updateSerial();

  mySerial.println("AT+CCID");    //Read SIM information to confirm whether the SIM is plugged
  updateSerial();

  mySerial.println("AT+CREG?");    //Check whether it has registered in the network
  updateSerial();

  mySerial.println("AT+SNFS=0");  //Adjust to earphone mode(AT+SNFS=1 is microphone mode)
  updateSerial();

  mySerial.println("AT+CRSL=2");  //Adjust volume, volume range is 0-15, maximum:15
  updateSerial();

  while(1)
  {
    if(mySerial.available())
    {
      Serial.write(mySerial.read());   //Forward what Software Serial received to Serial Port
    if(Serial.available())
    {
      mySerial.write(Serial.read());  //Forward what Serial received to Software Serial Port
    }
  }
}
}

Aduino A6 GSM & GPRS Module Initialization

Make a Phone Call

Aduino A6 GSM & GPRS Module Make a Phone Call

Send SMS

#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 10);  // TX-Pin11, RX-Pin10
void updateSerial()
{
  delay(2000);
  while (Serial.available()) {
    mySerial.write(Serial.read());//Data received by Serial will be outputted by mySerial }
  while(mySerial.available()) {
    Serial.write(mySerial.read());//Data received by mySerial will be outputted by Serial }

}

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop()
{
  mySerial.println("AT");          // Once the handshake test is successful, it will back to OK

  updateSerial();
  mySerial.println("AT+CMGF=1");   // Configuring mode is TEST, only English texts are available
  updateSerial();
  mySerial.println("AT+CMGS=\"xxxxxxxxxxx\"");//xxxxxxxxxxx is the phone number
  updateSerial();
  mySerial.print("Hello, this is a test"); //text content
  updateSerial();
  mySerial.write(26);
  while(1)
  {
    if(mySerial.available())
    {
      Serial.write(mySerial.read());//Data received by mySerial will be outputted by Serial }
    if(Serial.available())
    {
      mySerial.write(Serial.read());//Data received by Serial will be outputted by mySerial }
  }
}

Aduino A6 GSM & GPRS Sending SMS

GPRS Application

#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 10);  // TX-Pin11, RX-Pin10
void updateSerial()
{
  delay(2000);
  while (Serial.available()) {
    mySerial.write(Serial.read());//Data received by Serial will be outputted by mySerial
  }
  while(mySerial.available()) {
    Serial.write(mySerial.read());//Data received by mySerial will be outputted by Serial}
}

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop()
{
  mySerial.println("AT");          // Once the handshake test is successful, it will back to OK
 updateSerial();
  mySerial.println("AT+CGATT=1 "); //The basic adhere network command of Internet connection
  updateSerial();
  mySerial.println("AT+CGDCONT=1,\"IP\",\"CMNET\"");//Set PDP parameter
  updateSerial();
  mySerial.println("AT+CGACT=1,1");//Activate PDP; Internet connection is available after successful PDP activation
  updateSerial();
  mySerial.println("AT+CIFSR");//Get local IP address
  updateSerial();
  mySerial.println("AT+CIPSTART=TCP,www.baidu.com,80");// Connect to the server then the server will send back former data
  updateSerial();
  updateSerial();
  delay(2000);
  updateSerial();
  mySerial.println("AT+CIPSEND");// Send data request to the server
  updateSerial();
  mySerial.print("TEST");// Send data to the server
  updateSerial();
  mySerial.write(26);// Terminator
  while(1)
    {
    if(mySerial.available())
    {
      Serial.write(mySerial.read());//Data received by mySerial will be outputted by Serial
    }
    if(Serial.available())
    {
      mySerial.write(Serial.read());//Data received by Serial will be outputted by mySerial
    }
  }
}

Aduino A6 GPRS Application

AT Commands

Requirements

Connection Diagram

AT Command A6 GSM & GPRS Module Connection

GSM Initialization

AT GSM Initialization

Make a Phone Call

Make a Phone Call

Send SMS

Send SMS

GPRS Application

AT Command GPRS

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Gravity: UART A6 GSM & GPRS Module from DFRobot Store or DFRobot Distributor.

Turn to the Top