Arduino with ModBus protocol + Supervisory + Frequency Inverter

Hey guys, all right?
Currently I try to develop a project using Arduino DUE but I have been facing some problems. If anyone can help me I’ll be very grateful. My project consists of communication between a supervisor (using Elipse Scada), an Arduino DUE and a frequency inverter (CFW11 from weg). My idea is to use the supervisor to monitor inverter parameters such as: speed, current, voltage and others. Already the arduino will be the controller, it will read the parameters of the inverter and send them to the supervisor. To communicate between the elements I want to use Modbus communication over the RS485 physical medium. I have an arduino RS485 module and the frequency inverter has an RS485 kit as well. But I did not Succeed using the libraries of slave and master of arduino. Since in my project the arduino will be master of the investor and slave of the supervisor. Already the supervisor will be master of the arduino. Could someone help me with this project?

Since in my project the arduino will be master of the investor and slave of the supervisor. Already the supervisor will be master of the arduino.

The ModBus protocol doesn’t support to have multiple masters on the bus. There is one master and there can be many slaves. The protocol has no congestion negotiation so having another master on the bus will fail.

What’s the purpose of the Arduino in this system? Why not connecting the Arduino by USB? You can use the ModBus protocol over it so you’ll have two ModBus instances.

What library(ies) did you try for the Arduino? Please provide links.

pylon: The ModBus protocol doesn't support to have multiple masters on the bus. There is one master and there can be many slaves. The protocol has no congestion negotiation so having another master on the bus will fail.

What's the purpose of the Arduino in this system? Why not connecting the Arduino by USB? You can use the ModBus protocol over it so you'll have two ModBus instances.

What library(ies) did you try for the Arduino? Please provide links.

In case, what I would like to do is to leave the arduino connected by USB with the computer, however the communication between it and the supervisor would be modbus also (or some other type of communication, in this case it is not a problem to change the communication). The purpose of arduino in this system is to be the controller. I'm going to put in Arduino the parameters of inversosr, like speed, torque. And I will also read the data of the inverter by the Arduino (the same parameters of the writing, I would do this to be able to monitor the inverter), as for example I would be varying the speed of the inverter and this variation would appear for me in the supervisor numerically or graphically. So in other words, the arduino would give the parameters of the inverter and would also read and send to the supervisory. In this way an operator of the machine could clearly see how the engine is running. I'm going to send the link from the libraries I'm using

https://github.com/jecrespo/simple-modbus/tree/master/Modbus%20RTU%20libraries%20for%20Arduino/SimpleModbusSlaveV10_DUE

https://github.com/jecrespo/simple-modbus/tree/master/Modbus%20RTU%20libraries%20for%20Arduino/SimpleModbusMasterV2rev2_DUE

In your case I strongly suggest to change the library to this one: https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino. It supports master and slave in the same library so you probably won't get conflicts.

n case, what I would like to do is to leave the arduino connected by USB with the computer, however the communication between it and the supervisor would be modbus also (or some other type of communication, in this case it is not a problem to change the communication).

I guess this should work.

The purpose of arduino in this system is to be the controller. I'm going to put in Arduino the parameters of inversosr, like speed, torque. And I will also read the data of the inverter by the Arduino (the same parameters of the writing, I would do this to be able to monitor the inverter), as for example I would be varying the speed of the inverter and this variation would appear for me in the supervisor numerically or graphically. So in other words, the arduino would give the parameters of the inverter and would also read and send to the supervisory. In this way an operator of the machine could clearly see how the engine is running.

I still don't see why the Arduino is needed as it's only a kind of flow heater (I don't know if this term is used in English too, I'm not a native speaker). Why don't you just send the ModBus commands directly from the supervisor to the inverter and request the updated values? From your description the Arduino is just forwarding ModBus messages. BTW: The Arduino cannot send anything to the supervisor as you defined it to be a slave. A slave cannot actively send anything to the master it simply set's the value in it's internal registers and the master reads the registers by using ModBus messages.

I'm using arduino in this case because implementing the modbus protocol is not my final job. In this work there is also a control system for the motors, and this control system is implemented in arduino. My part in the work is precisely the implementation of the protocol. Not necessarily I need to write the inverter parameters for the Arduino, but it was the easiest way I figured I'd do it. Do you think this is more difficult?

