Table of Contents
The difference between RS485 and RS232 |
RS485 is a serial communication standard that defines a way to communicate data between multiple points. This standard belongs to the EIA/TIA-485 standard and is jointly issued by the Electronic Industries Alliance (EIA) and the Telecommunications Industry Association (TIA). RS485 is commonly used in industrial control systems, automation equipment, instrumentation, building automation, and other applications that require long-distance, multi-point connections, and high immunity to interference.
Differential signal: RS485 uses two lines (A line and B line) for differential signal transmission, thereby improving anti-interference performance. Differential signaling means data is transmitted by comparing the voltage between two wires, which helps reduce the impact of electromagnetic interference on communications.
Multipoint connection: RS485 supports multipoint connection, allowing multiple devices to communicate on the same bus. Each device has a unique address and can communicate selectively.
Half-duplex or full-duplex: RS485 supports half-duplex (coordinating who sends and who receives) and full-duplex (simultaneous sending and receiving) communication methods, which is flexible.
Long distance communication: RS485 is capable of data transmission over longer distances, often up to thousands of feet. This makes it suitable for industrial and commercial environments where large areas need to be covered.
High data transmission rate: RS485 supports a variety of data transmission rates, ranging from hundreds of bits per second to tens of megabits per second, adapting to the needs of different applications.
Simplified cable structure: The RS485 bus can adopt a simplified cable structure to reduce wiring costs. Because of the characteristics of RS485 differential signals, its line quality requirements are relatively low.
Suitable for industrial environments: RS485 has good anti-electromagnetic interference and anti-noise capabilities, and is suitable for scenarios where interference and noise exist in industrial environments.
Flexibility: The flexibility of the RS485 communication protocol makes it suitable for a variety of applications, including industrial automation, building automation, smart homes, power systems and other fields.
Asynchronous communication: RS485 usually uses asynchronous communication, that is, the clocks of both parties do not need to be synchronized. This makes it easier to communicate between different devices.
Differential Signaling: RS485 uses differential signaling (two wires A and B) for communication. This means that data is transmitted by comparing the voltage between the two wires, which reduces the effects of electromagnetic interference.
Wiring:
Line A (non-inverted signal)
Line B (reverse signal)
There is usually also a ground wire (GND) as a reference.
Terminal resistor: It is usually necessary to add terminal resistors at both ends of the RS485 bus to reduce signal reflection and improve signal quality.
Multipoint connection: RS485 supports multipoint connection, which can connect multiple devices to communicate on the same bus.
The RS485 signal will be decomposed into two symmetrical positive and negative lines (often called A and B signal lines) before transmission. After arriving at the receiving end, both signals are restored to their original signals. The positive level between sending drivers A and B is +2~6V, which is a positive 1 logic state. The negative level is -2~6V, which is a negative 0 logic state. Another signal ground C. There is also an "enable" terminal in RS485. The "enable" terminal can control the disconnection and connection of the driver and the transmission line. When the "enable" terminal is valid, the transmit driver is in a high-impedance state, which is the third state different from logic "1" and "0".
The logic stipulates that the receiving end and the transmitting end are connected to AA and BB through balanced twisted pairs. When there is a level greater than +200mV between the receiving terminals AB (DT) = (D+)-(D-), a positive logic level is output. When less than -200mV, negative logic level is output. The levels received by the receiver typically range from 200mV to 6V.
For example: when sending "1", the driver receives the high level sent by the controller, then the A terminal outputs a high level and the B terminal outputs a low level. Terminal A of the receiver receives a high level, terminal B receives a low level, and the two signals are subtracted to obtain "1". When sending "0", the driver receives the low level sent by the controller, the receiver A terminal receives the low level, and the B terminal receives the high level, and the two signals are subtracted to obtain "0".
RS485 is a standard commonly used for serial communications to connect multiple devices over long distances (thousands of feet). Compared with RS232, RS485 has stronger anti-interference and the ability to support multi-point connections.
Level difference: RS232 uses a single voltage level (plus or minus 12V), while RS485 uses differential signals (for example, -5V to 5V).
Distance and multipoint connections: RS485 can transmit data over longer distances while supporting multipoint connections, while RS232 is generally suitable for shorter distance point-to-point connections.
Anti-interference: RS485 is more resistant to electromagnetic interference and noise, and is suitable for scenarios such as industrial environments that may be subject to external interference.
Rate: RS485 generally supports higher data transfer rates and is suitable for applications requiring greater bandwidth.
Terminal resistor: RS232 usually does not require terminal resistors, while RS485 requires terminal resistors at both ends of the bus to optimize signal quality.
Connection between RS485 and Modbus
RS485 and Modbus are two different but often used together concepts, involving the physical layer and communication protocol respectively. RS485 provides a reliable physical layer, and Modbus defines the rules for how to communicate on this physical layer. The combination of the two is often used to build reliable industrial automation and control systems.
Physical layer combination: RS485 provides physical layer specifications to provide reliable transmission in multi-point connections and long-distance communication environments. Modbus RTU is a communication protocol based on the RS485 physical layer.
Applicable fields: RS485 provides a reliable hardware foundation for communication, and Modbus defines the rules for how to communicate on this physical layer. They are usually used together in industrial control, automation systems, monitoring equipment and other fields.
Multipoint connection: The multipoint connection capability of RS485 provides Modbus with the basis to support communication between multiple devices. Therefore, in practical applications, Modbus usually implements multipoint connection on RS485.
Signal reflection problem
During the communication process, when the impedance is discontinuous or the impedance does not match, signal reflection will occur, which is the same as emission when light enters from one medium into another medium.
The impact of signal reflection on data transmission: The reflected signal triggers the comparator at the receiver input, causing the receiver to receive an incorrect signal, resulting in data acceptance errors.
Elimination of signal reflections
1. Make the impedance at the end of the cable the same as the characteristic impedance of the cable. Since the signal transmission on the cable is bidirectional, a terminal resistor of the same size can be connected across the other end of the communication cable. Generally, the impedance of cables is between 100-120 ohms, so the terminal resistor can be 120 ohms. In practice, since the characteristic impedance of the cable cannot be completely equal to the terminal resistance, more or less signal reflection will still exist;
2. Add a bias resistor, add a pull-up resistor to A, and add a pull-down resistor to B, so that the receiver output is fixed to 1 when the bus is idle. Otherwise, the reflected signal when the bus is idle may cause the receiver's output to go to 0, causing the controller to mistakenly think that new data is being sent.
Signal ground
Improper grounding often results in the electronic system not working stably or even endangering the safety of the entire system. In many cases, when connecting an RS485 communication link, one simply uses a pair of twisted pairs to connect the "A" and "B" ends of each interface, while ignoring the signal ground connection. This connection method is used in many situations. It works normally, but it creates a lot of hidden dangers.
Common mode interference problem
RS485 interfaces all use differential transmission signals and do not need to detect signals relative to a certain reference point. The system only needs to detect the potential difference between the two lines. However, people often ignore that the transceiver has a certain common-mode voltage range. For example, the common-mode voltage range of the RS485 transceiver is -7-+12V. Only when the above conditions are met, the entire network can work normally. When the common-mode voltage in the network line exceeds this range, it will affect the stability of communication and even damage the interface.
For example: when driver A sends data to B, the common mode voltage of the sending driver is Va. Since the two systems have independent system grounds, there is a ground potential difference Vg, then the common mode voltage Vb at the receiver input end will reach Vb= Va+Vg, although the RS485 standard stipulates Va<=3V, Vg may be very large, causing the common-mode input Vb of the receiver to exceed the normal range, causing the system to not work properly.
Solving common-mode interference: You can use a low-resistance signal to connect the two working grounds, so that the common-mode interference Vg is short-circuited, which can limit the common-mode interference. However, when the internal resistance of the interference source is relatively small, this method is not very effective because a large loop current will be formed on the ground wire. At this time, floating technology can be used to isolate the circuit ground of the system from the chassis or the earth.
Related article:
How to choose serial communication?
Common issues about Serial Communication
Why do we need to set the baud rate for serial communication?