Automatic address allocation device of RS485 slave equipment

By cascading the master control device with the RS485 slave device, automatic address allocation is achieved through level signal transmission, which solves the problems of complex operation, reliance on manual labor, and low efficiency in the existing technology, and realizes fast and accurate address allocation.

CN223899235UActive Publication Date: 2026-02-10SHENZHEN EX LIGHTING TECH HLDG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202520216486.6
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2026-02-10
Estimated Expiration
2035-02-11

AI Technical Summary

Technical Problem

Existing RS485 slave device address allocation devices are complex to operate, rely on manual labor, are inefficient, time-consuming, and unstable, especially prone to allocation failures in the case of multiple devices.

Method used

The master control device and RS485 slave devices are cascaded step by step via AB communication lines. The location of the slave device is determined by the internal level signal transmission, realizing automatic address allocation and avoiding manual intervention.

Benefits of technology

It achieves efficient and accurate allocation of RS485 slave device addresses, reduces operational complexity, and improves allocation speed and stability, making it suitable for multi-device scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN223899235U_ABST
    Figure CN223899235U_ABST
Patent Text Reader

Abstract

The utility model is applied to the field of address allocation of RS485 slave devices, in particular to automatic and rapid allocation of addresses of multistage RS485 slave devices. According to the automatic rapid distribution device for the addresses of the multistage RS485 slave devices, through the main control device and the plurality of RS485 slave devices which are in cascade connection, automatic distribution of the addresses of the RS485 slave devices of all grades is realized by utilizing level signals transmitted in a cascade structure, the complexity of manual distribution of the addresses of the slave devices is avoided, and the accuracy of address distribution is improved; furthermore, the address allocation speed is improved based on automatic judgment of the level signal; the AB communication line and the level signal transmission line are separately arranged, so that the interference degree of signals in the line is reduced; the device is simple in structure, the address distribution mode is accurate and efficient, and the defects that an existing RS485 slave device address distribution device is complex in operation, limited by equipment, low in efficiency, long in consumed time and unstable are overcome.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention is applied to the field of address allocation for RS485 slave devices, and particularly to the automatic and fast allocation of addresses for multi-level RS485 slave devices. Background Technology

[0002] The RS485 bus boasts advantages such as simple circuit design, high reliability, strong anti-interference capability, and long transmission distance, making it widely used in industrial field control, the Internet of Things, and multi-point long-distance monitoring. The RS485 master-slave communication feature requires that the slave device be configured with a unique device identifier, i.e., a device address.

[0003] Currently, there are four common address allocation methods for RS485 slave devices: one is through hardware settings such as DIP switches; the second is through the slave device's keypad and display screen, using a human-machine interface for input; the third is through computer serial port software to set the address; and the fourth is through algorithm calculation, using bus idle time and conflict detection mechanisms to allocate addresses.

[0004] However, the above four RS485 slave device address allocation devices have the following drawbacks: 1. Address allocation via DIP switches requires individual DIP switches for each slave device, which is cumbersome and cannot guarantee correct DIP switching each time, leading to address allocation failure. 2. Address allocation via a human-machine interface (HMI) using a keypad and display screen is only suitable for devices with displays, such as electricity meters, and has significant limitations, not applicable to most RS485 slave devices. 3. Setting via computer serial port software typically only allows setting the address of one slave device at a time, making it cumbersome, time-consuming, and laborious for multiple slave devices. 4. Algorithm calculation requires slave devices to repeatedly check the bus's idle state. With multiple slave devices, multiple simultaneous requests can occur, causing the bus to be continuously occupied, resulting in a long overall time consumption. Furthermore, the allocation process is highly unstable and prone to timeouts, leading to address allocation failure; therefore, this method is not conducive to rapid allocation.

[0005] As can be seen from the above, most commonly used RS485 slave device address allocation devices in the existing technology are limited by the equipment and suffer from drawbacks such as complex operation, reliance on manual labor, low efficiency, long time consumption, and instability. There is an urgent need for an automatic address allocation device for RS485 slave devices that does not rely on manual labor and improves allocation efficiency. Utility Model Content

[0006] To address the shortcomings of existing technologies, this invention proposes an automatic address allocation device for RS485 slave devices. In this device, the master control device and each RS485 slave device are cascaded step by step based on a common AB communication line. The cascaded connection structure enables the transmission of internal level signals, thereby determining the location of the slave device and achieving efficient address allocation. The address allocation process is automatically completed by the slave device without manual intervention, effectively solving the aforementioned shortcomings.

[0007] Specifically, this utility model provides an automatic address allocation device for RS485 slave devices. The device includes a master control device and N RS485 slave devices. The master control device and each RS485 slave device include AB communication lines. The master control device and each RS485 slave device are cascaded based on the common AB communication lines. N is a positive integer and N is greater than or equal to 1.

