An Ethernet-based embedded digital monitoring system
2026-04-06 06:21:39··#1
Abstract: Based on the current development status of monitoring systems, this paper proposes a design scheme for an embedded digital home monitoring system based on Ethernet, and preliminarily completes the development of the monitoring system. The system uses an embedded field monitor for data acquisition. The field monitor consists of a data acquisition card and a network communication card. The field control card is responsible for receiving control commands issued by the monitoring center. They are all controlled by a 51 microcontroller, and the software development uses C51 and 51 assembly programs. Keywords: Monitoring system; Embedded system; Microcontroller 1 Introduction With the advancement of science and technology and the continuous improvement of living standards, the development of information technology and networking technology has made it possible to centrally control and remotely control home appliances. Integrating information technology with home appliance control technology can largely realize the informatization and automation of home life, meeting people's needs for a comfortable and fast-paced life. When a home adopts a monitoring system, various electronic devices can operate with almost no intervention. In view of this trend of digital home development, remote monitoring has been widely adopted as an ideal, effective, and convenient way to achieve this. [align=center]Figure 1 Hardware Block Diagram of the Field Control Card[/align] 2 System Overall Design This system will be built using a dual-system architecture. The lower-level computer operates at the monitoring site and is controlled by a 51 series microcontroller; the upper-level computer is used at the monitoring center and is a PC. The microcontroller collects data through various sensors and transmits the monitoring data to the remote PC via a network interface implemented by an Ethernet card control chip. The remote monitoring terminal of the PC receives and stores the monitoring information, then processes it accordingly and issues corresponding alarm information. Simultaneously, the PC can also send commands to the microcontroller to control its monitoring behavior. After the control command is sent, the microcontroller responsible for field control receives the command, processes the information, and then executes it. 3 Monitoring System Hardware Design Both the field monitor and the field controller are composed of their own microcontrollers. The hardware design of the field controller is the same as that of the field monitor, including the expansion of the minimum microcontroller system plus their respective functional modules. Figure 1 is the hardware block diagram of the field control card. The system hardware design mainly includes two parts: first, the design of the microcontroller system expansion, mainly the expansion of the system memory, including EPROM and RAM expansion; second, the design of functional modules, including communication modules and motor drive modules. 3.1 Microcontroller System Expansion 3.1.1 System Memory Expansion The microcontroller used in this system is the 78E58B. The 78E58B is a microcontroller based on the 8051 core, featuring high integration, powerful instruction set, fast processing speed, strong I/O interface capabilities, and high reliability. It includes 32KB of on-chip Flash program memory, 4KB of additional ROM, 512 bytes of on-chip RAM, three 16-bit timers/counters, and a serial port. The chip also includes eight interrupt sources and two interrupt priority levels. 32KB of program memory is sufficient for the system, so no external program memory was added. Therefore, no external ROM needs to be added to the hardware block diagram, saving system overhead and eliminating some circuitry and wiring, thus reducing interference sources. However, the 512 bytes of on-chip RAM in the 78E58B is far from sufficient to meet the system's functional requirements. Therefore, an 8KB static RAM 6264 is used as an external data memory. 3.1.2 Reset Circuit Design The reset circuit of this system adopts a level-controlled switch reset and a power-on reset. Additionally, the reset pin is connected to an I/O port of the MCU on the network communication card. Using this reset circuit, when a problem occurs in the program of the MCU during operation, it can be reset through the MCU on the network communication card to restore normal operation. Although interference is easily introduced into the reset pin of this reset circuit, it generally will not cause erroneous resets of the microcontroller. The reset circuit is shown in the figure. However, it is important to note that this reset circuit must be isolated from the manual switch reset circuit to prevent the reset function from failing or even short-circuiting. 3.2 Interface Implementation 3.2.1 RS232 Asynchronous Serial Communication Unit This system uses the simplest full-duplex RS232 communication method, using only three lines: serial receive (RXD), serial transmit (TXD), and ground (GND). The "serial transmit" and "serial receive" lines are cross-connected, the ground line is directly connected, and the remaining signal lines are not used. The "handshake" and idle detection functions for communication are implemented in software. The MAX232 serial communication signal conversion chip is selected to convert RS232 to TTL levels and positive/negative logic levels. Through the TTL and RS-232 input/output ports of the MAX232, the level matching between the microcontroller's TTL signal and the RS-232 serial communication signal is automatically adjusted. This hardware unit is designed primarily for system debugging. During the debugging phase, the results are output to the computer via the serial communication port, facilitating observation of the system's operating status. Another purpose is to allow for convenient input of necessary commands and information to the system via the serial communication port for future system expansion. 3.2.2 Implementation Method of Parallel Interconnection of Two Microcontrollers Connecting the field control card and the network communication card essentially involves interconnecting the microcontrollers on the two cards. While microcontrollers have serial ports, which are convenient for interconnection, the serial ports of the microcontrollers in the system are used for external connections, so they cannot be used as communication interfaces between microcontrollers within the system. However, the parallel ports of the microcontroller can also be interconnected for data communication. Therefore, the parallel ports of the microcontroller are used to achieve direct interconnection between the field control card and the network communication card. In this system, different parallel connection methods can be adopted according to different usage requirements. Currently available connection methods include the following three: unidirectional parallel communication interface; master-slave parallel communication interface; and bidirectional parallel communication interface without master-slave. 3.3 Drive Motor Circuit 3.3.1 Drive Circuit The microcontroller itself has a certain driving capability, and its I/O port current is around 10mA. Devices such as LEDs do not require special drive circuits. However, for devices with large loads such as DC motors, the microcontroller cannot provide a large current, especially when the DC motor is starting up. The starting current of the motor often reaches several times its normal operating current. Therefore, such devices require a dedicated drive circuit to drive them, while the microcontroller only performs the control functions. The basic function of the drive circuit is to provide sufficient current to drive the motor to rotate. The schematic diagram is shown in Figure 3. [align=center]Figure 3 Block diagram of a single-chip microcomputer driving a DC motor[/align] 3.3.2 Optocoupler An optocoupler is a device that assembles a light-emitting device and a photosensitive device together, achieving coupling through light to form an electro-optical-electrical conversion device. Optocouplers can be used for long-distance signal isolation transmission. They can isolate the ground wires of two systems, making the power supplies of the two systems independent, eliminating the influence caused by different ground potentials, and have a strong ability to suppress noise interference. They can also be used for signal isolation conversion, level matching between pulse systems, isolation between high and low voltage, high voltage switching, etc. When optocouplers are used, the system has high electrical isolation and anti-interference capabilities. 4 Monitoring System Software Design 4.1 Software Development of Field Control Card The control software of this system is developed by embedding functional modules developed in assembly language into a C language program. The tool used in the design is the KEIL MCS-51 series single-chip microcomputer integrated development environment. It has very powerful functions, realizing all functions from text code editing to generating binary or HEX format files that can be burned to the target ROM. The software suite includes a text editor, C language compiler, assembler, linker, target processor simulator, and library file manager. Software development employs a project management approach, with multiple modules (multiple files) placed within a single project for convenient management. The software flowchart is shown in Figure 4. [align=center] Figure 4 Software Flowchart[/align] 4.2 Communication between the field control card and the network communication card is extended via parallel ports. The system uses two 8-bit parallel ports for data input and output, and one 8-bit parallel port for transmitting communication information. The high 4 bits and low 4 bits of this parallel port are used for the input and output of communication signals, respectively. Communication uses a polling method, guiding the entire communication process by querying the status of the communication information. These communication information correspond to three types of internal communication within the system: configuration information transmission, control information transmission, and environmental information transmission. 4.2.1 Configuration information transmission primarily occurs upon system startup, initiated by the network communication card. First, the network communication card outputs the first byte of configuration information to its parallel output port, simultaneously sending a "Send Configuration Information" (0001) handshake signal. The data acquisition card scans the handshake signal input port at a certain frequency. Upon receiving the "Send Configuration Information" handshake signal, it immediately reads the corresponding data input port, obtains the first byte of configuration information, and sends a "Receive Configuration Information" (0010) handshake signal, completing the transmission of the first byte. Next, the network communication card and the field control card continue transmitting the second byte of configuration information in almost the same way, with the slight difference being that the handshake signals "Send Configuration Information" and "Receive Configuration Information" are bitwise inverted. That is, the handshake signals for the second communication become "Send Configuration Information" (1110) and "Receive Configuration Information" (1101), until the data transmission is complete. Both parties then end the communication with a "Transmission End" (1111) handshake signal. Using this method, the network communication card and the field control card only need to output a handshake signal once to transmit one byte of data, resulting in a simple protocol and fast data transmission. 4.2.2 Control Information Transmission Control information transmission is also initiated by the network communication card. When the network communication card obtains alarm information from the data acquisition card or when a user at the monitoring center has a request, after sending a control command from the host computer, the network communication card outputs one byte of control information to the corresponding parallel port and outputs a "Send Control Information" (0100) communication message through its output communication line. After receiving the "Send Control Information" communication message, the field control card immediately reads the corresponding data and sends "Received Control Information" (1000). After receiving this signal, the field control card ends the communication with "Transmission End (1111)". 4.2.3 Environmental information transmission is initiated by the network communication card and continues in a loop. First, the network communication card outputs the number of the environmental information to be read through the data parallel port and outputs the communication signal "Environmental Information Query" (1100). Upon receiving this signal, the data acquisition card obtains the channel number of the environmental information to be queried by the network communication card through the data input parallel port, outputs the corresponding environmental information data through the data output parallel port, and simultaneously outputs the communication signal "Environmental Information Delivered" (1010). After receiving this signal, the network communication card can continue to query the next piece of environmental information. 4.3 Monitoring Database Currently, there are many development environments used for database development, such as Delphi, Visual Basic, PowerBuilder, and SQL Server. With the continuous enhancement of Visual C++'s database development capabilities, it is widely used in practical development as a convenient and easy-to-use development tool. The monitoring database design of this system adopts Visual C++, and its interface includes system login, main software interface, user information management and staff information management, environmental information and alarm information management, and monitor configuration information management. 5 The author's innovations This paper implements a relatively complete embedded monitoring system. The paper introduces the solution of the whole system, the hardware design and software design of the field control card, and the communication between the field control card and the network communication card. Compared with the general monitoring system, the main feature of this system is that the field monitoring equipment can directly access the Internet, and the system uses Ethernet as the network transmission channel for monitoring information, and uses the inexpensive 51 series microcontroller as the MCU of the field monitoring equipment, and uses the open source μC/OS-Ⅱ real-time kernel as the software platform of the field monitoring equipment, which makes the system have a high cost performance. References: [1] Yang Wugang. Navigation of Typical Module Design Examples of Microcontrollers [M]. People's Posts and Telecommunications Press, 2004. 5 [2] Huang Ying, Zhang Xiaofei. Design and Implementation of Network Monitoring System [J]. Computer Engineering and Applications, 2003. 22 [3] Huang Letian, Xie Yi. Design of Practical High-Precision Intelligent Constant Temperature Heater System [J]. 2005, 10-1: 36-38 [4] Sun Yuan, Wang Shuiqing. Design of Ethernet-based embedded home monitoring network system [J]. Journal of Jiangnan University (Natural Science Edition) 2003. 1 [5] Zhou Wenju. Meter reading system based on single-chip microcomputer infrared wireless communication [J]. Microcomputer Information, 2006, 2-2: 45-47, 113