Intelligent gateway and control method thereof
By designing an intelligent gateway with rich interfaces, the conversion problem of CAN protocol signals and Ethernet and RS485 format signals is solved, and the collection and transmission of external analog signals is realized, meeting the control needs of various scenarios.
Patent Information
- Application Number
- CN202411588657.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art cannot convert CAN protocol signals with Ethernet and RS485 format signals, and cannot collect and transmit external analog signals.
Design an intelligent gateway, including a rich interface, such as CAN interface, Ethernet interface, RS485 interface and analog signal interface, to realize signal conversion and processing through MCU chips and driver circuits.
It realizes the conversion of CAN protocol signals with Ethernet and RS485 format signals, and can collect and transmit external analog signals, meeting the control and use needs of various scenarios.
Smart Images

Figure CN119449532A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network equipment, and in particular to an intelligent gateway and a control method thereof. Background Art
[0002] The gateway is an indispensable part of modern communication technology. It acts as a bridge between different networks such as the Internet and local area network, making communication between different networks more convenient and efficient. Usually, the gateway module can realize the function of converting CAN network data to Ethernet data. However, with the development of ship technology, the demand for signal transmission is getting higher and higher, and RS485 format data transmission is derived. In addition, the traditional gateway module can only realize the interactive communication of network digital signal data, and cannot realize the collection and transmission of gateway and external analog data.
[0003] In the prior art, the Chinese patent document with application number 202210426403.7 records an intelligent gateway for the Internet of Things. By setting up an oil-cooled radiator and a convection cooling pipe structure, the cooling oil is controlled by electromagnetic drive to cool the integrated processing board and the cooling oil itself in the gateway device through the heat dissipation pipe inside and outside the machine box body, respectively, to achieve an oil-cooled circulation cooling effect. This patent mainly optimizes the heat dissipation function of the intelligent gateway, but lacks breakthroughs in the functionality of the gateway. The Chinese patent document with application number 202223284297.8 records an intelligent gateway for Internet security that can prevent the connector from being separated from the interface, so that the intelligent gateway can achieve a stable data connector connection, improve Internet security, but still cannot realize the collection and transmission of analog signals. Therefore, how to realize the conversion of CAN protocol signals with Ethernet and RS485 format signals, and the collection and transmission of external analog signals has become an urgent problem to be solved. Summary of the invention
[0004] In order to solve the technical problem of conversion between CAN protocol signals and Ethernet and RS485 format signals, and realize the collection and transmission of external analog signals, the present invention provides an intelligent gateway system and gateway device, which realizes the conversion between CAN protocol signals and Ethernet and RS485 format signals, and realizes the collection and transmission of external analog signals.
[0005] The specific scheme of the present invention is as follows:
[0006] In a first aspect, an intelligent gateway comprises: a shell, a motherboard installed inside the shell, a main CPU board plugged into the motherboard, and an Ethernet expansion board; the main CPU board is provided with an MCU chip and a drive circuit, the MCU chip is electrically connected to the drive circuit, and is connected to a first type of expansion interface through the drive circuit, the drive circuit is connected to the Ethernet expansion board through the motherboard, the Ethernet expansion board is provided with an Ethernet interface chip and an AD conversion chip, and is electrically connected to a second type of expansion interface; the first type of expansion interface comprises a power supply interface, a PWM interface, a GPIO interface, and a CAN interface, and the second type of expansion interface comprises an RJ45 interface, an RS485 interface, a current signal ADC interface, and a current signal DAC interface.
[0007] Preferably, the driving circuit is connected to the Ethernet expansion board via the motherboard, including: the main CPU board and the Ethernet expansion board are both electrically connected to the connection socket of the motherboard via a wiring plug; the wiring plug is provided with P1 and P2 expansion interfaces, and the P1 expansion interface includes an SPI interface.
[0008] Preferably, the PWM interface includes 4 frequency signal input interfaces; the GPIO interface includes 6 switch signal input interfaces, 11 switch output interfaces and 8 LED indicator lights; the CAN interface includes 4 CAN communication interfaces; the RJ45 interface includes two RJ45 Ethernet interfaces; the RS485 interface includes 2 RS485 communication interfaces; the current signal ADC interface includes 7 current signal input interfaces; and the current signal DAC interface includes 8 current signal output interfaces.
[0009] Preferably, the 4-channel frequency signal input interface adopts CAN2.0B communication protocol, the baud rate is 125Kbps, 2 batches of data are sent per second, and the maximum communication transmission distance is 600 meters.
[0010] Preferably, the MCU chip is an LPC1778 processor.
[0011] Preferably, the Ethernet interface chip is of W5500 model, and TCP / IP protocol communication is implemented through an RJ45 Ethernet interface.
[0012] Preferably, the power supply circuit is connected to a 24V power supply interface.
[0013] Preferably, the operating environment temperature of the gateway is -10°C to 55°C.
[0014] Preferably, the shell has dimensions of 251 mm in length, 110 mm in width and 147 mm in height.
[0015] In a second aspect, a smart gateway control method includes:
[0016] S1. Gateway initialization: After power-on, the hardware and software of the gateway are initialized, including hardware initialization, parameter initialization, interrupt initialization and scheduler initialization;
[0017] S2. Create a gateway task: After completing the initialization, create various gateway tasks according to the gateway function requirements;
[0018] S3 scheduler start: the gateway task is generated according to the priority task list, start the time-based trigger collaborative multi-task scheduler, the time-based trigger refers to the divided time slices by turn scheduling tasks;
[0019] S4. Multi-task scheduling: The scheduler performs multi-task scheduling in accordance with the task list within the time slice;
[0020] S5. Polling and maintenance: The scheduler polls the status of the gateway task and system resources, dynamically adjusts the priority of the gateway task and performs maintenance.
[0021] Preferably, the hardware initialization includes initialization of a reset circuit and a drive module; the parameter initialization includes configuration of a CAN bus, PWM parameters and timer settings; and the interrupt initialization includes setting interrupt priorities and a vector table.
[0022] Preferably, the various gateway tasks include IO tasks, network communication tasks, watchdog tasks, data processing tasks and error handling tasks.
[0023] Preferably, the time interval of the time slice is 10 ms.
[0024] Preferably, the scheduler in S5 polls the gateway task status and system resources, dynamically adjusts the priority of the gateway task and performs maintenance, including:
[0025] Regularly monitor the watchdog task to ensure the normal state of the system; when an abnormality or timeout occurs, perform a reset operation or execute the error handling task;
[0026] During the execution of the gateway task, the task list and the priority in the scheduler are updated to complete dynamic adjustment.
[0027] Beneficial effects of the present invention:
[0028] The present invention provides an intelligent gateway, comprising: a shell, a motherboard installed inside the shell, a main CPU board plugged into the motherboard, and an Ethernet expansion board; the main CPU board is arranged with an MCU chip and a drive circuit, the MCU chip is electrically connected to the drive circuit, and is connected to a first type of expansion interface through the drive circuit, the drive circuit is connected to the Ethernet expansion board through the motherboard, and the Ethernet expansion board is electrically connected with an Ethernet interface chip, an AD conversion chip, and a second type of expansion interface; wherein the first type of expansion interface includes a power supply interface, a PWM interface, a GPIO interface, and a CAN interface; the second type of expansion interface includes an RJ45 interface, an RS485 interface, a current signal ADC interface, and a current signal DAC interface. The gateway is designed with a rich interface, and through the interactive communication of various types of network digital quantity signal data, the conversion of CAN protocol signals and Ethernet and RS485 format signals is solved, and the collection and transmission of various types of external analog quantity data are realized. In particular, the gateway hardware interface resources are rich, and any interface that meets the interface requirements can be used. It can be used for control and use in a variety of scenarios. The Ethernet interface can be used to access the integrated network remote control, and can be connected to multiple devices for joint control. It can be connected to the debugging software through the CAN bus to facilitate equipment maintenance. It supports 6-way switch input and has a disconnection detection function.
[0029] The present invention also relates to an intelligent gateway control method, which performs gateway initialization, gateway task creation, scheduler startup, multi-task scheduling, and polling and maintenance steps in sequence, and uses a scheduler based on a time-triggered design pattern to realize collaborative multi-task processing, completes the collection of current signals, PWM signals, and switch input signals, and real-time control of switch signal output and current signal output, CAN bus message reception and transmission, Ethernet message reception and transmission, RS485 format data reception and transmission, and EEPROM reading and writing, thereby realizing interactive communication of various types of network digital signal data. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A structural framework diagram of an intelligent gateway provided by the present invention.
[0031] Figure 2 A schematic diagram of the hardware interface of an intelligent gateway provided by the present invention
[0032] Figure 3 Three views of the appearance of an intelligent gateway provided by the present invention.
[0033] Figure 4 The present invention provides a flow chart of an intelligent gateway control method.
[0034] Figure 5 A detailed execution flow chart of an intelligent gateway control method provided by the present invention. DETAILED DESCRIPTION
[0035] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0036] Figure 1 A structural framework diagram of an intelligent gateway provided by the present invention, such as Figure 1 As shown, an intelligent gateway comprises: a housing, a motherboard installed inside the housing, a main CPU board plugged into the motherboard, and an Ethernet expansion board;
[0037] The main CPU board is provided with an MCU chip and a driving circuit, the MCU chip is electrically connected to the driving circuit, and is connected to the first type of expansion interface through the driving circuit, the driving circuit is connected to the Ethernet expansion board through the motherboard, the Ethernet expansion board is provided with an Ethernet interface chip and an AD conversion chip, and is electrically connected to the second type of expansion interface;
[0038] The first type of expansion interface includes power interface, PWM interface, GPIO interface and CAN interface, and the second type of expansion interface includes RJ45 interface, RS485 interface, current signal ADC interface and current signal DAC interface.
[0039] The gateway provided in this application is designed with rich interfaces, and through the interactive communication of various types of network digital signal data, it can solve the conversion between CAN protocol signals and Ethernet and RS485 format signals, and realize the collection and transmission of various types of external analog data. The gateway hardware interface resources are rich, and can be used to meet the interface requirements. It can be used for control and use in various scenarios. The Ethernet interface can be connected to the integrated network remote control, and can be connected to multiple devices for joint control. It can be connected to the debugging software through the CAN bus, which is convenient for equipment maintenance, supports 6-way switch input, and has a disconnection detection function.
[0040] Specifically, the driving circuit is connected to the Ethernet expansion board through the motherboard, including: the main CPU board and the Ethernet expansion board are electrically connected to the connection socket of the motherboard through a wiring plug; the wiring plug is provided with P1 and P2 expansion interfaces, and the P1 expansion interface includes an SPI interface.
[0041] In some embodiments, the current signal transmitted by the external device is collected through the current input functional circuit, and the current signal is converted into a corresponding voltage signal through a sampling resistor to ensure that the signal is proportional to the current size; the converted voltage signal is transmitted to the AD conversion chip ADS1248; then ADS1248 converts the analog voltage signal into a digital signal, and transmits it to the main CPU board through the SPI interface in the P1 expansion interface, so as to achieve accurate collection and reading of the input current signal. The current output functional circuit converts the digital control command of the main CPU board into the current signal required by the external device, and the main CPU board transmits the digital command signal to the digital-to-analog converter MAX5306 through the SPI interface of the P1 expansion interface; then MAX5306 converts the digital signal into an analog voltage signal, and then performs voltage amplification through a subsequent amplifier circuit, and finally outputs the amplified signal in the form of current to drive the connected external device to ensure that the current demand of the load is met.
[0042] Specifically, the PWM interface includes 4 frequency signal input interfaces; the GPIO interface includes 6 switch signal input interfaces, 11 switch output interfaces and 8 LED indicator lights; the CAN interface includes 4 CAN communication interfaces; the RJ45 interface includes two RJ45 Ethernet interfaces; the RS485 interface includes 2 RS485 communication interfaces; the current signal ADC interface includes 7 current signal input interfaces; and the current signal DAC interface includes 8 current signal output interfaces.
[0043] like Figure 2As shown, in some embodiments, the external interface of the intelligent gateway design mainly includes: 4-way frequency signal input interface, supporting square wave and sine wave signal input, each channel can receive pulse width modulation (PWM) signal, and is compatible with different waveform types, for detecting and processing the input of external PWM signal; 6-way switch input interface, for receiving switch signal of external device, each channel can detect high and low level state to reflect the opening and closing state of switch device, for monitoring external switch, button, limit switch and other digital input signals, with disconnection detection function, terminal resistance 50KΩ; 11-way switch output interface, supporting normally open / normally closed mode switching, each channel can output switch signal, with normally open or normally closed state selection, for controlling the on and off operation of external device, to meet various application requirements. 4-way CAN communication interface, supporting controller area network (CAN) protocol, used to achieve multi-channel data communication, each channel works independently, can exchange data with external devices in real time, meet the needs of reliable communication, and can also be connected to the debugging software through the CAN bus, which is convenient for equipment debugging and maintenance; 2-way RJ45 Ethernet interface, used to achieve high-speed network communication through standard Ethernet protocol, can send and receive UDP and TCP format data, this interface supports connection to LAN or WAN, suitable for data transmission, remote monitoring, equipment networking and other applications, providing reliable wired network connection; 2-way RS485 communication interface, used to achieve RS485 standard serial communication, each interface supports multi-device connection, suitable for long-distance, anti-interference communication needs; 7-way current input interface, supporting 4-20mA standard signal, each channel can receive 4-20mA current signal input, used to accurately measure and process the current signal of external sensors or equipment; 8-way current output interface, supporting 4-20mA standard signal, each channel can output 4-20mA current signal, used to drive external devices or sensors, meeting the control system's needs for analog output.
[0044] like Figure 3 As shown, the lower part of the gateway is in the shape of a rectangular parallelepiped, and the upper part is in a trapezoidal structure. The above-mentioned interfaces are distributed on the inclined surface of the trapezoid on the upper part of the shell, which is convenient for plugging in cables during use.
[0045] Specifically, the 4-channel frequency signal input interface adopts the CAN2.0B communication protocol, the baud rate is 125Kbps, 2 batches of data are sent per second, and the maximum communication transmission distance is 600 meters.
[0046] Specifically, the MCU chip is an LPC1778 processor.
[0047] Specifically, the Ethernet interface chip is of the W5500 model, and TCP / IP protocol communication is implemented through the RJ45 Ethernet interface.
[0048] In some embodiments, the MCU chip on the main CPU board uses NXP's LPC1778 processor, and the Ethernet expansion board uses WIZnet's W5500 Ethernet interface chip. TCP / IP protocol communication is implemented through two RJ45 Ethernet interfaces, providing the system with efficient and stable network connection and providing the gateway with reliable data transmission capabilities.
[0049] Specifically, the power supply circuit is connected to a 24V power supply interface.
[0050] In some embodiments, the gateway controller is powered by a 24 VDC power supply.
[0051] Specifically, the operating environment temperature of the gateway is -10°C to 55°C.
[0052] Specifically, the shell dimensions are 251 mm in length, 110 mm in width, and 147 mm in height.
[0053] Figure 4 A flow chart of an intelligent gateway control method provided by the present invention, Figure 5 The following is a detailed execution flow chart of a smart gateway control method provided by the present invention. Figure 4 , 5 As shown, a smart gateway control method includes:
[0054] S1. Gateway initialization: After power-on, the hardware and software of the gateway are initialized, including hardware initialization, parameter initialization, interrupt initialization and scheduler initialization.
[0055] Specifically, the hardware initialization includes initialization of a reset circuit and a drive module; the parameter initialization includes configuration of a CAN bus, PWM parameters and timer settings; and the interrupt initialization includes setting interrupt priorities and a vector table.
[0056] In some embodiments, after power-on, the gateway is initialized, specifically including: loading the basic hardware configuration of the gateway system, including the main CPU board, expansion board, power module, etc., to ensure that each hardware module can work normally; setting the initial parameters required by the system, including communication protocol configuration (such as CAN bus baud rate, RS485 address), task scheduling parameters (such as time slice length) and control parameters of the gateway device; configuring interrupt priority and interrupt vector table to ensure that the gateway system can respond to external interrupt events in a timely manner during task execution; configuring the time base of the scheduler, and realizing a time-triggered scheduling mode by setting a system timer, laying a solid foundation for subsequent multi-task management.
[0057] S2. Create gateway tasks: After completing the initialization, create various gateway tasks according to the gateway function requirements.
[0058] Specifically, the various gateway tasks include IO tasks, network communication tasks, watchdog tasks, data processing tasks and error handling tasks.
[0059] In some embodiments, after completing the above initialization, various gateway tasks are created, among which, IO tasks: used to collect input signals, such as current, PWM and switching signals, and control output signals, such as current output and switching output; network communication tasks: responsible for processing the communication interfaces of Ethernet, CAN bus and RS485, realizing the data sending and receiving functions, and ensuring that the gateway can communicate with external devices; watchdog tasks: monitoring the operating status of the system to prevent the task from being unresponsive for a long time, and triggering a system reset if an abnormality is encountered to ensure system stability; data processing tasks: pre-processing and calculating the collected raw data, including filtering, denoising and statistical analysis, to provide support for system control or communication; error handling tasks: used to detect and record hardware or software fault information, and perform automatic repair operations (such as restarting the communication interface, reinitializing parameters, etc.) to ensure the continuous operation of the system.
[0060] S3 scheduler start: the gateway task is generated according to the priority task list, start the time-based trigger collaborative multi-task scheduler, the time-based trigger refers to the divided time slices by turn scheduling tasks;
[0061] Specifically, the time interval of the time slice is 10 ms.
[0062] S4. Multi-task scheduling: The scheduler performs multi-task scheduling in accordance with the task list within the time slice;
[0063] In some embodiments, within each time slice, the input signal of the sensor is collected, and the collected data is sent to the CPU, or the output signal is adjusted according to the control requirements; data sending and receiving operations are performed on the communication interface to ensure the stability of the connection of each interface; and under the control requirements, data processing, status monitoring and predetermined computing tasks are performed regularly.
[0064] S5. Polling and maintenance: The scheduler polls the status of the gateway task and system resources, dynamically adjusts the priority of the gateway task and performs maintenance.
[0065] Specifically, the scheduler polls the gateway task status and system resources, dynamically adjusts the priority of the gateway task and performs maintenance, including:
[0066] Regularly monitor the watchdog task to ensure the normal status of the system; when an abnormality or timeout occurs, perform a reset operation or execute the error handling task; during the execution of the gateway task, update the task list and the priority in the scheduler to complete dynamic adjustment.
[0067] In some embodiments, the scheduler adjusts the priority of the task according to the real-time needs of the task to ensure that high-priority tasks are processed in a timely manner; and continuously monitors the usage of system resources to ensure that tasks run within a reasonable resource range to prevent resource overload; when a task timeout or resource abnormality is detected, the error handling task is started for self-repair, or the watchdog task is triggered to reset the system to ensure the continuous operation of the system.
[0068] It should be noted that the above-described specific implementations can enable those skilled in the art to more fully understand the invention, but do not limit the invention in any way. Therefore, although this specification has described the invention in detail with reference to the drawings and embodiments, those skilled in the art should understand that the invention can still be modified or replaced by equivalents. In short, all technical solutions and improvements that do not deviate from the spirit and scope of the invention should be included in the protection scope of the patent for the invention.
Claims
1. An intelligent gateway, characterized in that: include: A housing, a motherboard installed inside the housing, a main CPU board plugged into the motherboard, and an Ethernet expansion board; The main CPU board is provided with an MCU chip and a driving circuit, the MCU chip is electrically connected to the driving circuit, and is connected to the first type of expansion interface through the driving circuit, the driving circuit is connected to the Ethernet expansion board through the motherboard, the Ethernet expansion board is provided with an Ethernet interface chip and an AD conversion chip, and is electrically connected to the second type of expansion interface; The first type of expansion interface includes a power supply interface, a PWM interface, a GPIO interface and a CAN interface, and the second type of expansion interface includes an RJ45 interface, an RS485 interface, a current signal ADC interface and a current signal DAC interface.
2. The intelligent gateway according to claim 1, characterized in that: The driving circuit is connected to the Ethernet expansion board through the motherboard, including: the main CPU board and the Ethernet expansion board are electrically connected to the connection socket of the motherboard through a wiring plug; the wiring plug is provided with P1 and P2 expansion interfaces, and the P1 expansion interface includes an SPI interface.
3. The intelligent gateway according to claim 1, characterized in that: The PWM interface includes 4 frequency signal input interfaces; The GPIO interface includes 6 switch signal input interfaces, 11 switch output interfaces and 8 LED indicator lights; The CAN interface includes 4 CAN communication interfaces; The RJ45 interface includes two RJ45 Ethernet interfaces; The RS485 interface includes 2-way RS485 communication interfaces; The current signal ADC interface includes 7 current signal input interfaces; The current signal DAC interface includes 8 current signal output interfaces.
4. The intelligent gateway according to claim 3, characterized in that: The 4-channel frequency signal input interface adopts CAN2.0B communication protocol, the baud rate is 125Kbps, 2 batches of data are sent per second, and the maximum communication transmission distance is 600 meters.
5. The intelligent gateway according to claim 1, characterized in that: The MCU chip is an LPC1778 processor.
6. The intelligent gateway according to claim 6, characterized in that: The Ethernet interface chip is of W5500 model, and the communication of TCP / IP protocol is realized through the RJ45 Ethernet interface.
7. The intelligent gateway according to any one of claims 1 to 6, characterized in that: The power supply interface is a 24V power supply interface.
8. The intelligent gateway according to claim 7, characterized in that: The operating environment temperature of the gateway is -10°C to 55°C.
9. The intelligent gateway according to claim 7, characterized in that: The dimensions of the housing are 251 mm in length, 110 mm in width and 147 mm in height.
10. A smart gateway control method implemented based on the smart gateway according to any one of claims 1 to 9, characterized in that: include: S1. Gateway initialization: After power-on, the hardware and software of the gateway are initialized, including hardware initialization, parameter initialization, interrupt initialization and scheduler initialization; S2. Create a gateway task: After completing the initialization, create various gateway tasks according to the gateway function requirements; S3 scheduler start: the gateway task is generated according to the priority task list, start the time-based trigger collaborative multi-task scheduler, the time-based trigger refers to the divided time slices by turn scheduling tasks; S4. Multi-task scheduling: The scheduler performs multi-task scheduling in accordance with the task list within the time slice; S5. Polling and maintenance: The scheduler polls the status of the gateway task and system resources, dynamically adjusts the priority of the gateway task and performs maintenance.
11. The intelligent gateway control method according to claim 10, characterized in that: The hardware initialization includes reset circuit and drive module initialization; the parameter initialization includes CAN bus configuration, PWM parameters and timer setting; the interrupt initialization includes setting interrupt priority and vector table.
12. The intelligent gateway control method according to claim 10, characterized in that: The various gateway tasks include IO tasks, network communication tasks, watchdog tasks, data processing tasks and error handling tasks.
13. The intelligent gateway control method according to claim 10, characterized in that: The time interval of the time slice is 10ms.
14. The intelligent gateway control method according to claim 10, characterized in that: The scheduler in S5 polls the gateway task status and system resources, dynamically adjusts the priority of the gateway task and performs maintenance, including: Regularly monitor the watchdog task to ensure the normal state of the system; when an abnormality or timeout occurs, perform a reset operation or execute the error handling task; During the execution of the gateway task, the task list and the priority in the scheduler are updated to complete dynamic adjustment.
Citation Information
Patent Citations
Intelligent gateway for Internet of Things
CN115134195A
Intelligent gateway for Internet security
CN218243550U