Design of monitoring system based on USB and RS485 bus

Publisher:美好的人生Latest update time:2011-08-19 Source: EEWORLDKeywords:USB  RS485 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: PID regulating instrument and sensor can be used together to measure and display the temperature of bell-type furnace on steel product production line. Through the corresponding actuator, PID regulation and control, alarm control, data acquisition and recording of relevant bell-type furnace equipment can be realized. However, for the field environment with multiple production lines and each production line using multiple PID regulating instruments, it is not convenient to operate each instrument in turn. Borland C ++ Builder 6 is used to design an online centralized monitoring system for PID regulating instruments. Using the powerful graphical control interface of Borland C ++ Builder 6 and the SPComm control to program under the serial port, the real-time monitoring and remote control of each partition instrument on the production line are well realized through the USB to RS485 protocol converter.

1 Introduction

In order to effectively realize the real-time monitoring and remote control of the instrument data of each partition on the production line, Borland C++ Builder6 was used to design the PID control instrument online centralized monitoring system through the USB to RS485 protocol converter. It mainly includes: the temperature monitoring system of the bell-type furnace equipment on the steel product production line, the database system, and the reading and writing data system of the PID control instrument.

2 Overall structure of monitoring system

The monitoring system adopts RS485 bus structure, and realizes network communication between the host computer and the PID control instrument through the USB to RS485 protocol converter. The characteristics of RS485 bus are simple and convenient implementation. Through RS-485, it can be networked to form a distributed system. It allows up to 32 drivers and 32 receivers to be connected in parallel, which can fully meet the networking needs of multiple PID control instruments equipped at the production site.

Figure 1 Overall structure of monitoring system

Figure 1 Overall structure of monitoring system

3 Monitoring System Hardware Design

3.1 Self-tuning expert PID control instrument

The self-tuning expert PID control instrument has a switching power supply with a wide input range of 100 ~ 240VAC. The input adopts digital correction and self-calibration technology, which makes the measurement accurate and stable, eliminating the measurement errors caused by temperature drift and time drift. The instrument fully adopts surface mount technology and adopts multiple protection and isolation design, with strong anti-interference ability and good reliability.

The instrument adopts advanced expert PID intelligent adjustment algorithm, with precise and stable control, no overshoot, and high-precision self-tuning (AT) function.

The instrument output adopts modular hardware structure design, and various control modes can be realized by replacing different functional modules. PID control output can choose 4mA ~ 20mA current, (1V ~ 5V voltage), SSR drive, single-phase/three-phase SCR zero-crossing trigger and single-phase SCR phase shift trigger, etc., and there are two alarm output functions, and optional transmission output or standard communication interface (RS485 or RS232).

The instrument has multiple types of input functions. One instrument can be equipped with different input signals (thermocouple/thermal resistor/linear voltage/linear current/linear resistance), which greatly reduces the number of spare meters. It has a wide range of applications and can be used with various sensors and transmitters to measure and display physical quantities such as temperature, pressure, liquid level, capacity, force, etc. It can also be used with various actuators to perform PID regulation and control, alarm control, data acquisition and recording on electric heating equipment and electromagnetic and electric valves.

3. 2 USB to RS485 protocol converter

The USB to RS485 protocol converter is a plug-and-play protocol converter, fully compatible with USB (Universal Serial Bus) Rev: 2.0; it supports any baud rate, data bit, stop bit, data transmission and reception time interval and other parameters, and is an adaptive protocol converter.

Support RS-232/485 interface, data transmission rate above 2Mbps.

Support automatic handshake protocol; support remote wake-up and power management; support direct power supply from USB bus, no external power supply (DC 5V) required; the driver is confirmed twice, the first time is the chip driver, the second time is the I/O port driver, and it can be completed for the drivers in the same directory.

4. Software Design of Monitoring System

The software system of the monitoring system is designed and developed using Borland C++ Builder 6. Through its powerful graphical control interface and SPComm control programmed under the serial port, the Modbus protocol is adopted, and the USB to RS485 protocol converter is used to well realize the communication function between the host computer and the PID adjustment instrument. Therefore, the parameter monitoring and remote operation control of each partition instrument on the production line can be easily realized through the operation of the host computer monitoring system interface.

