I am trying to connect a Unitronics Jazz2 PLC (JZ20-R16) and an Arduino Uno using the Modbus protocol, over RS232 interface.
I've got all the required connectors for both Arduino (TTL-RS232 MAX3232 converter as the one below) and Unitronics (JZ20-PRG with JZ10-22-CS10 RS232 connector).
The PLC is configured to be master, the Arduino is slave. Configuration is 8N1. Both units operate very well while connected to ModbusSimulators (from modbustools.com).
I connect these devices to the PC using a RS232-USB converter. The problem is that the PLC requires DTR and DSR signals. As you can see from the schematic, the TTL-RS232 converter I've used can't provide such signals.
Here's the screenshot of succesfull data stransfer between the PLC and a PC simulator:
As you can see, CH3/4 (DTR/DTS) are required to be high in order for the PLC to communicate over Modbus. But, as I've said, the TTL-RS232 converter can't give high DTR/DTS signals. Any idea if there is a chance to tweak this? I've tried to hook DTR/DTS pins of the PLC to +5 V, but no luck.
2 Answers 2
The standard technique is to loopback as shown below. This provides the missing signals.
Connector 1 Connector 2 Function
2 3 Rx --> Tx
3 2 Tx --> Rx
5 5 Signal ground
1 + 4 + 6 - DTR --> CD + DSR
- 1 + 4 + 6 DTR --> CD + DSR
7 + 8 - RTS --> CTS
- 7 + 8 RTS --> CTS
Source: Lammert Bies.
In your case you only need to loopback at the PC end.
Does the PLC and Arduino have the same ground level?
What does the signals look like on the oscilloscope when PLC and Arduino try to communicate?
In other words - are you sure that the DTR/DTS lines are the cause for the problem? Try to replicate the scenario that is seen when you connect the units to the PC, probe the communication lines, and check if they look the same.
-
\$\begingroup\$ Ground levels of both PLC and Arduino are the same due to "signal ground" pin (5) connected on both DB9 connectors. I've also managed to find out that the DTR/DTS lines are not used in the PLC I'm operating, they are used for powering up the rs232 module (MJ20-PRG). When I feed +5V to both of the lines, the PLC can communicate with PC using only TX/RX and "signal ground" lines. \$\endgroup\$Svjatoslavs Krasnikovs– Svjatoslavs Krasnikovs2017年07月19日 14:59:20 +00:00Commented Jul 19, 2017 at 14:59
-
\$\begingroup\$ But when I do the same but connect arduino, the communication can not happen. \$\endgroup\$Svjatoslavs Krasnikovs– Svjatoslavs Krasnikovs2017年07月19日 14:59:57 +00:00Commented Jul 19, 2017 at 14:59
-
\$\begingroup\$ So, it is not the handshake that is the problem. Try probing the lines when plc and Arduino is wired and tries to communicate. what does it look like? \$\endgroup\$MrGerber– MrGerber2017年07月20日 21:23:45 +00:00Commented Jul 20, 2017 at 21:23
-
\$\begingroup\$ Here is what's happening when the PLC and Arduino are wired: ibb.co/dftxqQ \$\endgroup\$Svjatoslavs Krasnikovs– Svjatoslavs Krasnikovs2017年07月21日 16:12:04 +00:00Commented Jul 21, 2017 at 16:12
-
\$\begingroup\$ Edit: I've powered CH3 and CH4 lines with +5V from Arduino (as those lines are used to power the communication module of PLC). \$\endgroup\$Svjatoslavs Krasnikovs– Svjatoslavs Krasnikovs2017年07月21日 16:14:17 +00:00Commented Jul 21, 2017 at 16:14