[0008] Furthermore, the master control device and each RS485 slave device are cascaded step by step based on a common AB communication line, which further includes: the master control device is a primary cascade device; the N RS485 slave devices together constitute a secondary cascade device; in the secondary cascade device, the RS485 slave device connected to the master control device is the first-level RS485 slave device, and each subsequent RS485 slave device is sequentially connected after the first-level RS485 slave device.

[0009] Furthermore, the master control device and each of the RS485 slave devices are cascaded step by step based on a common AB communication line, which further includes: each RS485 slave device includes an address line level signal input detection terminal, an address line level signal output terminal, two address line level signal ground terminals, and an AB communication line.

[0010] Furthermore, the first port inside each RS485 slave device includes the address line level signal input detection terminal and the address line level signal ground terminal; the second port inside each RS485 slave device includes the AB communication line; and the third port inside each RS485 slave device includes the address line level signal output terminal and another address line level signal ground terminal.

[0011] Furthermore, the master control device and each RS485 slave device are cascaded step-by-step based on a common AB communication line, further including: the first port of the first-level RS485 slave device is left floating; the third port of the first-level RS485 slave device is connected to the first port of the second-level RS485 slave device, ..., the third port of the (N-1)th level RS485 slave device is connected to the first port of the Nth level RS485 slave device, thereby realizing the cascaded connection; wherein, N is greater than or equal to 2.

[0012] Furthermore, the automatic address allocation device for the RS485 slave device implements address allocation according to the following signal transmission process, specifically including: the master control device sends a slave device address allocation broadcast command through the AB communication line; after each RS485 slave device receives the address allocation broadcast command, it pulls down the level of the address line level signal output terminal and simultaneously times the level change of the address line level signal input detection terminal; the address line level signal input detection terminal of the first-level RS485 slave device is left floating, and after time t, the first-level RS485 slave device cannot detect the level signal of the address line level signal input detection terminal, and the address of the first-level RS485 slave device is automatically set to 1; t is the detection time for confirming that the current RS485 slave device is the first-level RS485 slave device; among the multiple cascaded RS485 slave devices, the address of the next-level RS485 slave device is determined based on the level signal transmitted by the previous-level RS485 slave device.

[0013] Furthermore, the address of the next-level RS485 slave device is determined based on the level signal transmitted by the previous-level RS485 slave device, including: after a time of (N-1)*T, slave device N-1 stops pulling the address line level signal output terminal low. At the same time, slave device N detects a level signal change at the address line level signal input detection terminal for a duration of (N-1)*T. Slave device N determines that the address of the previous slave device is N-1 and sets its own address to N; N is greater than or equal to 2. Here, T is the time occupied by an RS485 slave device for address allocation; finally, all RS485 slave devices complete automatic address allocation, and the address numbers start from 1 and are allocated in ascending order.

[0014] Furthermore, t is half of T, that is, t = T / 2.

[0015] As can be seen from the above, this utility model is based on an automatic address allocation device for RS485 slave devices. Through a cascaded master control device and multiple RS485 slave devices, it utilizes the level signals transmitted within the cascaded structure to achieve automatic address allocation for RS485 slave devices at each level, avoiding the complexity of manual address allocation and improving the accuracy of address allocation. Furthermore, the automatic judgment based on the level signals improves the speed of address allocation. In each RS485 slave device, by separating the AB communication line from the level signal transmission line, the degree of signal interference in the line is avoided. The automatic address allocation device proposed in this utility model has a simple structure, accurate address allocation, and requires no manual intervention, solving the various defects of existing devices, such as complex operation, numerous equipment limitations, low efficiency, long time consumption, and instability.

[0016] In summary, the main technical effects of this utility model include the following:

[0017] 1. In the address allocation device for RS485 slave devices, each RS485 slave device only needs to add additional address line input and output ports. It has low resource requirements for RS485 slave devices and high versatility. While ensuring the simplicity of RS485 slave devices, it improves the information transmission efficiency between each RS485 slave device.

[0018] 2. The address allocation device of the RS485 slave device can automatically complete the address allocation process; based on the cascaded system architecture, the address allocation device of the RS485 slave device realizes automatic address allocation according to the step-by-step transmission of the level signal inside the cascaded structure, without manual intervention.

[0019] 3. The RS485 slave device address allocation device can efficiently complete the address allocation for multiple RS485 slave devices. For example, if the address allocation time T is set to 30ms, the total time for address allocation of 100 slave devices is about 3 seconds. The device has a short implementation time and high efficiency.

