Design of wireless terminal based on STM32 microcontroller and EM310

Publisher:CrystalRoseLatest update time:2013-09-09 Source: dzscKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0Introduction

  In the monitoring and control and data acquisition system (SCADA) system, the real-time and accuracy of the collected data have a great impact on the system. A suitable communication network can effectively improve the benefits of the SCADA system. The application of the GPRS wireless terminal designed in this paper in the SCADA system solves the above problems. In addition to meeting the real-time and accuracy of data, it also has the advantages of low construction cost, simple structure, large transmission capacity, and remote control.

  1 Terminal Introduction

  1.1 Terminal structure

  The wireless terminal is composed of EM310GSM module and STM32F103 single chip machine, with STM32F103 single chip machine as the core. STM32F103 single chip machine has rich communication interfaces for connecting EM310 and field instruments; it also has rich I/O resources, which can expand the RAM with larger capacity, on the one hand, to store instruction sets for interpreting instructions and making corresponding actions; on the other hand, it is used to temporarily store the data collected by the monitoring point. The terminal uses GPRS technology to communicate with the control center. The GPRS communication network has the advantages of low construction cost, fast networking, large transmission capacity and high transmission speed. Figure 1 is the structural diagram of the wireless terminal and the monitoring point instrument.

  1.2 Application of terminals in SCADA system

  The main task of wireless terminals in SCADA systems is to communicate via the GPRS network

  The data transmission and reception between the monitoring point and the control center is realized through the Internet network, and its structure is shown in Figure 2.

  1.2 Hardware Design

  The main functions of the terminal are: data transmission and reception, command interpretation and control of monitoring point instruments. To meet the above functions, the circuit is mainly divided into several parts: EM310 module circuit, external RAM circuit and instrument serial port circuit.

  (1) The EM310 module has certain requirements for the speed and capacity of wireless module data transmission in the SCADA system. In addition, some systems have higher requirements for the operating temperature of the terminal. Compared with Siemens MC55, EM310 has a wider high and low temperature range and can be applied to some occasions with higher temperature requirements; compared with GTM900B, it is smaller in size and more powerful in function. EM310 has a built-in protocol and can send 2K bytes at a time, which can meet the requirements of most SCA-DA systems; it has a MUX function and can realize the transmission of large amounts of data.

  The function of the EM310 module is to receive data from the serial port of the STM32 microcontroller and send and receive wireless data to the STM32 microcontroller through the serial port. When connecting to the GPRS network, the SIM card verification is required, and the current status is displayed through the LPG pin. Therefore, the EM310 module circuit mainly includes the serial port part, the SIM card connection part and the LPG indicator light connection part, as well as the start and reset parts.

  As shown in Figure 3, SIM_CLK, SIM_VCC, SIM_ON, and SIM_RST are the clock, power, data, and reset lines of the SIM card respectively; LPG is used to connect the network status indicator; RST is the reset pin, which is valid at low level. This pin is connected to GND with a 100nF capacitor in parallel near the 50PINB2B connector for electrostatic discharge protection; TERM-ON is the power on/off pin. Pull the TERM-ON pin low for 50ms to turn on the machine, and then pull the TERM_ON pin low for 50ms to turn off the machine. VDD-IO is the power pin of the I/O port. The relationship between the VDD-IO voltage U and the /DTR./RTS./TXD plus series resistance R is calculated as follows: R=3.5 * U-11.3K.

  (2) External RAM

  The external RAM is used to store instruction sets and temporarily store instrument detection data. When the terminal receives a data packet, the MCU will find the corresponding program segment in the RAM according to the received data packet and run the program segment, that is, perform the actions required by the control center, such as reading instrument parameters, setting instrument parameters, reading monitoring data, etc.

 

  The read and write speed of RAM largely determines the response speed of the terminal after receiving the data packet. Therefore, the terminal uses high-speed static RAM IS61LV25616, which adopts ISSI's high-performance CMOS technology, uses highly reliable processes and innovative circuit design technology, and has the characteristics of high performance and low power consumption.

  IS61LV25616 has a standby mode, which reduces power dissipation at CMOS input level. The RAM can be in standby mode when the terminal does not receive instructions and does not need to send data. The chip can also achieve memory expansion through the connection of the enable interface. Data access includes high byte access and low byte access.

  (3) Instrument serial port

  The instrument serial port is used to connect the monitoring point instrument with the single-chip microcomputer. The instrument serial port circuit selects the form of RS232 to TTL level, as shown in Figure 4. 1.4.6 of DB9 are short-circuited, and the RS232 level transmits and receives data through the transceiver SP3223EA. In SP3223EA, the polarity capacitor connected between C1+ and C1- is used as the pump capacitor of the voltage multiplier, and the polarity capacitor connected between C2+ and C2- is used as the reverse charge pump capacitor. TXfN is the TTL/CMOS driver input, TxOUT is the RS-232 driver output, RxlN is the RS-232 receiver input, and RxOUT is the TTL/CMOS receiver output.

    SP3223EA realizes the conversion from TTL level to RS232 level by multiplication and inversion.

  2 Software Design and Debugging

  Software design requires the initialization of EM310, parameter setting, data sending and receiving through serial communication.

  2.1 Program Flowchart

  The serial port connecting the microcontroller to EM310 is serial port 1, and the serial port connecting to the instrument is serial port 2. In the main program, some global variables are first defined, and then initialized, including the initialization of the system and peripheral clocks, the initialization of peripherals and general IP ports, the serial port initialization, the timer initialization, and finally the loop is entered to check whether data is received or whether the instrument serial port needs to send data. If data is received, the subroutine for receiving data is entered, and if data needs to be sent, the subroutine for sending data is entered. The program flow chart is shown in Figure 5.

  2.2 Debugging process and results

  Here, the serial port debugging tool is used to simulate the monitoring point instrument. Data can be transmitted to the GPRS wireless data terminal, and then sent to the control center by EM310. The data received can also be read from EM310. TestGPRS software is used to simulate the control center software. Data sent from the serial port debugging tool can be displayed, and data can also be sent to the serial port debugging tool through the network.

  (1) EM310 initialization

  The initialization of EM310 includes signal detection, SIM card detection, mode selection, gateway registration, user name and password. When the signal strength is sufficient and the SIM card is correctly connected, you can register. First, select the mode to determine whether the module should compress and convert the input and output data; then register the gateway, user name and password; finally wait for the allocation of IP. The initialization sequence is: ① detect signal strength; ② detect whether the SIM card is correctly connected; ③ select the mode; ④ register the gateway; ⑤ register the user name and password.

  (2) Set commands and send and receive tests

  The setting command mainly involves the setting of protocol type, IP and port number. The IP and port number must be consistent with the IP and port number of the data center before data can be sent and received through AT commands. The method of setting and sending and receiving data is as follows:

  Send: AT%IPOPEN="TCP" "210.32.34.65", 8001

  Return: CONNECT

  Send: AT%IPSEND="31323334354142" Send data 12345AB

  Return: %IPSEND:1,15

  OK

  Use TestGPRS software to send AB1234 to port 8001, and then the serial port test tool will display: %IPDATA:1,1,6

  Send: AT%IPDR

  Return: %IPDR: 1,1,6, "414231323334"

  OK

  3 Conclusion

  This solution can be applied to general SCADA systems. It has the characteristics of simple structure, strong scalability, low construction cost, fast transmission speed and fast connection. It can effectively solve the problem of high cost and difficulty in building communication networks in remote monitoring points. The debugging results prove the feasibility of the solution. The rich I/O resources and communication interface resources of the STM32 microcontroller can meet the needs of various SCADA system terminals and facilitate secondary development by users.

