Tuesday, March 29, 2022

Design of GPRS Communication System Based on GR47 Module and PIC18f6720 MCU

GPRS network not only has the advantages of wide coverage, fast data transmission speed, high communication quality, always-on-line and traffic-based charging, etc., but also it is a packet data network, supports TCP/IP protocol, and can directly communicate with the Internet. Therefore, CPRS has unparalleled cost-effective advantages in wireless Internet access, portable environmental monitoring, traffic monitoring, mobile office and other industries.

GPRS (General Packet Radio Service) is a set of wireless transmission methods developed using the concept of packet switching. The GPRS network is based on the existing GSM (Global System for Mobile Communications) network. In the existing GSM network, some nodes need to be added, such as GGSN (GPRS gateway support node) and SGSN (GPRS service support node). The main function of the SGSN is to record the current location information of the mobile terminal, and complete the transmission and reception of mobile packet data between the mobile terminal and the GGSN. GGSN mainly acts as a gateway and can be connected with a variety of different data networks, such as ISDN (Integrated Services Digital Network), PSPDN (Packet Switched Public Data Network) and LAN (Local Area Network). The GGSN can carry out protocol conversion on the GPRS packet data packets in the GSM network, so as to transmit these packet data packets to the remote TCP/IP or X.25 network.

GPRS network not only has the advantages of wide coverage, fast data transmission speed, high communication quality, always-on-line and traffic-based charging, etc., but also it is a packet data network, supports TCP/IP protocol, and can directly communicate with the Internet. Therefore, CPRS has unparalleled cost-effective advantages in wireless Internet access, portable environmental monitoring, traffic monitoring, mobile office and other industries.

1 GPRS communication system hardware design

The system adopts Sony Ericsson’s GPRS communication module GR47 and PIC18f6720 single chip embedded with TCP/IP protocol stack. Both serial ports support RS-232 communication standard.

The core design lies in the connection between the microcontroller and the GR47 and the writing of the software. The PIC18f6720 microcontroller has two USARTs (Universal Asynchronous Serial Interface), one of which is connected to the GR47 module for data and AT command transmission; the other is connected to the serial port of the terminal chip to communicate with the terminal. An antenna needs to be installed outside the GR47 module. As shown in Figure 1.

The PIC18F6720 single-chip microcomputer controls the GR47 module to send and receive data, and the interrupt of the serial port is used in the software to realize sending and receiving data and forwarding data.

Design of GPRS Communication System Based on GR47 Module and PIC18f6720 MCU

1.1 Introduction to PICl8F6720

1.2 Introduction to GR47

GR47 is a dual-band GSM900/GSM=1800 communication module produced by Sony Ericsson. On the basis of this module, GPRS data transmission can be carried out, and it has functions such as supporting short message services. Powered by 3.6 V voltage; a variety of external interfaces can be provided, such as antenna interface, analog audio interface, asynchronous serial interface, SIM card interface, etc., and I2C communication is also supported; the TCP/IP protocol stack is integrated inside, so using this chip will Greatly reduces the difficulty of microcontroller programming.

There are not many GR47 ports used in this solution. The following descriptions are given for several key connection points:

a) Serial port TD: connect to RX2 of MCU, RD to TX2 of MCU.

b) DSR pin: DataSetReady, indicating that the module is ready to receive data, this pin is connected to RB0 of the microcontroller through the triode switch circuit. DSR is high for data mode, low for command mode.

c) DTR pin: Data Terminal Ready, indicating that the terminal device is ready to receive data, and the data state and command state of GR47 can be switched by controlling the high and low time of this pin level. This pin is connected with the RF2 of the microcontroller through the triode switch circuit.

2 GPRS communication system software design

The system software is written in C language and compiled under MPLAB environment. Since the system is a module of the remote management terminal, certain protocols must be followed in the writing of the program, so as to ensure correct communication. The main body of the program is how to control the AT command of GR47 to initialize GR47 and process information data. The program can be divided into the following blocks in general: initial setting of CPRS connection, judgment processing of short messages, heartbeat processing when there is no data transmission, data judgment and forwarding, etc. The main program is to organically combine these program blocks, control each other, and loop infinitely. 2.1 Establishment of the connection

The realization process of connecting the GPRS module to the Internet and the GPRS network is as follows:

a) The MCU software controls the GR47 module to start up and waits for the module to start normally.

b) Through the serial port connected with the single-chip microcomputer and the GR47 module, write the corresponding AT setting command to the GR47 module for initialization, so that the module can successfully adhere to the GPRS network, obtain the dynamic IP address assigned by the network operator, and establish a connection with the destination terminal. .

2.2 Processing of data

The transmission of data packets in the data center server and GPRS server is based on IP data packets, but it is not advisable to transmit IP packets in plain text, so PPP (point-to-point protocol) is mostly used for transmission to realize the transparent transmission of data through the GPRS module and the Internet network. . The GR47 integrates the TCP/IP protocol stack, so the user does not need to write programs related to the IP protocol, and can directly transmit data through the GR47.

a) Data transmission between the module and the PC on the Internet: The PC is required to have an IP address of the public network, an open port, and a running software that monitors the transmitted messages. In this way, when the module and Internet transfer data, the message will be displayed. After the module is successfully connected to the network, as long as the single-chip microcomputer sends the data to be sent to the GR47 through the serial port, the GR47 will forward the data to the PC with the corresponding IP address.

b) Processing of short message data: GR47 has the function of GSM, which can send and receive short messages with mobile phones. The short message adopts the PDU format. In the program, it is necessary to judge the arrival of the short message and read the content of the short message, and perform the corresponding function according to the content, and finally construct the result into a PDU format and return it to the corresponding sender.

c) GPRS communication heartbeat information: After the network connection is established, when there is no data communication within the set period, the GPRS module sends heartbeat information to the data service center, and the data service center responds with a response signal after receiving the heartbeat information.

d) Storage of important data: In the program, some important common and variable data such as the IP address, port number, terminal address, SIM card number of the computer server are stored in the EEPROM of the microcontroller. Data can be read from or rewritten to EEPROM to set when needed.

2.3 Main program flow

The main program is composed of module functions, which are composed of basic functions nested. The main program flow is roughly as follows: First, initialize the setting variables of the microcontroller, which are generally 0; initialize the corresponding configuration unit of the microcontroller, such as setting the port direction, setting the interrupt priority, and initializing the timer, etc.; then the microcontroller controls the GR47. After the power is turned on successfully, check whether the network registration is successful; after the success, the connection between the module and the PC server can be established, and data transmission and short message processing can be performed; the heartbeat information in a certain format can be sent as needed. See Figure 2.

Design of GPRS Communication System Based on GR47 Module and PIC18f6720 MCU

3 Conclusion

This paper presents a realization scheme of embedded wireless data transmission terminal based on single chip microcomputer and GPRS module. The small-scale GPRS communication system centered on the single-chip application system has low cost, short design cycle and good portability, and is especially suitable for remote control and data transmission.

The Links:   PM800HSA120 2DI75D-050A

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.