Modbus RTU to TCP/IP

Hi, I am trying to get data from my Schneider IEM3150 energy meter to my Home Assistant.
The IEM 3150 can communicate by Modbus RTU, so I bought a USR-N540 that can convert Modbus RTU to Modbus TCP. Hopefully I can get the data I need using Modbus TCP/ip to my Home Assistant.
I do not have enough knowledge to know how to wire these two together.
Is there anyone in this group who could help me with this?
I will attach some pictures of the hardware.
Could anyone help me with this?

Best regards Kris
 

Attachments

For RS-485 connections, you connect plus to plus, minus to minus, and ground (0V, ref, com) to ground (0V, ref, com).

For your particular equipment, connect as follows
USR T+ (A) <-> IEM D1/+
USR T- (B) <-> IEM D0/-
USR GND <-> IEM 0V

Make sure to configure the USR device for RS-485 mode either via the dipswitches or via the web interface.
 
For RS-485 connections, you connect plus to plus, minus to minus, and ground (0V, ref, com) to ground (0V, ref, com).

For your particular equipment, connect as follows
USR T+ (A) <-> IEM D1/+
USR T- (B) <-> IEM D0/-
USR GND <-> IEM 0V

Make sure to configure the USR device for RS-485 mode either via the dipswitches or via the web interface.
Thank you very much for your help Jschulze!
I have wired the two devices together as you described. I have two different testing software I use to connect to these two devices. I can connect to the USR device by ip connection, but I cannot do anything on the COM port side. I have connected the cables from the IEM device to the physical Com port 1 on the USR. Attached pictures show screenshots of the two testing software I use. Looks like that the software called USR-TCP232-M4K3 Setup Software V2.3.3.97 detects both the ip side and the COM side, but still I cannot "do" anything to test it. I also tried to connect using Modscan, but again I am not sure how to set it up. Her are the link to the user guide for the USR device https://aimdynamics-zzrknacmnjkk6ll...t/docs/[User Manual] USR-N540 User Manual.pdf
Any other suggestions?
Kris
 

Attachments

I recommend that you read section 3.5 in the manual you linked. That explains how to properly setup the USR-N540 for Modbus RTU to Modbus TCP conversion. You need to select "ModbusTCP" in the ModbusTCP setting right below TCP Server style instead of "None". You also want the USR to be a TCP Server in your case, which you've set already. And you should set the Local Port to be 502, as this is the default Modbus/TCP port.

You should then be able to use ModScan to communicate with the IEM3150 through the USR-N540. Of course, you'll need to reference the IEM3150's Modbus register list documentation to know what registers exist.
https://download.schneider-electric...N-13.pdf&p_Doc_Ref=DOCA0005EN#pdflink2920b9cf
 
I recommend that you read section 3.5 in the manual you linked. That explains how to properly setup the USR-N540 for Modbus RTU to Modbus TCP conversion. You need to select "ModbusTCP" in the ModbusTCP setting right below TCP Server style instead of "None". You also want the USR to be a TCP Server in your case, which you've set already. And you should set the Local Port to be 502, as this is the default Modbus/TCP port.

You should then be able to use ModScan to communicate with the IEM3150 through the USR-N540. Of course, you'll need to reference the IEM3150's Modbus register list documentation to know what registers exist.
https://download.schneider-electric...N-13.pdf&p_Doc_Ref=DOCA0005EN#pdflink2920b9cf
Thank you again for helping me! I have read section 3.5 as you suggested, but still no luck. I can ping the ip adress of the IEM(192.168.1.15). I have attached screenshot of the different software I have tried to connect with, and the error message after I push the "connect" buttons. Should I try to disable all of my firewall settings maybe?
 

Attachments

Those screenshots seem to indicate you still have the USR-N540 misconfigured. Did you set the Local Port setting to 502? Did you power cycle the USR-N540 after making changes?

It's unlikely to be a firewall issues, since your computer is trying to make the connection (outgoing firewall rules are much less restrictive than incoming).

Just to be clear, though, you said you can ping the IP address of the IEM? Do you mean the USR-N540?

Note that successfully pinging just means that the device is at that IP address, not that TCP port 502 is open on the device.

You can test if a device has a specific port open by using Windows PowerShell and the Test-NetConnection command. The syntax of the command is
Test-NetConnection <ip_address> -p <port_number>

So in your particular instance, you would type
Test-NetConnection 192.168.1.15 -p 502
 
Those screenshots seem to indicate you still have the USR-N540 misconfigured. Did you set the Local Port setting to 502? Did you power cycle the USR-N540 after making changes?

It's unlikely to be a firewall issues, since your computer is trying to make the connection (outgoing firewall rules are much less restrictive than incoming).

Just to be clear, though, you said you can ping the IP address of the IEM? Do you mean the USR-N540?

Note that successfully pinging just means that the device is at that IP address, not that TCP port 502 is open on the device.

You can test if a device has a specific port open by using Windows PowerShell and the Test-NetConnection command. The syntax of the command is
Test-NetConnection <ip_address> -p <port_number>

