Skip to content

Commit 17acfdf

Browse files
authored
Revise MKR 485 communication tutorial
Updated tutorial on sending data between two MKR 485 Shields, including new sections on RS485 standard, differential signaling, and circuit connections.
1 parent 06e3979 commit 17acfdf

File tree

1 file changed

+43
-8
lines changed

1 file changed

+43
-8
lines changed

content/hardware/01.mkr/02.shields/mkr-485-shield/tutorials/mkr-485-communication/mkr-485-communication.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,48 @@ You can read more about the RS485 standard in the links below:
6868
- <a href="https://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/Basics-of-the-RS-485-Standard.aspx" target="_blank">Basics of the RS-485 standard</a>
6969
- <a href="https://www.virtual-serial-port.org/articles/modbus-vs-rs485/" target="_blank">Modbus vs RS485</a>
7070

71+
### Differential Signal
7172

72-
### Circuit
73+
RS485 doesn’t send data as a single voltage level like standard serial communication. Instead, it uses a differential signal: the information is carried by the voltage difference between the two wires, called A and B. This makes RS485 much more resistant to electrical noise, since any interference usually affects both wires equally and cancels out in the subtraction.
74+
75+
The receiver simply looks at the difference: if Voltage(A) – Voltage(B) is above a certain threshold, it reads a logic “1”. If the difference is below the threshold (meaning B is higher than A), it reads a logic “0”. For example, if A = 3.2 V and B = 1.0 V, then A – B = 2.2 V → logic “1”. If A = 1.0 V and B = 3.2 V, then A – B = –2.2 V → logic “0”.
76+
77+
In this way, the actual voltage values don’t matter as much — only the difference between the two lines is important. That’s why RS485 works reliably even over long cables and in electrically noisy environments.
78+
79+
### Termination
80+
81+
In an RS485 network, the wires carrying the signals act a bit like a long echoing hallway. When a signal reaches the end of the cable, it can “bounce back” if nothing is there to absorb it. This bounce is called a reflection, and it can distort communication, especially when the data rate is high or the cable is long.
82+
83+
To prevent this, we add a termination resistor (typically 120 Ω) at the end of the line. The resistor matches the impedance of the cable and “soaks up” the signal so it doesn’t reflect back. In a two-way (bidirectional) RS485 bus, you need termination resistors at both physical ends of the cable — in practice, this means at the RS485 shields that sit at the two ends of the network. If the setup is strictly one-way (only one sender), you only need the termination at the receiving shield.
84+
85+
On the Arduino RS485 Shield the termination resistors are already built in, so you don’t need to add any extra components. You simply enable them using the small DIP switch on the shield whenever that shield is at the physical end of the RS485 cable.
86+
87+
### Half and Full-Duplex Mode
88+
89+
In serial communication, duplex mode describes whether devices can send and receive data at the same time.
90+
• In half-duplex mode, communication goes both ways, but not simultaneously. It’s like a walkie-talkie: one side talks while the other listens, and then they switch. RS485 typically uses half-duplex, which means all devices share the same pair of wires (A and B). To avoid collisions, only one device should transmit at a time.
91+
• In full-duplex mode, communication can happen in both directions at the same time — more like a telephone. To achieve this with RS485, you need two pairs of wires: one pair for transmitting and another for receiving.
92+
93+
On the Arduino RS485 Shield, the MAX3157 transceiver is used. In half-duplex mode, only the Y and Z pins (the differential pair) are active and carry the data in both directions. In full-duplex mode, the other pair of pins (A/B) is used for the second direction, allowing simultaneous transmit and receive. This tutorial focuses on the half-duplex case, since it only requires two wires and works well for many applications where devices take turns sending data.
94+
Because RS485 uses a differential signal, the wires do not need to be crossed: just connect Y to Y and Z to Z between shields. The receiver always looks at Y – Z, so both ends correctly interpret the logic levels without swapping wires. If both devices are wired the same way (Y to Y, Z to Z), a logic “1” on the transmitter becomes a positive differential at the receiver, and a logic “0” becomes negative.
95+
96+
## Circuit
97+
98+
### ISO GND
99+
100+
The ISO GND on the Arduino RS485 shield is the isolated ground of the RS485 transceiver. Its purpose is to electrically isolate the RS485 bus from the Arduino’s main ground, which helps prevent ground loops and reduces noise, especially in industrial setups or long cable runs.
101+
102+
Even though this side of the transceiver is isolated, it still needs a reference point to interpret signals correctly. That’s why ISO GND must be connected to the ISO GND of the other devices on the RS485 bus. Without this connection, the differential signals would have no stable reference, and the receivers could misread logic “1” and “0”.
103+
104+
Think of ISO GND like agreeing on a zero point when measuring heights: everyone can measure accurately relative to the same baseline, even if each person stands on a different platform. Connecting ISO GND to ISO GND gives all devices on the bus a common reference while keeping them electrically isolated from the Arduino’s main ground.
105+
106+
### Connecting the Shields
73107

74108
For this tutorial, we will first need to mount the shields on top of the boards.
75109

76110
![Mounting the shields.](assets/MKR485_T1_IMG00.png)
77111

78-
We then need to follow the wire diagrams below. The wire from ISO GND is connected to the GND pin on the shield (not the ISO GND). Note that the connectors require a flathead screwdriver to connect.
112+
We then need to follow the wire diagrams below. The wire from ISO GND is connected to the ISO GND pin on the other shield. Note that the connectors require a flathead screwdriver to connect.
79113

80114
![Connecting the two shields together.](assets/MKR485_T1_IMG01.png)
81115

@@ -84,14 +118,14 @@ We will then need to make some configurations to the switches mounted on top of
84118
![Location of switches.](assets/MKR485_T1_IMG02.png)
85119

86120
For the sender, we need to change the switches to:
87-
- 1 - OFF
88-
- 2 - ON
89-
- 3 - ON
121+
- 1 - OFF: Termination for A/B disabled
122+
- 2 - OFF: Half-Duplex mode
123+
- 3 - OFF: Termination for Y/Z disabled (enable for bi-directional data transfer)
90124

91125
For the receiver, we need to change the switches to:
92-
- 1 - ON
93-
- 2 - ON
94-
- 3 - OFF
126+
- 1 - OFF: Termination for A/B disabled
127+
- 2 - OFF: Half-Duplex mode
128+
- 3 - ON: Termination for Y/Z enabled
95129

96130
The numbering is very small, but can be found on the switches.
97131

@@ -195,3 +229,4 @@ In this tutorial, we have created a communication line between two Arduino board
195229
While nowadays there are several ways of transmitting data between devices, using the RS485 standard is a great way for robust, industrial projects, where electrical noise and greater distances might be obstacles.
196230

197231
Feel free to explore the [ArduinoRS485](https://www.arduino.cc/en/Reference/ArduinoRS485) library further, and try out some of the many cool functions.
232+

0 commit comments

Comments
 (0)