SIM900A GSM Module & Arduino: Sending/Receiving SMS & Making Calls Using AT Commands.

by technolabelectronics in Circuits > Arduino

2265 Views, 32 Favorites, 0 Comments

SIM900A GSM Module & Arduino: Sending/Receiving SMS & Making Calls Using AT Commands.

CALL-3.jpg
CALL-4.jpg

If you love DIY electronics, you’ve probably heard about Arduino. It’s a fun and simple way to get into robotics and programming. But did you know you can also use it to send text messages and make phone calls? That’s right! With a little help from a GSM module (like the kind in your cellphone), you can start sending messages and calling from your Arduino project. This article will show you how, step by step. Whether you’re making a smart mailbox, a home alarm system, or just want to learn something new, this guide has got you covered.

Supplies

Screenshot (67).png
Screenshot (68).png
IMG_9230.jpg

What You Need.

  • Arduino Board: Any kind will work, but most people use an Arduino Uno, Mega, or Leonardo.
  • GSM Module: SIM900 or SIM800 are good choices.
  • SIM Card: A regular SIM card with a call and text plan.
  • Connecting Wires: To establish connections between the Arduino and the GSM module.
  • Power Supply: Ensure both the Arduino and GSM module are adequately powered.


Understanding 2G Network Compatibility.

Screenshot (65).png
  • 2G Module: The SIM900A is a 2G GSM module. This means it’s designed to work primarily on the 2G network. It’s important to highlight this because not all cellular networks support 2G.
  • Choosing the Right SIM Card: In India, most telecom companies provide multi-generation services (2G, 3G, 4G, and even 5G). However, not all SIM cards are suitable for the SIM900A module.
  • Jio’s Network: Notably, Jio, one of India’s major telecom providers, does not offer 2G services. Jio’s network is based on 4G LTE technology, and as a result, SIM cards from Jio are incompatible with 2G-only modules like the SIM900A.
  • Alternative Service Providers: For your Arduino project to work seamlessly with the SIM900A module, you must choose a SIM card from a service provider that still supports 2G networks. In India, this includes providers like Airtel, Vodafone-Idea, and BSNL, which offer 2G services alongside their 3G, 4G, and 5G services.
  • Why 2G Matters: The reason why this is crucial is because of the technology used in modules like SIM900A. These modules were designed during a time when 2G was the standard for mobile communications. While technology has since progressed to 3G, 4G, and 5G, these older modules remain limited to 2G.
  • Future Considerations: As technology advances and more emphasis is placed on newer networks like 4G and 5G, the availability of 2G networks might decrease. This is an important consideration for long-term projects or products.

Power Supply Considerations for SIM900A

Screenshot (66).png
  1. Understanding Power Needs: GSM modules, including the SIM900A, can be sensitive to power supply fluctuations. Their power consumption varies based on network signal strength and the operations they are performing (like sending an SMS or making a call).
  2. SIM900A Specifications: According to its datasheet, the SIM900A module operates efficiently on a 12V, 2A power supply. This specification is critical for the module’s performance and longevity.
  3. Why Correct Voltage and Current are Important:
  • Stability: GSM modules transmit and receive data, which requires bursts of power, especially in areas with poor network reception. An inadequate power supply can lead to module instability or failure to perform tasks.
  • Safety: Using the wrong power specifications not only risks the module’s functionality but also can damage the module or connected components.
  • Checking the Datasheet: Always consult the datasheet of the GSM module for precise power requirements. The datasheet is the most reliable source for technical specifications and will provide guidance on the optimal operating conditions.
  1. Power Supply Options:
  • Dedicated Power Source: Given the power requirements, a dedicated power supply that can deliver a stable 12V and 2A is recommended for the SIM900A.
  • Avoiding USB Power: While some smaller modules can be powered via USB, the SIM900A’s requirements exceed what standard USB ports can provide. Therefore, relying on USB for power is not advisable.
  1. Monitoring Power Delivery: In your project, include a means to monitor the power supply to the GSM module. This can be through voltage regulators or by using Arduino to detect and respond to power fluctuations.

Connections.

Screenshot (69).png

Make the connections as per the Above connection diagram.


What Is AT Commands.

Screenshot (70).png

AT Commands, short for Attention Commands, are a set of instructions used to control modems. Originating in the early days of computer telecommunications, these commands provide a standard language for modems and other communication devices to interpret and execute commands. Here’s a general overview:


1.History: AT Commands were initially developed for the Hayes Smartmodem 300 in the early 1980s. They have since become a standard for controlling modems.


2.Syntax: The commands typically start with the prefix “AT” (which stands for Attention) to get the modem’s attention. Following this prefix are various commands that instruct the modem what to do. For example, “ATD” followed by a phone number would instruct the modem to dial that number.

