introduction
At present, remote monitoring of oil pipelines, power equipment, oil wells, etc. mainly adopts manual patrol, which has the disadvantages of poor real-time performance, high cost, waste of human resources, inability to monitor areas with harsh environments, and possible false alarms. With the improvement of the modernization level of the industrial field and the development of communication technology, this production method needs to be improved urgently.
M2M refers to a series of technologies and their combinations that use wireless mobile communication technology to achieve data communication and exchange between machines and between machines and people. GPRS has the advantages of wide coverage, long communication distance, and high network reliability. With the promotion and application of GPRS and the launch of M2M products based on GPRS, using GPRS technology to solve the above problems has become a better solution.
Embedded system is one of the hot topics in current research at home and abroad. It is necessary to use embedded system technology to design a universal terminal that can solve the data transmission problem in the field of remote monitoring. This article focuses on the overall design of M2M terminal based on embedded ARM processor and GPRS module mc35i.
System hardware components
The hardware core of the M2M terminal is the GPRS communication module MC35i and the ARM processor AT91SAM7S64, and their interface design is shown in Figure 1. The M2M terminal has two RS232 serial ports for external use. By sending pre-defined digital commands, the M2M terminal can be started and shut down. When the M2M terminal is connected to the Internet, it only needs to send the encapsulated data to the M2M terminal through the serial port, and the M2M terminal will complete the function of sending data to the monitoring center.
GPRS module
The GPRS module is the core part of the M2M terminal platform. The design uses Siemens' GPRS communication module MC35i. This module includes CPU interface circuit, SIM card interface circuit and MC35i peripheral circuit. MC35i supports four GPRS coding protocols CS-1, CS-2, CS-3 and CS-4. The theoretical maximum transmission rate can reach 172kbps. It has complete GSM and GPRS functions and can be widely used in related M2M data transmission platforms. MC35i provides a standard AT command interface and an RS232 interface for connecting to external application systems.
ARM processor
The data transmission platform processor uses the 32-bit ARM7TDMI architecture processor AT91SAM7S64 produced by ATMEL. The chip is powered by 3.3V voltage and supports low power consumption mode. It has 64kB FLASH and 16kB SRAM, and has rich peripheral device resources, including 3 UART communication serial ports and 1 USB2.0 full-speed device. The high cost performance of the system can be achieved by using this chip to complete the system functions. The CPU module hardware circuit includes: clock circuit, JTAG interface circuit, RS232 interface circuit, etc.
Power Design
The system is powered by a 9V power supply, which is stepped down once by TI's LDO step-down chip UA7805 to reduce the voltage to 5V. The GPRS module MC35i requires a power supply voltage of 3.3V to 4.8V, and the power supply must be able to provide a peak current of 2A. Therefore, the 5V power supply needs to be input into the MC35i through a 0.7V voltage drop Schottky diode 1N5819, and a 25V, 1000μF electrolytic capacitor needs to be connected to provide enough peak current for the MC35i. The 5V power supply is stepped down to 3.3V through TI's power module REG1117-3.3 to provide power for the microprocessor and other chips.
Embedded Software Design
Using an embedded real-time operating system can more appropriately and effectively utilize CPU resources, simplify the design of application software, shorten system development time, and better ensure the real-time performance and reliability of the system. FreeRTOS is a microkernel embedded real-time operating system released on the Sourceforge website. It is a completely free operating system with the characteristics of open source code, portability, scalability, and flexible scheduling strategies. As a lightweight operating system, FreeRTOS provides the following functions: task management, time management, semaphores, message queues, memory management, etc.
FreeRTOS supports two scheduling algorithms: priority and rotating time slices. It can be set as a preemptive kernel or a non-preemptive kernel according to user needs. Based on FreeRTOS, this paper gives a software design scheme for M2M terminals to implement PPP negotiation and data encapsulation transmission.
Design GPRS connection task based on state machine
Due to reasons such as weak network and signal, the node may fail to connect to the GPRS network. The state machine-based structural design method is used to handle the errors generated at each stage, which can ensure that the module can establish a reliable connection with the GPRS network. The program state machine is shown in Figure 2.
Idle standby state: At this time, mc35i is in offline shutdown state, the node is in low power consumption mode, and the system is in this state after reset.
GPRS parameter setting state: The processor controls the MC35i module to enter this state after starting it. The module and necessary network parameters are set by sending AT commands. In order to ensure that all parameters are set successfully, a fault-tolerant retry mechanism is added to the software design.
PPP negotiation state: After the GPRS parameters are set, the PPP negotiation between the MC35i module and the GPRS network ISP (network service provider) is started by sending the AT*99***1# command. The LCPHandler() function is used in the software design to complete the LCP negotiation, PAPHandler() completes the authentication, and IPCPHandler() completes the IPCP negotiation. If the IP address of the ISP and this node is finally obtained, the PPPOVER state is entered, and data transmission can be carried out thereafter. Due to reasons such as the GPRS network, the PPP negotiation sometimes fails. At this time, the MC35i module should be restarted and then reconnected according to the state machine process.
UDP data transmission state: When the program uses UDP for data transmission, the program enters this state and performs UDP/IP encapsulation and parsing of data through the xDataTrsmtTask() task.
TCP data transmission state: When the node calls the uip_cionnect() function to establish a connection with the monitoring center, the program enters the TCP data transmission state and performs TCP-based data transmission.
Data packaging and transmission
Data transmission via GPRS needs to be transferred through the Internet network, so the data encapsulation must be TCP/IP protocol. In this paper, data encapsulation is performed using software. The data to be transmitted is encapsulated by the transport layer UDP protocol header, then the IP protocol header, and finally the PPP protocol. The format of the data transmitted to MC35i after encapsulation is shown in Table 1.
MC35i transparently transmits the received data to the Internet network. Through the Internet network router, the data is finally transmitted to the monitoring center. The receiving end analyzes the received data according to the corresponding level to determine the target program of the data.
The system software design adopts a layered structure, from bottom to top: serial port driver layer (physical layer), PPP protocol layer (link layer), IP protocol layer (network layer), UDP protocol and ICMP layer (transport layer) and application layer. In the transplanted LwIP protocol stack, data encapsulation is achieved by establishing threads of corresponding functions in each layer. The bottom-level software provides function support for the upper-level software, and the upper-level software uses the bottom-level software to complete the writing and implementation of application programs. The software adopts a bottom-up design method to gradually implement the functions of each function in the system, and the implementation of each part of the function adopts a modular design method. Each task corresponds to a module
After each task is designed separately, it is finally managed uniformly by the FreeRTOS operating system. The communication between multiple tasks is achieved by using semaphores and mailboxes. The relationship between the main functions of each part of the software is shown in Figure 3.
After the received data is stored in the xQRxChars queue in MC35SerialISR(), the SemMC35Rx semaphore is sent to activate the PPPRxTask() task. The type of the data packet is determined by parsing the received data, and then the corresponding function processes the received data.
If the received data is the data of the application, the IPRx() function will determine whether the target host is correct, and then parse the data through the transport layer to determine the application that processes the data. Finally, the application parses the data and performs corresponding functions, such as sending data to the host through the serial port, sending control commands to the data acquisition system, receiving data from the data acquisition system and sending it, etc. When all the data in the receiving queue are processed, if no data is received after a delay of 250ms, the task will suspend itself by waiting for the semaphore SemMC35Rx. The data sending process is a reverse process.
The application creates a UDPTxTask() or ICMPTxTask() task according to the required functions and sends the data to the xAPPTxQ queue. The corresponding task then calls the IPTx() and PPPTx() functions to encapsulate the data and send the data to the XqTxChar queue, thereby waking up the MC35SerialISR() interrupt program to send the data to the MC35i through the serial port for transmission. To improve the real-time performance of the system, FreeRTOS in this article uses a preemptive kernel for scheduling. Using the FreeRTOS operating system to manage tasks simplifies the difficulty of software writing and improves the readability and portability of the program.
Summarize
Wireless data transmission and remote monitoring systems based on GPRS m2m products are currently hot topics of research at home and abroad. This paper uses a completely free operating system and TCP/IP protocol stack to provide a system design solution with the advantages of low cost, good performance, and scalability, providing a feasible design solution for data transmission in the field of remote monitoring systems.
Previous article:Various applications of intelligent RFID systems in industrial control
Next article:Design of intelligent rescue robot based on AT89s52 single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 16:54
- Popular Resources
- Popular amplifiers
- Introduction to Internet of Things Engineering 2nd Edition (Gongyi Wu)
- Learning PLC is easy - PLC ladder diagram and statement table with pictures (Li Changjun, Zhou Hua)
- A Complete Illustrated Guide to Operational Amplifier Applications (Written by Wang Zhenhong)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to send more than 20 bytes of data at a time with blue_nrg
- I stayed up late to sort it out. Here is the servo information on the national competition list.
- How to make an overvoltage protection circuit?
- Detailed explanation of starting surge current
- Showing off the goods + the development boards we have used together over the years
- A newbie asks for help, IAR compiles and reports undefined errors
- The motherboard of Huawei P30 looks like this
- RS-485 Transceiver
- ST U5 development board evaluation and programming related issues (official sharing)
- Problems with ST Motor Control Workbench