RS232 Modbus between Arduino and Unitronics PLC

Hi. I have a Unitronics JZ20-R16 (Jazz2) controller I’ve programmed to run a simple air ventilation system in my house (The thing is running great btw.). I also have a self made Arduino based data logger (I use it to monitor and log my energy consumption, temperature, etc.) I’m not building those things or mass producing, Arduino electronics is my hobby - I just use it to stay sharp.

So I decided to cross-integrate my air vent. Controller with my data logging unit (I want to see the status of my air vent. Controller unit on Arduino). So for starters the task is to simply send a 16bit int to Arduino and receive another 16bit int from the Arduino.

The communication protocol of the choice was MODBUS through RS232 interface (as I already have MJ20-PRG; MJ20-CB200 and a MJ10-22-CS10). I’ve decided to use JZ20-R16 as a Master (Arduino as a Slave) in a 9600 baud 8N1 configuration (default for JZ20-R16). For Arduino’s RS232 interface I’ve used TTL-RS232 converter (MAX3232 based) :


Experiment 1:
In order to see if the Arduino’s MODBUS feature is working I’ve connected Arduino to my PC using the given connector and a RS232-USB converter. Arduino was configured as a slave and ModbusPoll software (http://www.modbustools.com/modbus_poll.html) simulated a master. I was able to both read a holding register from Arduino (03) and also write a register (06). Those are the desired options. The program is attached.

Experiment 2:
In order to see how MODBUS is working on JZ20-R16 I’ve hooked it up to my PC using my MJ20-PRG; MJ20-CB200 and a MJ10-22-CS10 later connected to RS232-USB converter. I’ve uploaded a program (by pressing buttons 1 and 4 I send an int or correspondingly request an int from slave):

It make the JZ20-R16 work as a Modbus master on a RS232 interface. In order to simulate a slave I’ve used ModbusSlave software (http://www.modbustools.com/modbus_slave.html) . Once again, the combination worked perfectly. Once again all the required commands worked.

Here’s the photo of my hookup:

Then I’ve noticed a possible cause for future problems : lines 4 and 7 of my MJ10-22-CS10 are actually used in this communication. It turned out that the RS232 communication with JZ20-R16 require 6 wire communication instead of 3 wire communication I’ve expected from RS232 interface. Due to the requirement of RTS and DTR signals!

I’ve turned on my scope and actually saw those signals on pins 4 and 7 of MJ10-22-CS10 connector going high after the “handshaking” with my slave simulator was done.
With PC USB disconnected:

PC USB Connected:

MudbusSlave enabled “handshaking”:

Successful communication:

CH3/4 are the DTR and DTS signals correspondingly. At this point I’ve realizes that sue to those signals I would not be able to connect my Unitronics to my Arduino, as the TTL-RS232 connector simply do not support DTR and DTS signals. So after hooking up my Arduino to Unitronics I see the following on the scope:

Both DTR and DTS signals are on 0 instead of HIGH, which prevents the JZ20-R16 from accessing the modbus.

The questions:

  1. Is there any chance to make JZ20-R16 communicate over RS232 without use of DTR/DTS signals?
  2. Is there an option to tweak those signals (connecting them to +5V permanently)
  3. Use of other TTL-RS232 converter?
  4. Any other way to make Arduino and JZ20-R16 communicate over RS232 interface using MODBUS

Thank you for the patience.

  1. Is there any chance to make JZ20-R16 communicate over RS232 without use of DTR/DTS signals?

Depends if you can deactivate hardware handshake on the JZ20-R16. These handshake signals are used if one of the two partners is not as fast as the other one. That way it can stop the partner from sending additional data if the buffers are already full.

  1. Is there an option to tweak those signals (connecting them to +5V permanently)

You can try that but deactivating handshake is clearly the better option.

  1. Use of other TTL-RS232 converter?

Doesn't make it much better if you don't provide the signals from the Arduino.

  1. Any other way to make Arduino and JZ20-R16 communicate over RS232 interface using MODBUS

ModBus RTU is defined over RS-485. That standard uses only 2 wires. Does your JZ20-R16 support that too?

Hi,

Since you are using the JZ-PRG you need to power it .
Power is supplied via pins 1 and 6, located on the RJ11 connector.
Active RS232 positive voltage signals ensure proper communications.
The input volatge range is 5 -15V (RS232 Positive voltage)

Note that:

  • Active RS232 positive voltage signals are required to ensure proper communications.
  • Connecting the port directly to a power line may damage the port. If a direct connection is
    unavoidable, use a serial resistor. For example, in the case of 12V, use a 68B 1W resistor.

Another option is to use other add-on module JZ-RS4 that has RS232/RS485 port where you dont need to power it up.