Types of Commands:

  •   Basic Commands: These are general commands, such as “ATD” for dial, “ATA” for answer, and “ATH” for hang up.
  •   Extended Commands: These are more specific and can control various modem parameters or return information about the modem’s status.
  •   Manufacturer-Specific Commands: Different modem manufacturers may implement additional custom commands for advanced features specific to their products.

 4.Uses: While originally designed for dial-up modems, AT commands have found uses in a variety of other telecommunications devices. For instance, they are widely used in GSM and GPRS modems and devices for sending SMS messages, making calls, or accessing internet services.


5.Execution: The commands can be executed via a serial interface (RS-232), over a network, or even within a system (like a computer or a mobile device) depending on the device and its capabilities.


6.Modern Relevance: Even though dial-up modems have largely become obsolete with the advent of broadband internet, AT commands are still relevant in areas like IoT (Internet of Things), where they are used to control and configure GSM/GPRS modules and other telecommunication devices.

Code.

Click here to download the code and click here for line by line explanation of code.

#include <SoftwareSerial.h>

int i;
SoftwareSerial mySerial(9, 10);

void setup()
{
  mySerial.begin(9600);   // Setting the baud rate of GSM Module  
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(100);
}


void loop()
{
  if (Serial.available()>0)
   switch(Serial.read())
  {
    case 's':
     Serial.println("Sending text Message through GSM Module");
     mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
     delay(1000);  // Delay of 1 second
     mySerial.println("AT+CMGS=\"+918543053029\"\r"); // Replace x with mobile number
     delay(1000);
     mySerial.println("Hello from GSM Module");// The SMS text you want to send
     delay(100);
     mySerial.println((char)26);// ASCII code of CTRL+Z for saying the end of sms to  the module 
      delay(1000);
      break;

     case 'r':
      mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
      delay(1000);
      break;

      case 'c':
      if(i==0)//i variable to ensure that only one call request will be sent by gsm during pressing and holding the pushbutton;
        {
          Serial.println("Calling through GSM  Module");
          delay(1000);
          mySerial.println("ATD8543053029;"); // ATDxxxxxxxxxx; semicolon should be at the last ;AT command that follows UART protocol;
          Serial.println("Calling 8543053029");
          delay(1000);
          i++;
         }
   i=0;
      
      break;
  }

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

Testing It Out

Screenshot (71).png
Screenshot (73).png
  • Upload Your Code: Put your Arduino code onto the board.
  • Try Sending Texts and Making Calls: Use the Serial Monitor on your computer to send commands for texts and calls.


NextPCB: Your One-Stop Solution for PCB Manufacturing and Assembly.

IMG_9377.jpg
IMG_9378.jpg

NextPCB: Your One-Stop Solution for PCB Manufacturing and AssemblyThis project is successfully completed because of the help and support from NextPCB -Reliable Multilayer PCB Manufacturer. NextPCB is one of the most experienced PCB manufacturers in Global, has specialized in the PCB and assembly industry for over 15 years.

Unmatched Reliability and Quality


NextPCB prides itself on offering high-reliability PCB solutions. With over 15 years of in-house fabrication expertise, they guarantee 100% quality on their products, promising to remake them free of charge if any issues arise. Their commitment to quality is reflected in their impressive 99.6% on-time delivery rate, ensuring that your projects adhere to the stipulated timelines without any hitches.

Comprehensive Services

PCB Manufacturing

NextPCB specializes in manufacturing a wide variety of PCBs, including:

  • Ceramic PCB
  • Metal Core PCB
  • Aluminum PCB
  • LED PCB
  • Flexible PCB
  • Rigid-flex PCB
  • Thick Copper PCB
  • High TG PCB
  • High-frequency PCB
  • HDI PCB

Their manufacturing process utilizes high-end materials and equipment sourced globally, including Taiwanese electroplating lines and German flying probe testers, ensuring the production of durable and efficient PCBs.

Free PCB Assembly Services

In a bid to support engineers and enthusiasts in their endeavors, NextPCB offers free PCB assembly services, allowing individuals and businesses to experience reliable PCB assembly from NextPCB without any cost. This initiative stands as a testament to NextPCB's commitment to fostering innovation and supporting the PCB community.

Conclusion.

Screenshot (74).png

Combining Arduino with a GSM module is a fantastic way to add communication to your projects. You can make things like a gadget that tells you when you have mail, or a home security system that calls you if something’s wrong. It’s not just fun – you’ll learn a lot about electronics and programming too. Remember, this is just the beginning. There’s so much more you can do with Arduino and GSM!

Video Tutorial.

SIM900A GSM Module &amp; Arduino: Sending/Receiving SMS &amp; Making Calls Using AT Commands | NextPCB.