My part in the work is precisely the implementation of the protocol.

But if you have to implement the ModBus protocol on the PC and on the Arduino you could send the ModBus commands directly from the PC. You still may let the Arduino control the motors, simply think that it’s not clever to send ModBus commands to the Arduino to let it simply forward it to another device. This makes the setup just overly complex.

pylon: But if you have to implement the ModBus protocol on the PC and on the Arduino you could send the ModBus commands directly from the PC. You still may let the Arduino control the motors, simply think that it's not clever to send ModBus commands to the Arduino to let it simply forward it to another device. This makes the setup just overly complex.

Got it. But how do you suggest that you do the communication? Because I need the supervisor to read the inverter parameters and the arduino write the inverter parameters. Do you think you can do this direct communication without going through the arduino?

Got it. But how do you suggest that you do the communication? Because I need the supervisor to read the inverter parameters and the arduino write the inverter parameters. Do you think you can do this direct communication without going through the arduino?

As you have the ModBus protocol on both ends of the Arduino communication you can simply remove the Arduino and let the PC talk directly to the inverter. You only need a USB2RS-485 adapter to get the physical connection done right. You wrote that the Arduino write the inverter parameter. How do the Arduino know what parameter it must write? Isn't the supervisor also in charge to control these parameters? Or is the supervisor only displaying the value but never changing them? You might see that I still have problems to understand what's the duty of the supervisor and what's the duty of the Arduino. It might be necessary that you describe your project in a bit more detail.

What kind of software do you plan to use on your supervisor?

pylon: As you have the ModBus protocol on both ends of the Arduino communication you can simply remove the Arduino and let the PC talk directly to the inverter. You only need a USB2RS-485 adapter to get the physical connection done right. You wrote that the Arduino write the inverter parameter. How do the Arduino know what parameter it must write? Isn't the supervisor also in charge to control these parameters? Or is the supervisor only displaying the value but never changing them? You might see that I still have problems to understand what's the duty of the supervisor and what's the duty of the Arduino. It might be necessary that you describe your project in a bit more detail.

What kind of software do you plan to use on your supervisor?

To be done writing the parameter, I would use the arduino code. Each inverter parameter has a numbering linked to it, and I believe (at least I hope so) that I can do that writing from the arduino code. In the case I would use the supervisory only for reading the parameters, as you said just by displaying. Then it would look like this: Supervisor: Responsible for reading parameters; Arduino DUE: Responsible for writing parameters. In case I would like to use Elipse Scada as a supervisory (follow the link: https: https://www.elipse.com.br/en/downloads/?cat=69&key=&language=enus )

Supervisor: Responsible for reading parameters; Arduino DUE: Responsible for writing parameters.

OK, I got that. Forgive me if I'm still asking. How does the Arduino know what values to write into the parameters?

In case I would like to use Elipse Scada as a supervisory (follow the link: https: https://www.elipse.com.br/en/downloads/?cat=69&key=&language=enus )

I don't know this software but it looks to me like a massive overkill.

The way the arduino will know which parameter will write I'm still trying to figure it out. I did not find any code that shows how it works, but I saw some videos showing the application of this idea. Some examples of how to do this parameter writing are shown in the inverter manual. I still try to get Arduino to do this writing. The following is the inverter manual:

http://ecatalog.weg.net/files/wegnet/WEG-cfw11-manual-da-comunicacao-serial-rs232-rs485-0899.5740-manual-portugues.pdf

Why do you think it's an exaggeration to use this software?

so I am curios too. not how, what

pylon: How does the Arduino know what values to write into the parameters?

If you are not stick with RS485, a CAN bus (a differential bus too, no problem with EMI) would do the job since over such a bus, any node can decide to send data to any other node of the bus. Maximum length 1000 m by reducing the baud rate over the bus.

BTW, an Arduino DUE can be at the same time a master on an RS485 bus (e.g. USART0 in RS485 mode) and a slave on another RS485 bus (e.g. USART1 in RS485 mode).

@pylon: the library you mentioned has not been tested under an Arduino DUE (see readme section)

@pylon: the library you mentioned has not been tested under an Arduino DUE (see readme section)

I know and it will nevertheless work out of the box with the main serial interface (Serial). To use the other serial interface you might have to slightly modify the library as the check for the corresponding objects is done by checking hardware features not available on the Due.