Know the Procedure of GSM Modem Interfacing with 8051
The acronym of the GSM modem is Global System for Mobile Communications, it is a wireless communication module, used to make a computer or any processor to communicate over a network. This modem uses a variation of TDMA(Time Division Multiple Access) and is the most commonly used of the digital wireless telephony technologies like TDMA, GSM and CDMA.A GSM modem needs a SIM card to operate through a n/w range subscribed by the network operator. This modem can be connected to a computer via a serial, Bluetooth or USB connection. A GSM modem is also a standard GSM mobile phone with a suitable cable and software driver to connect to a USB port on your PC. Generally, this modem is preferred instead of a GSM mobile phone. This article describes how GSM modem interfacing with 8051 microcontroller.
GSM Modem Interfacing with 8051 Microcontroller
Nowadays, many projects like car security system, home automation, remote controlled industrial machines are controlled by an SMS using GSM modem. This modem uses a SIM card and operates through a subscription with the mobile operator. Many people they don’t know how GSM module interfacing with 8051 microcontroller. Therefore, the following steps explain the basics of how GSM modem interfacing with 8051 microcontroller.
Steps to Interfacing a GSM Modem to the Microcontroller
Step1: Arranging the GSM Modem
The GSM modem is a one type of modem, which uses the SIM card for communication. First, insert a SIM card into the modem which uses the same number/ account as the caller phone. It supports AT commands for handling the messages. These commands are programmed into the microcontroller ensures ending or receiving of the SMS from the modem.
For instance: Initializing commands for several types of modem are shown below
- Siemens: AT+CNMI=1,1,0,2,1
- WaveCom: AT+CNMI=2,1,0,1,1
- SonyEricsson: AT+CNMI=3,1,0,1,0
- Motorola USB modem: AT+CNMI=3, 1,0,0,0
- The modem is arranged to send notifications to the microcontroller upon receiving a new text.
- Arrange the modem port speed as a rule such as 9600 or 19200 bps baud rates.
Step2: GSM Modem Testing
The GSM modem comprises of two light emitting diodes like green and red LEDs, which are used for the network connection indication. If there is no network is available, then the red LED glows, and if a network is available, then the green LED glows so that one can observe the working of GSM modem. Connect a power supply to a GSM modem which contains a SIM card and wait till it registers in the GSM network. For the testing of the modem, you can send an SMS to the modem. If it receives the message from the mobile, it is working properly, or else it is damaged.
Step3: GSM Modem Interfacing with 8051 Microcontroller
GSM modem works with 12V DC and the microcontroller works with 5V. So, interfacing of this modem with microcontroller directly is not possible due to mismatch of voltage levels. GSM modem is interfaced with 8051 microcontroller through MAX232 with the help of RS232 cable for serial communication. MAX232 device is used to convert TTL logic level to RS232 level during serial communication of microcontroller to the GSM modem. The RS232 device is an interface between data terminal equipment and data communication equipment using serial binary data exchange. The RS232 cable is commonly available with the 9 or 25 pin wiring and has jumpers to provide handshaking pins for those devices that require it.
Step4: Microcontroller Programming
- Transmitting single character
- Transmitting word
- Receiving char
voidTx_Char(unsigned char ch);
voidTx_String(unsigned char *str);
TMOD|=0×20; //Timer 1 in mode 2 ( Auto Reload mode)
TH1=0XFD; //0xFD for 9600bps
SCON=0×50; //Enable TI and RI pins using Serial control Register
TR1=1; //Start Timer 1;
voidTx_Char(unsigned char ch)
SBUF=ch; // Load the character into SBUF register to transmit.
while(!TI); //wait for TI flag to raise high
TI=0; //clear TI for further transmission.
voidTx_String(unsigned char *str)
while(RI==1); //wait for RI flag to receive any character
Ch=SBUF; // capture the character from SBUF into Ch variable
RI=0; //clear RI flag for further reception
In addition to the above program,if an operator wants to make an SMS to any other persons mobile via microcontroller upon interrupt either from internal or external device, the operator can follow the below program.
For more detail: Know the Procedure of GSM Modem Interfacing with 8051
We recommend EasyEDA for electronic circuit design.
From Schematic Drawing to PCB Production, Just Need One Tool
Cheap PCB Prototype: 10 pcs 2 layers only $10, quick delivery, 100% E-test
Current Project / Post can also be found using:
- single digit counter using gsm modem