Keywords:STM32 Reference address:Design of wireless terminal based on STM32 microcontroller and EM310

Previous article:Design of tension control system for printing press
Next article:Design of data recording device based on STM32 microcontroller

Recommended ReadingLatest update time:2024-11-15 09:26

PIC microcontroller I2C communication (master mode)
    Today we are going to talk about I2C communication. What are the characteristics of I2C communication? What is the difference between the serial port (half-duplex asynchronous serial communication) we usually use and I2C?     Serial port (half-duplex asynchronous serial communication): It is like a conversation
[Microcontroller]
PIC microcontroller I2C communication (master mode)
AVR MCU IAR development environment construction and precautions
Introduction: 1. Setting up the IAR development environment for AVR microcontrollers 2. Precautions for using IAR 1. Construction of IAR development environment for AVR microcontroller 2. Precautions for using IAR Header file meaning avr_macros.h contains simplified instructions for reading and writing 16-bit
[Microcontroller]
51 MCU C Language Tutorial (IX) Statement Application
A friend once asked me on the BBS what does {} mean? What is its function? There are many brackets in C, such as {}, , (), etc., which really confuse some beginners. In some languages ​​such as VB, the same () sign can have different functions. It can be used to combine several statements to form a function block, or
[Microcontroller]
89C51 MCU external interrupt 0, 1 control LED
1. Proteus simulation diagram 2.keli code #include reg51.h sbit led1=P0^0; sbit led2=P1^0; //External interrupt 0 control program void INT0test() interrupt 0 { led1=~led1; } //External interrupt 1 control program void INT1test() interrupt 2 { led2=~led2; } int main() { EA=1; //Global interrupt enable E
[Microcontroller]
89C51 MCU external interrupt 0, 1 control LED
STM32 HardFault_Handler problem debugging method
I believe that many people have encountered the HardFault_Handler error when debugging STM32. People who have just started to use it must be most afraid of this error, because the cause of this problem is difficult to find. I have seen many people on the Internet give better debugging methods. When I debugged again, I
[Microcontroller]
Detailed explanation of small rtos based on 51 microcontroller (1)
      Chen Mingji, this person needs to be known, because he wrote the small rtos, which was written based on the principle of ucos. This small rtos can run on the 51 microcontroller, but it is limited by the ARM memory. As a microcontroller developer, you have to think about the memory problem at all times, because th
[Microcontroller]
Detailed explanation of small rtos based on 51 microcontroller (1)
stm32 pwm breathing light
#include "main.h" #include "stm32f0xx_hal.h"   /* USER CODE BEGIN Includes */ int i=0; /* USER CODE END Includes */   /* Private variables ---------------------------------------------------------*/ TIM_HandleTypeDef htim3;   UART_HandleTypeDef huart1;   /* USER CODE BEGIN PV */ /* Private variables -----------------
[Microcontroller]
stm32 pwm breathing light
GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
Beijing, China (November 12, 2024) - GigaDevice, an industry-leading semiconductor device supplier, held a new product launch conference in Shanghai today with the theme of "Yongyue·Core Journey". Industry partners from the fields of industry and digital energy gathered together to celebrate the event. At th
[Industrial Control]
GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号