The software system mainly consists of three parts: the temperature monitoring system of the bell-type furnace equipment on the steel product production line, the database system, and the reading and writing data system of the PID control instrument.

4.1 Modbus communication

The standard Modbus port is a serial interface compatible with RS-232C, which defines the connection port pins, cables, signal bits, transmission baud rate, and parity. The controller can be networked directly or via a Modem.

Controller communication uses master-slave technology, that is, the master device can initiate the transmission (query). The slave device responds accordingly based on the data provided by the master device query. Regardless of whether the master device queries or the slave device responds, each Modbus frame includes an address field, a function field, a data field, and an error detection field. Modbus communication has two modes: ASCII mode and RTU mode. Compared with ASCII mode, RTU mode can transmit more data than ASCII mode at the same baud rate.

Using RTU mode, message transmission must start with a pause interval of at least 3.5 characters. The entire message frame must be transmitted as a continuous stream. If there is a pause time of more than 1.5 characters before the frame is completed, the receiving device will refresh the incomplete message and assume that the next byte is the address field of a new message. Similarly, if a new message starts within less than 3.5 characters after the previous message, the receiving device will think it is a continuation of the previous message. This will cause an error because the value in the last CRC field cannot be correct. A typical message frame is shown in Table 1.

Table 1 RTU message frame

Table 1 RTU message frame

The PID control instrument uses Modbus-RTU mode for host computer communication. The protocol format is: 8 data bits, 1 stop bit, no check bit, and the sending and receiving data are all in hexadecimal format.

The format of the transmitted data is shown in Table 2.

Table 2 Sending data format

Table 2 Sending data format

Among them, when the communication address of the parameter is represented by one byte, it corresponds to the A2 position, and A1 defaults to 00H; 03 and 04 instructions are both read commands, among which 04 corresponds to the read data and cannot be written. 03 and 06 instructions correspond to the parameter address, one read and one write; A1, A2 and A3, A4 form two double-byte data, CRC check code is a double-byte data, all data are high-order first and low-order last; when 03 and 04 instructions read data, A1 and A2 are the addresses to start reading, and A3 and A4 are the number of consecutively read data; in 06 instruction, A1 and A2 are the addresses to be written to the data, and A3 and A4 represent the data to be written.

Return data format, when the 06 instruction writes data, the sent and returned data are consistent; the return data format of the 03 and 04 instructions is shown in Table 3, where the number of returned data bytes is: N × 2.

Table 3 Return data format

Table 3 Return data format

4.2 Temperature Monitoring System

The temperature monitoring system is designed and developed using Borland C++ Builder 6, mainly involving the use of controls such as Chart, Timer, SPComm, and MainMenu. The system program design mainly includes: sampling program, data saving program, historical data backup program, etc. The main process of the temperature monitoring system is shown in Figure 2.

Figure 2 Main flow chart of the monitoring system

Figure 2 Main flow chart of the monitoring system

4.3 Database System

Start the database system program, first select the corresponding database file, and the corresponding database information will be displayed, as shown in Figure 3. The database system mainly includes two data retrieval methods: Method 1, search by selecting the search date; Method 2, set the volume number and search by volume number. Through the database system, you can easily browse and query historical data.

Figure 3 Database system

Figure 3 Database system

4.4 PID control instrument reading and writing data system

The data reading and writing system of the PID control instrument mainly includes three functions: data setting function before writing into the instrument, data writing function into the instrument and data reading function of the instrument.

Figure 4 is the main flow chart of the data writing instrument program. The data setting function is mainly realized through two ways: Path 1, add the system configuration setting file "MControlini", and realize the setting operation before writing data into the instrument by setting and modifying the temperature and time parameters in the configuration setting file; Path 2, start the data reading and writing system program, select the corresponding database file, and the system program will automatically associate the total number of partition instruments set in the database file, and realize the setting operation before writing data into the instrument by modifying and setting the temperature and time parameters of each curve segment of each partition. Among them, when setting data in Path 2, the format and size of the input data can be judged, and the reset data state changes will be displayed in real time in the corresponding curve segment of the interface.