[0020] 4. The address allocation process of the RS485 slave device address allocation device is stable. The device operation allocation process does not depend on the communication line, and the address line input and output terminals of each slave device do not interfere with each other. The signal transmission has a dedicated transmission link, and the address allocation error will not be caused by the occurrence of interference signals. Attached Figure Description

[0021] To more clearly illustrate the technical solution of this utility model, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1This is a schematic diagram of an RS485 slave device structure provided in one of the embodiments of this utility model;

[0023] Figure 2 This is a wiring diagram of a master controller and an RS485 slave device provided in one of the embodiments of this utility model. Detailed Implementation

[0024] To make the above-mentioned objectives, features and advantages of this utility model more apparent and understandable, the utility model will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0025] Reference Figure 1 This is an internal structural diagram of the RS485 slave device of this utility model. Each RS485 slave device includes an address line level signal input detection terminal, an address line level signal output terminal, an address line level signal ground terminal, and an AB communication line.

[0026] Specifically, Figure 1 The Di terminal is the address line level signal input detection terminal, used to receive the input level signal; the Do terminal is the address line level signal output terminal, used to output the level signal; the two PGND terminals are the address line level signal ground terminals, used for grounding; the AB communication line includes an A communication terminal and a B communication terminal. The master control device and each RS485 slave device are connected to the AB communication line to realize broadcast command communication. The Di terminal and one of the PGND terminals together constitute the first port inside the RS485 slave device, the A and B communication terminals together constitute the second port inside the RS485 slave device, and the other PGND ground wire and the Do terminal together constitute the third port inside the RS485 slave device.

[0027] Reference Figure 2 This is a schematic diagram of the wiring between the master controller and the RS485 slave device provided in part of the embodiments of this utility model, that is, a schematic diagram of the automatic address allocation device of the RS485 slave device in this utility model.

[0028] like Figure 2 The wiring structure between the master control device and the RS485 slave device includes the master control device, RS485 slave device 1, RS485 slave device 3, RS485 slave device 3, ..., RS485 slave device N, where N is the total number of RS485 slave devices, and N is greater than or equal to 1.

[0029] The AB communication line in the master control device is connected to the AB communication line in each RS485 slave device to be controlled. Multiple RS485 slave devices form a cascaded connection structure. The first port (including the Di terminal and PGND terminal) of the first-level RS485 slave device is left floating. The third port (including the Do terminal and PGND terminal) of the first-level RS485 slave device is connected to the first port (including the Di terminal and PGND terminal) of the second-level RS485 slave device. The third port (including the Do terminal and PGND terminal) of the second-level RS485 slave device is connected to the first port (including the Di terminal and PGND terminal) of the third-level RS485 slave device, and so on. The third port (including the Do terminal and PGND terminal) of the Nth-level RS485 slave device is connected to the first port (including the Di terminal and PGND terminal) of the N+1th-level RS485 slave device, forming a cascaded connection structure of multiple RS485 slave devices.

[0030] Each RS485 slave device internal structure reference Figure 1 As shown, the Di terminal, which is the address line level signal input detection terminal, is used to detect the duration of the address line level signal change output by the previous slave device; the Do terminal, which is the address line level signal output terminal, is used to output the address line level signal to the next slave device; the PGND terminal, which is the address line level signal ground, is used to ensure that the address signal lines of all slave devices share a common ground; in addition, when the slave device is not in address allocation, both the output and input terminals of the address lines are in a high-level state.

[0031] Based on the internal structure of each RS485 slave device described above, this utility model only requires additional address line input and output ports for each RS485 slave device. Compared with the internal structure of other RS485 slave devices, it has low resource requirements for RS485 slave devices and high versatility. While ensuring the simplicity of RS485 slave devices, it improves the information transmission efficiency between each RS485 slave device.

[0032] The working principle steps of the RS485 slave device address allocation device in this embodiment of the utility model are as follows:

[0033] For ease of description, this utility model names the slave devices under the master RS485 device as slave device 1, slave device 2, slave device 3... in sequence according to the wiring order;

[0034] First, the master control device sends a broadcast command for assigning slave device addresses via the RS485 AB communication line;

[0035] Afterwards, once all slave devices receive the address allocation broadcast command, they begin to pull down the level of the address line level signal output terminal and simultaneously time the level change of the address line level signal input detection terminal;

[0036] If the address line level signal input detection terminal of device 1 is left floating, after time t, since no wiring is needed, device 1 will not detect the level signal at the address line level signal input detection terminal. Therefore, the address of device 1 will be automatically set to 1. Here, t is the detection time for confirming that the current RS485 slave device is a first-level RS485 slave device.

[0037] In a cascaded connection of multiple slave devices, the address of the next-level slave device is determined based on the level signal transmitted by the previous-level slave device, as follows:

