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
Nuvoton MS51FB 8051
SIMCOM A7672S 4G GSM Module with SIM Card
Connecting Wires
Bread Board
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:-
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.
You May Also Like To Read : Difference Between 8051 Vs AVR Microcontrollers
Basic A7672S AT Commands
AT - Attention Command
AT command, fundamental command to check if the module is responsive.
AT+CGMI
AT+CGMI retrieve the manufacturer information of the SIM7600X module.
AT+CSQ
AT+CSQ Check the signal quality to gauge the network connection strength.
AT+CREG
AT+CREG Check the network registration status to ensure the module is connected to a cellular network.
AT+CGATT
AT+CGATT, Determine whether the module is attached or detached from the GPRS network.
SMS Handling Commands
AT+CMGF=1 Configure the SMS message format. Setting it to 1 enables text mode.
AT+CMGS
AT+CMGS="+123456789" send an SMS to the specified phone number. Replace "+123456789" with the recipient's phone number.
AT+CMGL
AT+CMGL="ALL" List all SMS messages stored on the SIM card, providing details such as sender, timestamp, and message content.
AT+CMGR
AT+CMGR=1 Read a specific SMS message by index. Replace 1 with the index of the desired message.
Call Handling Commands
ATD
```ATD+123456789;``` Initiate a call to the specified phone number. Replace "+123456789" with the recipient's phone number.
ATH
```ATH``` Terminate an ongoing call.
ATA
```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!