AT Commands, Call and SMS using A7672S 4G GSM with Nuvoton Microcontroller

20.12.23 05:10 AM By AKB

                             AT Commands, Call and SMS using A7672S 4G GSM with Nuvoton Microcontroller

In the ever-evolving landscape of embedded systems and IOT, the integration of 4G GSM communication has become important for diverse applications. This article aims to provide a detailed tutorial on utilizing AT commands of the A7672S 4G GSM module with Nuvoton microcontroller. In this tutorial we will interface A7672S 4G GSM module with Nuvoton MS51FB 8051 and perform basic  AT commands, Calling and sending SMS.

Hardware Requirements

  1. Nuvoton MS51FB 8051

AT Commands, Call and SMS using A7672S 4G GSM with Nuvoton Microcontroller


  1. SIMCOM A7672S 4G GSM Module with SIM Card

                                                                                                                                      AT Commands, Call and SMS using A7672S 4G GSM with Nuvoton Microcontroller



  1. Connecting Wires


AT Commands, Call and SMS using A7672S 4G GSM with Nuvoton Microcontroller



  1. Bread Board


AT Commands, Call and SMS using A7672S 4G GSM with Nuvoton Microcontroller

Interfacing Nuvoton Microcontroller with SIM7672 4G GSM module:

GSM modules, such as the A7672S, come with a USART adapter that can be directly connected to a computer via a MAX232 module or via the Tx and Rx pins to a Nuvoton MS51FB 8051 . 

Other pins, such as MIC+, MIC-, SP+, SP-, and so on, can be used to connect a microphone or a speaker. A 12V adapter can be used to power the module through a standard DC barrel connector.


After completing the aforementioned steps, place the SIM card into the module's slot and turn it on; a power LED will light up. 

After a few moments, you should notice a red (or any other color) LED flashing once every three seconds. This indicates that your Module was successful in connecting to your SIM card.

You can also take reference from the circuit diagram given below to interface A7672S GSM module with Nuvoton MS51FB 8051:-

Also you can check here.

                                                                                           

How to Send AT Commands

After successfully interfacing the NUVOTON MS51FB 8051 with A7672S, upload the following code, so that you will be able to send A7672S AT commands using the Nuvoton controller and perform any Network Operations.


Code:

#include "NuMicro.h"

#define UART_PORT    UART0

#define UART_BAUDRATE 115200

void UART0_Init() {

 /* Enable peripheral clock */

 CLK_EnableModuleClock(UART0_MODULE);

 /* Select UART clock source */

 CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UART_MASK, CLK_CLKDIV_UART(1));

 /* Reset IP */

 SYS_ResetModule(UART0_RST);

 /* Configure UART0 and set UART0 Baudrate */

 UART_Open(UART_PORT, UART_BAUDRATE);

}

void SendATCommand(const char *command) {

 /* Send AT command through UART */

 int i;

 for (i = 0; command[i] != '\0'; i++) {

 UART_WRITE(UART_PORT, command[i]);

 while (UART_IS_TX_EMPTY(UART_PORT) == 0);

 }

}

int main() {

 /* Unlock protected registers */

 SYS_UnlockReg();

 /* Init System, peripheral clock and multi-function I/O */

 SYS_Init();

 /* Initialize UART0 for communication with SIM7672 */

 UART0_Init();

 /* Enable interrupt and set priority */

 NVIC_EnableIRQ(UART0_IRQn);

 NVIC_SetPriority(UART0_IRQn, (1 << __NVIC_PRIO_BITS) - 2);

 /* Lock protected registers */

 SYS_LockReg();

 /* Example: Sending AT command "AT\r\n" */

 SendATCommand("AT\r\n");

 while (1) {

 // Your main code here

 }

}

In this code, the UART0_Init function initializes the UART0 module, and the SendATCommand function sends the specified AT command through UART. The main function demonstrates sending the "AT\r\n" command, which is a basic AT command to test communication.

AT commands are sent to the modem as plain text over a serial (UART) connection comprising two wires, one for receive (RX) and one for transmit (TX), or via USB.

Now let’s start by sending the AT commands and understand their use

Basic A7672S AT Commands

1. AT - Attention Command:

AT

The fundamental command to check if the module is responsive.


2. AT+CGMI - Get Manufacturer Information:

AT+CGMI

Retrieve the manufacturer information of the SIM7600X module.


3. AT+CSQ - Check Signal Quality:

AT+CSQ

Check the signal quality to gauge the network connection strength.


4. AT+CREG? - Network Registration Status:

AT+CREG?

Check the network registration status to ensure the module is connected to a cellular network.


5. AT+CGATT? - Attach or Detach from GPRS:

AT+CGATT?

Determine whether the module is attached or detached from the GPRS network.

SMS Handling Commands

1. AT+CMGF - Set SMS Message Format:

AT+CMGF=1

Configure the SMS message format. Setting it to 1 enables text mode.


2. AT+CMGS - Send SMS:

AT+CMGS="+123456789"

Send an SMS to the specified phone number. Replace "+123456789" with the recipient's phone number.


3. AT+CMGL - List SMS Messages:

AT+CMGL="ALL"

List all SMS messages stored on the SIM card, providing details such as sender, timestamp, and message content.


4. AT+CMGR - Read SMS Message:

AT+CMGR=1

Read a specific SMS message by index. Replace 1 with the index of the desired message.

Call Handling Commands

1. ATD - Dial a Number:

```ATD+123456789;``` Initiate a call to the specified phone number. Replace "+123456789" with the recipient's phone number. 


2. ATH - Hang-Up Call:

```ATH``` Terminate an ongoing call. 


3. ATA - Answer Call:

```ATA``` Answer an incoming call.

Conclusion

Finally we have successfully performed AT commands operations through NUVOTON MS51FB 8051 and A7672S 4G GSM module, we also covered a wide range of functionalities from basic module information retrieval to advanced features like SMS handling,and call management. Further you should  refer to the Sim7672 module documentation for more AT commands for specific details and further optimizations.


If you're an IoT developer and need reliable electronic components, including the A7672S module, and other GSM modules from SIMCOM, consider exploring options at Campus Component. Also you can get a wide range of microcontrollers from Nuvoton. If you are looking for Best in standard GSM modems and Microcontrollers and other electronic components, reach out to Campus Component- electronic component supplier today!

Added to cart
- There was an error adding to cart. Please try again.
Quantity updated
- An error occurred. Please try again later.
Deleted from cart
- Can't delete this product from the cart at the moment. Please try again later.