[0038] After time T, slave device 1 stops pulling the address line level signal output terminal low. At the same time, slave device 2 detects that the address line level signal input terminal level signal changes for a duration of T. Therefore, slave device 2 determines that the address of the previous slave device is 1, and thus sets its own address to 2.

[0039] After 2T elapsed, slave device 2 stopped pulling the address line level signal output terminal low. At the same time, slave device 3 detected that the level signal change at the address line level signal input detection terminal lasted for 2T. Therefore, slave device 3 determined that the address of the previous slave device was 2, and thus set its own address to 3.

[0040] When 3T elapses, slave device 3 stops pulling the address line level signal output terminal low. At the same time, slave device 4 detects that the level signal change at the address line level signal input detection terminal lasts for 3T. Therefore, slave device 4 determines that the address of the previous slave device is 3, and thus sets its own address to 4.

[0041] Following this pattern, after a time of (N-1)*T, slave device N-1 stops pulling the address line level signal output terminal low. At the same time, slave device N detects that the level signal change at the address line level signal input detection terminal lasts for (N-1)*T. Therefore, slave device N determines that the address of the previous slave device is N-1, and thus sets its own address to N; N is greater than or equal to 2.

[0042] Following this method, subsequent slave devices sequentially determine and set their own addresses according to time interval T. Finally, all RS485 slave devices complete automatic address allocation, with address numbers starting from 1 and allocated in ascending order. The address line level signal output terminal of the last slave device is left floating.

[0043] Specifically, in the embodiments of this utility model, T is the time occupied by an RS485 slave device in address allocation, and t is the detection time for confirming that the current RS485 slave device is a first-level RS485 slave device, which can be half of T, i.e., t = T / 2.

[0044] As can be seen from the above, the RS485 slave device address allocation device of this utility model, based on its internal cascaded structure, can automatically complete the address allocation process. Based on the cascaded system architecture, the RS485 slave device address allocation device achieves automatic address allocation according to the step-by-step transmission of level signals within the cascaded structure, without manual intervention. Furthermore, the RS485 slave device address allocation device can efficiently complete the address allocation for multiple RS485 slave devices. For example, if the address allocation time T is set to 30ms, the total time for address allocation of 100 slave devices is approximately 3 seconds; the device has a short implementation time and high efficiency. The address allocation process of the RS485 slave device address allocation device of this utility model is stable. The device operation and allocation process do not rely on communication lines, and the address line input and output terminals of each slave device do not interfere with each other; signal transmission has a dedicated transmission link, preventing address allocation errors due to interference signals.

[0045] The same or similar parts among the various embodiments in this specification can be referred to interchangeably. The above-described embodiments of this utility model do not constitute a limitation on the scope of protection of this utility model.

[0046] The above embodiments are merely preferred embodiments of this utility model, but the protection scope of this utility model is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this utility model should be included within the protection scope of this utility model. Therefore, the protection scope of this utility model should be determined by the scope of the claims.

Claims

1. An automatic address allocation device for an RS485 slave device, characterized in that, The device includes a master control device and N RS485 slave devices; Each of the RS485 slave devices includes a first port, a second port, and a third port; for N RS485 slave devices, the third port of the previous slave device is connected to the first port of the next slave device; The master control device and each of the RS485 slave devices each include an AB communication line. The AB communication line of the master control device is connected to the AB communication line of each of the RS485 slave devices, so that the master control device and each of the RS485 slave devices are cascaded in sequence. Where N is a positive integer and N is greater than or equal to 1.

2. The apparatus according to claim 1, characterized in that, The master control device is a primary cascaded device, and N RS485 slave devices together constitute a secondary cascaded device; In the secondary cascaded devices, the RS485 slave device connected to the master control device is the first-level RS485 slave device, and each subsequent RS485 slave device is connected sequentially after the first-level RS485 slave device.

3. The apparatus according to claim 2, characterized in that, Each of the RS485 slave devices includes an address line level signal input detection terminal, an address line level signal output terminal, two address line level signal ground terminals, and an AB communication line.

4. The apparatus according to claim 3, characterized in that, Each of the RS485 slave devices includes an address line level signal input detection terminal and an address line level signal ground terminal at its internal first port. Each of the RS485 slave devices includes the AB communication line in its internal second port; Each of the RS485 slave devices has a third port that includes an address line level signal output terminal and another address line level signal ground terminal.

5. The apparatus according to claim 2, characterized in that, The first port of the first-level RS485 slave device is left floating.

6. The apparatus according to claim 3, characterized in that, The master control device is used to issue broadcast commands for slave device address allocation; Each of the RS485 slave devices simultaneously receives the slave device address allocation broadcast command via its AB communication line.