Design and Implementation of PLC Remote Communication Based on GSM Public Network
2026-04-06 05:29:10··#1
Introduction PLCs, as high-performance control devices, are increasingly widely used in distributed systems. In such control systems, PLCs can communicate with the host computer in various ways, such as directly using existing configuration monitoring software. However, for small-scale control systems, finding a high-performance, cost-effective communication method is of significant practical importance. This paper describes the implementation of communication between the FX2 programmable controller and the monitoring center from both software and hardware perspectives. With the rapid development of GSM mobile communication networks and the increasing number of users, the development and application of new technologies and services have become extremely important. Short Message Service (SMS), as a basic service of GSM networks, has received increasing attention from system operators and developers, and various applications based on this service have flourished. Previously, when problems occurred in unattended field locations, maintenance personnel could not quickly arrive to troubleshoot, causing many unnecessary losses. Therefore, the author designed this data acquisition and monitoring system, which sends alarm information to the centralized monitoring center via SMS, thereby realizing remote control, telemetry, remote adjustment, and remote communication. 1. System Working Principle and Composition This system mainly consists of two parts: a data acquisition and monitoring terminal; and a centralized monitoring center. The communication method uses SMS (Short Message Service), and the communication equipment uses the TC35 mobile phone module and the TC35T mobile phone terminal. The TC35 has the following functions: voice, data, SMS, and fax transmission modes; it operates within the GSM 900MHz and 1800MHz frequency bands; its operating power supply is 3.3V to -5.5V; its baud rate is 300bps-115kbps, with automatic baud rate setting between 1200bps and 115kbps; data transmission uses the AT command set; SMS has TEXT and PDU graphic modes; and PP data communication rates are 2400, 4800, 9600, and 14400bps. The TC35T integrates the TC35 into an industrial mobile phone, providing a standard RS232 interface and power interface. It can be used by directly connecting the computer's serial port to the TC35T's serial port with a cable and adding a standard modem to the computer. The TC35T operates using the AT command set. The system's principle block diagram is shown in Figure 1. The centralized monitoring center sends commands through channel 1. First, it sends a setup command via the TC35T to initialize the data acquisition and monitoring terminal, setting the analog and digital quantities to be acquired, setting the system password, and setting the mobile phone number of the maintenance personnel. Then, it sends an acquisition command to collect various data quantities. After the data is collected, it is processed by the PLC and sent to the centralized monitoring center via SMS through channel 2. The center then organizes and stores the data in the database. If the data acquisition and monitoring terminal malfunctions, it directly sends a fault message to the maintenance personnel's mobile phone via the TC35 module. Simultaneously, the monitoring center receives alarm information from the data acquisition and monitoring terminal and performs corresponding processing, such as determining the alarm location, alarm type, and corresponding cause; promptly notifying on-duty and relevant maintenance personnel; statistically analyzing the alarm information; and setting the alarm monitoring module configuration information. When the fault is cleared, the data acquisition and monitoring terminal also sends an SMS to the monitoring center to notify the center that the fault has been cleared and data acquisition can resume normally. Of course, each data acquisition and monitoring terminal is assigned to a maintenance personnel. Short Message Service (SMS) is a digital service provided to users by the GSM system. Like voice transmission and fax, it is a major telecommunications service offered by the GSM digital cellular mobile communication network. SMS sending and receiving utilizes the signaling channels of the GSM network, not the ordinary voice channels. It is bidirectional communication with a certain degree of interactive capability. Furthermore, SMS has high reliability; the sending user can know whether the SMS has reached the receiving user. Because SMS relies on the SMSC's storage and forwarding mechanism, when the receiving user's phone is off or out of service area, the SMSC temporarily stores the SMS. If the receiving user becomes active again within a specified time (usually 24 hours), the SMSC immediately sends the SMS back to the receiving user, returning an acknowledgment signal to the sending user upon successful transmission. SMS fully utilizes the wide coverage and network-wide advantages of the GSM network, offering excellent mobility, allowing any GSM wireless terminal user who has subscribed to SMS service to receive service throughout the entire network. Each short message is limited to 140 octets (7-bit encoding), which is 140 English characters or 70 Chinese characters. If this length is exceeded, it must be sent in multiple parts. 2. Hardware Circuit Design The system's hardware circuit includes: monitoring terminal hardware design; centralized monitoring center. The monitoring terminal hardware includes: data acquisition section; TC35 interface circuit; temperature sensor circuit; remote adjustment circuit. The centralized monitoring center hardware includes: host computer; TC35T mobile terminal. 2.1 Data Acquisition Section Data acquisition is divided into: analog quantity acquisition and digital quantity acquisition. Analog quantities are mainly acquired from various industrial instruments, such as pressure, flow rate, temperature, humidity, voltage, current, etc. Digital quantity detection includes: 220V AC voltage detection and access control detection. The circuit principle block diagram is shown in Figure 2. 2.2 Remote Adjustment Circuit Design In order to realize remote automatic adjustment of various field parameters, the author designed a remote adjustment circuit. A solid-state non-volatile digital potentiometer X9313 is used. The circuit diagram is shown in Figure 3. A digital potentiometer is a special type of DAC whose analog output is resistance, not voltage or current. The position of the slider is controlled by three input terminals: CS, U/D, and INC. When CS and INC are high, the slider position can be stored in a non-volatile memory and thus recalled upon the next power-on. When the potentiometer slider moves to a new position while INC is low and CS is high, this position is not stored. VH, VL, and VW are equivalent to the three terminals of a typical potentiometer. 2.3 Temperature Sensor Circuit Design To monitor the temperature changes of the data acquisition and monitoring terminal in real time, the author designed a temperature sensor circuit to activate the exhaust device when the temperature exceeds the upper limit and the heating device when the temperature falls below the lower limit. Since the acquired temperature range is within the normal temperature range, a transistor sensor LM335 is used. Its output voltage is proportional to the thermodynamic temperature, with a sensitivity of 10mV/°C. The output voltage is amplified by an LM358 amplifier before being sent to the A/D converter. The circuit diagram is shown in Figure 4. 2.4 TC35 Interface Circuit Design The TC35 module mainly consists of an RF antenna, internal FLASH memory, a GSM baseband processor, a matching power supply, and a 40-pin ZIP socket. The TC35 interface circuit design primarily involves the 40-pin cable interface with the microcontroller. As shown in Figure 5, pins 1-5 provide a 3.3-5.5V peak DC power supply of 2A; pins 6-10 are grounded; pin 15 is the ignition signal, connected to pin P1.7 of the microcontroller, allowing the module to be started via software. Pins 16-23 are the functional pins of the RS232 serial port; pins 18 and 19 are the transmit (RXD) and receive (TXD) pins, respectively. Pins 24-29 correspond to the SIM card pins. Pin 32 is the indicator light pin. When no SIM card is inserted, the 40-pin cable is not properly connected, or the module is joining a network, the indicator light flashes for 600ms and then turns off for 600ms; when the module is joining the network, the indicator light flashes for 75ms and then turns off for 3 seconds. 2.5 Level Converter Design The programming interface of the FX2 series PLC uses the RS-422 standard, while the computer's serial port uses the RS-232 standard. Therefore, the interface circuit for PLC-computer communication must convert the RS-422 standard to the RS-232 standard. RS-232 and RS-422 standards differ in signal transmission and logic levels. RS-232 uses a single-ended receiver and a single-ended transmitter, transmitting information using only one signal line, and determining the logic "1" based on the level on that signal line relative to the common ground level. The RS-422 standard is a balanced transmission standard, i.e., double-ended transmission and reception, determining the logic state based on the potential difference between the two transmission lines. An RS-422 circuit consists of a transmitter, a balanced connection cable, a cable termination load, and a receiver. It converts logic levels and potential differences through a balanced transmitter and a differential receiver. The author chose the MAX232 from MAXIM to implement the level conversion between RS-232 and TTL. The MAX232 has an internal voltage multiplier and conversion circuit, requiring only a +5V power supply to operate, making it very convenient to use. The MAX485 is selected to implement the conversion between RS-485 and TTL. Each MAX485 has a transmitter/receiver pair; since the communication uses full-duplex mode, two MAX485s are required, along with only four external capacitors. 3. Software Design The system software design includes: lower-level software design; upper-level software design; and lower-level and upper-level communication software design. 3.1 Short Message PDU Format Analysis and Practical AT Command Sending and Receiving SMS Information There are two modes for sending and receiving SMS information: Text Mode based on AT commands and PDU (protocol description unit) Mode based on AT commands. Most Siemens mobile phones only support PDU mode. In PDU mode, the SMS text is encoded and converted into UNICODE code before transmission. Since we are using Siemens TC35 mobile phone modules and TC35T mobile phone terminals, this paper mainly discusses the sending and receiving of PDU mode information. The following analysis of the sent SMS message format will introduce the data format of SMS PDU. Let's assume we're preparing to send a Chinese SMS message with the content "Good evening 123". First, connect the TC35T to the computer's serial port and open the computer's HyperTerminal: 3.1.1 The specific operation process for sending a short message is as follows (underlined characters are response information, {} are comments): AT OK {The connection between the computer and the mobile phone is successful. Now you can enter various GSM AT commands} AT+CNMI=1,1,2 OK {Set the notification when a short message is received} When the module receives a short message, it will give a response: For example: +CMTI: "SM",4 AT+CMGF=0 OK {Set the module's working mode: 0 for PDU mode, 1 for text mode} AT+CMGS=26 {Number of bytes in the short message sent} >0891 683108200905F0 0103 0D91 683199312523F9 3208 0C 665A4E0A597D003100320033 // Press Ctrl+Z and you'll see the prompt -> appear after the last number, indicating that the system has received the command. The system will then return the result of the operation. OK {OK indicates success, ERROR indicates failure} +CMGS: 32 The following analyzes this message: 08: Indicates SMS center address length 91: Indicates SMS center number type 683108200905F0: Indicates SMS center number 0103: Indicates SMS encoding method 0D: Indicates destination address length 91: Indicates destination address type 683199312523F9: Indicates destination address, i.e., the receiving mobile phone number is: 139913523293208: Indicates Chinese character sending method 0C: Indicates SMS length 665A4E0A597D003100320033: Indicates UNICODE code for sending Chinese characters 665A {晚} 4E0A {上} 597D {好} 0031 {1} 0032 {2} 0033 { 3} 3.1.2 Analysis of SMS Message Reception by the Module: AT+CMGR={Read the content of the SMS message, Index indicates the location where the SMS message is stored} AT+CMGL={List SMS messages: stat = 0, column for unread SMS messages; stat = 4, column for all SMS messages} +CMGL: 1,2,,24 {1 represents the number of messages, 2 represents unsent messages, 24 represents the total message capacity} AT+CMGD={Delete SMS message, Index indicates the location where the SMS message is stored} OK {Deleted successfully} 3.2 Lower-level software design includes: data acquisition and A/D conversion program; over-limit alarm program. 3.3 Upper-level software design includes: monitoring center main interface design; database program design. 3.4 Communication Software Design between Lower-Level and Upper-Level Computers Since communication between the lower-level and upper-level computers is accomplished via SMS, the key to the communication software design is how the microcontroller sends AT commands. 4. Conclusion This paper uses SMS service to complete the communication between the data acquisition and monitoring terminal and the control center. It realizes remote control of the data acquisition and monitoring terminal, remote control of power supply switching; telemetry, remote measurement of various switching quantities; remote adjustment, remote adjustment of various gains; and remote communication, remote querying of various analog quantities. SMS service has advantages such as always-on connectivity, no dialing required, low cost, and wide coverage, making it particularly suitable for applications requiring frequent transmission of small amounts of data, and also suitable for remote areas and places where setting up communication lines is difficult. For the data acquisition and monitoring terminal, which is generally placed in unattended areas, using SMS service to transmit data is most suitable. The system designed by the author is now in operation, and practice has proven that the system works very reliably.