01-28-2022 05:05 AM
Hi everyone,
I am new here, but I am planning on doing a project that might require a little assistance. In the end I will also upload the results if everything works so that others might profit from the experience 🙂
The parts box:
- 6 sensors with RS485 Modbus RTU
- PC with Labview (2021)
- 24V Arduino PLC (Controllino Maxi, based on Arduino Mega)
- 3 NC 24V solenoid valves
- An emergency button
The plan:
The goal is to run a setup that allows a Labview UI to read out data from the sensors connected to the Arduino based PLC. This open source PLC has RS485 connectivity and all my sensors can use this protocol. At the same time the sensor data that is now available in Labview will be used to convert to a boolean set point (on or off) for the three solenoids. In the event of crossing a certain threshold value the solenoids will be deactivated (causing them to close). The control of the solenoids is realized through the relays that are available on the Arduino PLC, so Labview should be able to control them. Additionally, a stop button (one of those big red ones) will be hard wired in the solenoid lines so that there will always be the possibility of a manual shut down of the valves.
Now my question(s):
- First, do you think this is feasible?
- If yes, could you suggest a more concrete way to implement this? (I was thinking of using LINX or the Arduino compatible compiler, maybe the Arduino interface?)
- I worry mainly about the RS485 interface, will it be able to communicate from Labview across the Arduino to the sensors? (Does anyone have experience with this?)
I am looking forward to any input or criticism!
Cheers,
Rens
Solved! Go to Solution.
01-28-2022 03:46 PM
Are you planning on reading the sensors directly in the PC through a serial port or using the Maxi to communicate then read from the Maxi into LabVIEW. It's doable through the Maxi but the libraries for Modbus RTU are scarce and not well documented. I have plans on doing something similar in the future and this is what I have been looking at for a Modbus RTU library for a Arduino board.
01-28-2022 04:51 PM - edited 01-28-2022 05:21 PM
I don't understand why you need the PLC and LabVIEW.
What does the PLC do that LabVEW cannot?
The LabVEW Modbus API supports Modbus RTU, is pretty well documented, and supported. I have used it in the past and found it quite simple and straight forward to use. Even my first time doing anything with Modbus.
More...
I used a USB to RS485 interface on my Modbus projects, again fairly straight forward with the Modbus API mentioned above.
As for the PLC and LabVIEW talking on the same RS-485 bus.. Well that is a good question. I am guessing as long as only one of them is acting as the Modbus Master it will work. Two masters on one bus runs the risk of talking over each other.
One more thing. You are going to have to do all the Arduino Modbus programming in the native Arduino language. There is no support for Modbus in LINX or the TsXperts Arduino compiler for LabVIEW.
01-31-2022 01:55 AM
Hi Steven,
I was indeed considering using the Maxi as the 'middle man'. It is also an option to run the Modbus directly to the computer (probably the easier solution...). Thank you for the link to the library! I will have a look. In the end, I will use what is easiest as I do not have infinite time, haha.
Cheers!
01-31-2022 02:00 AM
Hi RTSLVU,
I get your point. It is similar to the one that Steven made. I think it would be wiser to just use Labview as the Modbus master. I will still need the PLC, as I need to switch my solenoids on and off and also do some temperature control.
Thanks for the feedback!
Cheers,
Rens
01-31-2022 03:12 AM
Hey Steven,
Another question you might know. Do you know what type of relays are in the Maxi? Do they require an extra fly-back diode to properly switch the solenoids?
Cheers,
Rens
01-31-2022 09:41 AM - edited 01-31-2022 09:42 AM
@Electronewb wrote:
Hi RTSLVU,
I get your point. It is similar to the one that Steven made. I think it would be wiser to just use Labview as the Modbus master. I will still need the PLC, as I need to switch my solenoids on and off and also do some temperature control.
Thanks for the feedback!
Cheers,
Rens
Well... The PLC still seems like it's more that necessary as LabVIEW has PID control Vi's so temperature control is actually quite simple in LabVIEW.
I could see using an Arduino Uno as a DIO to drive relays and for temperature measurement for your LabVIEW program. I would simply program the Arduino in its native language (or LINX) to respond to temperature queries and commands to turn relays off and on and let LabVIEW handle the rest.