So in your particular instance, you would type
Test-NetConnection 192.168.1.15 -p 502
Hi.
Those screenshots seem to indicate you still have the USR-N540 misconfigured. Did you set the Local Port setting to 502? Yes I set it to the 502 port.

Did you power cycle the USR-N540 after making changes? Yes after you sent me this message I tried that.

It's unlikely to be a firewall issues, since your computer is trying to make the connection (outgoing firewall rules are much less restrictive than incoming).

Just to be clear, though, you said you can ping the IP address of the IEM? Do you mean the USR-N540? I am sorry, yes I mean USR-N540

I have attached picture of the result after testing Windows Powershell as you explained.
Thank you for helping me with this!
I would never figured out all these things you learn me.

Any other ideas what I do wrong? Any other screenshots I can send you?
 

Attachments

The Local Port Number of the USR is still set to 1 according to your screenshot. You need to change this to 502.
Wow! That did the trick! Now I can connect Modscan to port 502 on the USR-N540(or is it the IEM3150). So tomorrow I will see if I can get the data from The IEM 3150.
The time is 11.15pm here now(Norway). Again I will say thank you very much for your help! I will write to you after I have tried to connect to the IEM.
Kris
 
I'm glad you got it working.

On a side note, I don't think you need the "ModbusTCP Poll" checkbox checked. Unfortunately, the manual is very poorly written and extremely vague on what the setting does, stating only ModbusTCP Poll: Function for Modbus Polling.

Also, for what it's worth, there have been a couple other threads with people that have used USR Ethernet to serial converters that may be worth looking at for reference.
https://control.com/forums/threads/radio-communication-status.50071/
https://control.com/forums/threads/modbus-rtu-to-modbus-tcp-converter.50406/
 
I'm glad you got it working.

On a side note, I don't think you need the "ModbusTCP Poll" checkbox checked. Unfortunately, the manual is very poorly written and extremely vague on what the setting does, stating only ModbusTCP Poll: Function for Modbus Polling.

Also, for what it's worth, there have been a couple other threads with people that have used USR Ethernet to serial converters that may be worth looking at for reference.
https://control.com/forums/threads/radio-communication-status.50071/
https://control.com/forums/threads/modbus-rtu-to-modbus-tcp-converter.50406/
I have finally got the Modbus data to my Node Red addon in Home Assistant. I dont know if you are familiar with Node Red, but the data I get is not the same as I see in Modscan even with the same address. I use the address 3060 in holding register. That should be total active power according to the Schneider manual. I have attached a pictures showing the results from both Node Red and Modscan collecting the same address at the same time. I also attached picture of the settings in Node Red. Any ideas what I do wrong this time? Do I have to convert the data collected in Node Red maybe? I have seen some pictures of a node called "Buffer - parser, but I don't really know what it does with the collected data. I would appreciate it if you could take a look at this.
Kris
 

Attachments

I believe this is the common "off by one" addressing issue when using Modbus. Both the IEM3150 and ModScan use 1-based addressing, however, I'm guessing Node-RED uses 0-based addressing.

Try using 3059 in Node-RED instead of 3060.

For additional details on Modbus register numbering, refer to this thread:
https://control.com/forums/threads/modbus-register-numbering.49844/

On an additional note, if you are trying to read the Total Active Power at register 3060, note that the Type is Float32. This means that two Modbus registers are required for the 32-bit floating point value, 3060 and 3061 (Modbus registers are 16-bit, so two registers must be combined to form a 32-bit value). While ModScan supports 32-bit floating point values in the Setup->Display Options menu, I unfortunately don't know how to have Node-RED interpret two Modbus registers as a single 32-bit floating point value.

I was not able to find in the IEM3150 manual which register should be the most-significant in the 32-bit value, so you may have to try each one in the ModScan Setup->Display Options menu to find the right register ordering that yields the expected value.
 
I believe this is the common "off by one" addressing issue when using Modbus. Both the IEM3150 and ModScan use 1-based addressing, however, I'm guessing Node-RED uses 0-based addressing.

Try using 3059 in Node-RED instead of 3060.

For additional details on Modbus register numbering, refer to this thread:
https://control.com/forums/threads/modbus-register-numbering.49844/

On an additional note, if you are trying to read the Total Active Power at register 3060, note that the Type is Float32. This means that two Modbus registers are required for the 32-bit floating point value, 3060 and 3061 (Modbus registers are 16-bit, so two registers must be combined to form a 32-bit value). While ModScan supports 32-bit floating point values in the Setup->Display Options menu, I unfortunately don't know how to have Node-RED interpret two Modbus registers as a single 32-bit floating point value.

I was not able to find in the IEM3150 manual which register should be the most-significant in the 32-bit value, so you may have to try each one in the ModScan Setup->Display Options menu to find the right register ordering that yields the expected value.
You were right(again), so when setting Node-Red to read 3059 address I get the same value as in Modscan. The only signal I look for is the one that tells me the real-time consuption of electric power in Kw. I will try as you suggest to test different addresses to see if I can find the right one. Thank you again for your help.
 
Top