Modbus

First of all, I'm way out of my league here. I know that already.

I've been using the suggested modbus library (and I tried others too) but I cannot get it to work.

The example sketch is supposed to write HRs to the slave, but it doesn't do that. I've been monitoring it via a modbus slave tool. The Industruino is connected via the AB ports to a USB device which emulates another modbus device, in our case a slave, because the Industruino is destined to master over two other devices. I've been using the sketch from here: https://industruino.com/blog/our-news-1/post/modbus-rtu-master-and-slave-14 (solely the master sketch).

Provided is a screenshot of my settings as a listening device: Which shows up empty, always. No matter what settings I use. EDIT: Apparently I need more karma. Link here: https://pasteboard.co/JIxvGWJ.png

I've been reading something about a switch provided in the docs; I'm unable to find that one too on my board. This Ind/IO is about a year old by now.

 

Leandro Marceddu
Leandro Marceddu
51
| 1 1 1
Asked on 1/7/21, 1:18 PM
1
vote
1685 Views

Right so. I've figured out the PSU needs to be connected for it to even remotely work. So far I've been managing to get it talking, yet I'm still a bit clueless on how it does that. For my application I need it to be able to read certain registers and write to certain registers. It seems to be accomplishing that using these packets, of which I have 0 clue how they are formed and what they stand for.

Leandro Marceddu
on 1/7/21, 3:23 PM

Right so. I've figured out the PSU needs to be connected for it to even remotely work. So far I've been managing to get it talking, yet I'm still a bit clueless on how it does that. For my application I need it to be able to read certain registers and write to certain registers. It seems to be accomplishing that using these packets, of which I have 0 clue how they are formed and what they stand for.

Leandro Marceddu
on 1/7/21, 3:24 PM

I don't know that I can answer your question in whole at this point, but I just started a modbus project about 6 months ago with Industruino using that very library! I'm interacting with DMM motors successfully at various BAUD rates. In my case, Industruino is also acting as master. Now for the bad news: I've modified the library heavily to suit my needs. The library as written seems to expect Industruino to poll modbus relentlessly (rather than, for instance, send a message as needed). I did get everything working with the library in its pristene state. Are you using the Arduino IDE? Do you have an oscilloscope? I use hantek 6022be (less than $100) with pulseview and it's a life saver! Yes, you need a separate PSU to power the lower part of the PLC (the part where Modbus communications happen). If you have an oscilloscope, you would see immediately that NO modbus signal comes from Industruino without external power.

Aaron
on 1/18/21, 3:31 PM

Fixed by using https://4-20ma.io/ModbusMaster/examples_2_r_s485__half_duplex_2_r_s485__half_duplex_8ino-example.html 

This one allows you to set the pin correctly.

 

Leandro Marceddu
Leandro Marceddu
51
| 1 1 1
Answered on 1/25/21, 2:58 PM
1
vote

Great, glad you got it sorted!

Aaron
on 6/14/21, 4:50 PM

Hi Leandro,

We use Modbus all the time on the RS485 port, and it works great. Our basic library is SimpleModbusSlave, but we also tried SimpleMOdbusMaster too, and a master Industruino can supervise some slave Industruinos just fine.

Remember the Modbus buffer of the industruino is 64 bytes long (so 32 Modbus words). So do not ask an IndIO more than 32 words at a time (won't answer) and do not ask for more than 32 word at a time if you are the master (won't read the answer).

We came across some problems IndIO being a slave : since we updated our slave interfaces by blocks of 10 words, at a rate of one block / sec, some picky masters consider a too slow answer as a timeout error but on the whole, it works.

As a master, we also came across a number of problems related to the way Modbus is treated by the third-party slave : for instance, atlantic gas boilers cannot be asked more than one word every 5 seconds, or they either do not answer (if you ask more than one word at a time) or jam up their answers (if you ask faster than one word every 5 secs). ATV212 VSDs cannot be asked more than one word at a time, Saacke burners can answer to tables requests, but only on continuous tables, etc, etc, etc ...

What I recommend for tests is just an USB to RS485 interface, and a PC software simulator like ModbusSlave or ModbusPoll. This will help you diagnose what comes in or out of the RS485, and save you hours when confronted with a third-party hardware. You find them cheap anywhere.

Hope this helps,

Didier, DG2R

Didier DORGUIN
Didier DORGUIN
172
| 4 1 3
Answered on 1/18/21, 7:54 PM
1
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

64 follower(s)

Stats

Asked: 1/7/21, 1:18 PM
Seen: 1685 times
Last updated: 1/25/21, 2:58 PM