How to receive and send a frame from a sensor that communicates by modbus

Hello everyone, I have a problem and I don't know where to start xd.

I'm doing a project where I have different sensors, some are 4-20ma and others are relays, which I connect to a gateway via modbus, the problem is with the sensors that communicate by modbus, firstly I want to know how to change its address so that I do not have problems with the gateway and other sensors and secondly I want to know how to resend the information that you give me through modbus, so that in the end An arduino just read me all the information that all the sensors have sent me, like a list of all the data that each one gives me.

what I have thought is a max485 converter with an arduino so that it sends the frame to the sensor and it returns the data that I ask for, and with the data that comes to this arduino, send it again by modbus through other max485 converter.
Is this that I thought would be on the right way?

I suggest you look at it's manual. If the manual does describe such a feature the sensor probably doesn't have it. If you thought that changing the address is a core feature of Modbus you were wrong.

I don't see a reason to resend any of that information. That may be cause by you not describing that setup in enough detail but if you just have the Arduino and some Modbus sensors there's no need to resend any of that information.

So the Arduino in that description is necessary for what exactly? If you already have a station that speaks Modbus why do you need the Arduino in between? You should definitely start to describe the intended setup in much more detail. Links to the involved hardware may help too.

Unfortunately probably not.

hi, first of all thanks a lot for the help. I will explain a little what my project consists of, I am doing a soil / seeding control with a few sensors, an anemometer, a rain sensor, an NPK sensor (for mineral salts of the earth) and a humidity sensor. The anemometer is an analog sensor and the rain sensor has a relay output, and so that they can communicate by modbus I will use a gateway of digital and analog inputs, which has address 1. The other two sensors communicate by modbus but the biggest problem is that according to the manuals you can not change the address of either of these two. So that they would not interfere with each other, or with the gateway, the only thing that occurred to me to solve it was to change the address of the two sensors in some way through Arduino, that is why I said that through the max485 obtain the sensors plot, change the address and send it again to be received by the arduino that collects all the information, each with a different address, the gateway with 1, the second sensor with 2, and the third with 3.

In a bit, I'll go through the sensor manuals in case there is something that I missed.

That is a bit of the solution that I have come up with with the little knowledge that I know, I don't know if it would work as I have proposed, but my final goal is to have a list of all the data that all the sensors give me. Thank you very much again.

And both of them have address 1? Quite stupid. Most Modbus sensors I know are able to change the address in some way, some even using dip switches.

Although this is theoretically possible you might run into problems. That's because the intermittent Arduino (the address translator) might often produce timeouts. In the Modbus world the master sends a request to a slave and the slave has to answer within a certain time frame, otherwise the master runs into a timeout. With that translator the master sends the request to the translator, this sends the request to the actual sensor which hopefully replies quite fast. Once the translator got the answer it returns that to the master. Because that reply is sent much later than a directly connected sensor's reply the master might have already timed out.

But as the master Arduino (the one that collects all) might have more than one Modbus you can eliminate the translators completely. Use a Mega2560 (which has 4 hardware serial interfaces) to connect up to 3 Modbus and still have the connection to the PC for debugging or sending the data to the Internet.

Thank you very much, I have understood the entire explanation, first, according to what I have read in the manuals, they all default to the address, anyway as I told you, now I will send the links to the sensors manuals.

My biggest problem with the solution you have given me is that what I have told you was the form that the teacher who is in charge of my project gave me and I only have the most basic materials, some Arduinos UNO, some max485 converters, and everything. I have to do with this. What I have thought is to ask him about the problem you have told me and see what he tells me and if something changes. Thank you very much for the help.

Here I leave the manuals for both the gateway (which is the one that can change direction) and the manual for one of the sensors that communicates by modbus. Thank you

https://www.manualslib.com/manual/1629526/Wellpro-Wp9038adam.html

https://www.renkeer.com/upload/file/content/2020/05/5ecf5b75f26f2.pdf

Both devices allow to change their Modbus address so you don't need any translation device.

oh really, on what page does that appear about the npk sensor? Could you please provide it to me?

Yes, really.

Page 8, Paragraph 5.2.2.

Thanks u dude

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.