Figure 4 Main flow chart of data writing instrument program

Figure 4 Main flow chart of data writing instrument program

Figure 5 is the main flow chart of the instrument data reading program. By comparing and analyzing the instrument data read by the system with the parameters in the system configuration file, it is determined whether the instrument data is consistent with the system configuration file data.

Figure 5 Main flow chart of the instrument data reading program

Figure 5 Main flow chart of the instrument data reading program

If "yes", it means that the parameters set by the system are very consistent with the instrument data, and the reading program is terminated; if "no", the next step of the program is executed: "write the configuration file data to the instrument" or "update the configuration file data to the instrument data". Through the instrument data reading program, the system has achieved good consistency between the configuration file data and the instrument data.

5 Conclusion

Based on RS485 bus structure and Modbus protocol, the monitoring system designed with Borland C++Builder6 can well realize real-time monitoring and remote control of instruments in each partition on the production line.

Keywords:USB  RS485 Reference address:Design of monitoring system based on USB and RS485 bus

Previous article:Application of NISE series in wall cutting production line
Next article:Digital design scheme for control circuit of radar's supporting equipment

Recommended ReadingLatest update time:2024-11-16 20:40

MAX14576, MAX14636, MAX14637 USB Charger Detectors
The MAX14576/MAX14636/MAX14637 are USB charger detectors. The MAX14576/MAX14636/MAX14637 will pass USB Battery Charging Specification Revision 1.2 (USB1.2 BC) compliance testing. The MAX14636/MAX14637 can also detect Apple chargers, and other non-standard types. These devices are able to detect multiple USB battery ch
[Analog Electronics]
How to reduce the production cost of Micro USB waterproof motherboard
Product production and packaging require a certain amount of cost. The higher the cost quotation, the higher the final product quotation. Just like the Micro USB waterproof jellyfish socket, the quotations of Micro USB waterproof jellyfish sockets on the market are also different because their appearance, structure,
[Embedded]
How to reduce the production cost of Micro USB waterproof motherboard
11 USB Type-C Misconceptions You Need to Know
USB Type-C and PD are complicated   When using a universal connector that can be plugged into a power source or device, negotiating which device powers which device can seem daunting to product designers and consumers. However, the complexity of the product can vary depending on the needs of the product designer. For
[Internet of Things]
11 USB Type-C Misconceptions You Need to Know
USB Isolation Solutions in Medical Systems
The widespread availability of general-purpose personal computers (PCs) is reshaping the way medical systems are built. At the heart of these medical systems is a PC that has been configured with specialized software and features tailored for medical applications. This approach reduces costs and development time bec
[Industrial Control]
Using a simple circuit to solve the USB current overshoot problem during live plug-in and unplug
        When a simple voice recorder or other peripheral is plugged into a USB port, it may cause an unwanted system reset. In this case, a current limiter is required at the front end of the port to provide short circuit and overload protection when plugging and unplugging the port. A feature of this interface is t
[Power Management]
Using a simple circuit to solve the USB current overshoot problem during live plug-in and unplug
USB radar, build your own missile defense system
Everyone has seen radar (at least on TV). It feels great every time I see it. It can detect various obstacles. It would be great if I could have one. But there is someone who not only dares to think, but also dares to put his ideas into practice (which is what we lack), and he really made a very cool USB radar.
[Analog Electronics]
USB radar, build your own missile defense system
Trying to use STM32f103c8t6 as USBCDC
I tinkered with stm32 when I was bored. There were too many resources in the lab to handle. I worked on dsp and fpga a few days ago, but found these chips a bit boring, so I came back to work on stm32. I worked on it for a day. In the afternoon, I made a FreeRTOS example. After reading some information, I found it was
[Microcontroller]
Implementation of DMA Data Transfer in USB Data Acquisition System
  introduction   USB Universal Serial Bus is a bus widely used by PCs. It has been integrated into computer motherboards and has become a standard configuration interface. Its plug-and-play, true hot-swap, bus-powered, high performance and low system cost and other advantages have made the USB interface widely used.
[Microcontroller]
Implementation of DMA Data Transfer in USB Data Acquisition System
Latest Industrial Control 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号