question

fpvosper avatar image
fpvosper asked

EM330 connection via Modbus RS485/ETH to Cerbo GX


Hi all,


I require assistance with resolving a communication issue between an EM330 energy meter and Cerbo GX.

This is a follow up to prior question on the EM24 versions/availability (https://community.victronenergy.com/questions/166701/em24-ethernet-versionsavailability.html)

Due to the nature of the installation (200m distance between MultiplusII/Cerbo GX and the meter point as well as 25mm2 tails/100A supply) it is necessary to have a CT clamp meter communicating over an existing LAN.

After making enquiries with Victron Sales & Carlo Gavazzi it became apparent that no stock exists of the CT/ETH version of EM24 (EM24DIN AV5 3X E1 X), so I have had to settle on the EM330 CT version (EM330 AV5 3 H S1 PFB) which has modbus RS485 output rather that ethernet output.

I have attempted to resolve this by installing a Waveshare RS485-TO-WIFI-ETH adapter to switch RS485 to TCP/IP in order to connect over distance to the Cerbo GX. In essence, trying to emulate the EM24 Ethernet meter with the newer EM330 device.


Waveshare RS485-TO-WIFI-ETH adapter spec

https://www.waveshare.com/rs485-to-wifi-eth.htm

https://www.waveshare.com/w/upload/6/61/RS485-TO-WIFI-ETH-User-Manual-EN.pdf


Current setup:

EM3330 <-RS485-> Waveshare RS485-Wifi/Eth (Modbus TCP Gateway) <-TCP/IP over LAN-> CerboGX


1) EM330 settings

System:1P

CT:20 (100/5)

VT:1

Address:1

Baudrate: 9.6

Parity:No

Stop Bit :1

Pulse LED:100


1)Waveshare RS485-Wifi/Eth adapter settings


1668114470125.png

1668106834663.png

1668106854401.png

1668106892444.png


1668106901648.png




The meter is correctly reading the CT and displays the kWh & kW readings.

The Waveshare RS485-Wifi/Eth is wired per RS485 directly to the EM330 meter A-A, B-B, G-G and is also connected to LAN (assigned IP 192.168.1.104). The cerbo is also connected to the LAN (assigned IP 192.168.1.108)

I set a heartbeat on the serial port from the Waveshare device, this pings the meter resulting in the Tx led on Waveshare device flashing and 'Rx' then being displayed on EM330 screen, which I understand to shows a successful communication between the two devices.


I am able to connect to both devices on the network, however the issue I have is that the Waveshare device does not automatically display in the Cerbo GX.

In Remote Console neither the Waveshare or EM330 device names are displayed under 'Device List' or under Settings>Energy Meters.

1668106957708.png


Under Settings->Modbus TCP devices the meter does not automatically show under a scan for devices.

I have attempted to manually add the device with the following settings

IP address: 192.168.1.104

Port: 502

Unit:1 (or 30)

1668106986784.png


The device is then shown in the Device list as Device 1. I am unsure whether the Unit needs to be set to 30 per the Modbus-TCP register list to force the device to be shown as a Carlo Gavazzi meter.


I have tried both Unit=1 and Unit=30 to no avail when adding the unit to no avail.


Under Settings>Services>Modbus/TCP I enable Modbus/TCP.

Whilst adding/removing the device I have sometime observed an error on the Service->Modbus/TCP screen which is likely related to communication issue.

"Error processing function code 3, unit id 1 start address 5664, quantity 1, src 192.168.1.104: Modbus address 5664 is not registered"

From my limited knowledge of modbus I am assuming that the Cerbo GX is trying to query the holding registers.


Under the same menu 'Available service' I also do not see an entry for the Device 1 only the standard VE.Can and BMS-CAN entries.

1668107084229.png

Also going back to the front page Device List/Pages, the meter is not shown.


I am at a bit of a loss as to what to try next. I can see both devices on the network, however the Modbus communication between the devices appears to be corrupted/cause errors.


I am at my limit in terms of technical competance, so any assistance from the team/community members would be much appreciated as this is the last step to getting our ESS up and running. I have no experience in dealing with Modbus, so any recommendations in terms of tolls that can be used to debug communication erros would also be appreciated.


Thanks.

Paul


Note similar contributions by @matt1309 re communication between energy meter and Cerbo GX using RS485-ETH by which might be a useful reference.

https://community.victronenergy.com/questions/125244/ct-clamp-over-ip-ethernet.html

https://community.victronenergy.com/idea/133677/et112-over-ethernet-internet-tcp.html

https://community.victronenergy.com/questions/68701/em24-smart-meter-read-out-over-modbus-tcpip.html





cerbo gxEnergy Meter
1668106834663.png (158.2 KiB)
1668106854401.png (158.4 KiB)
1668106892444.png (153.5 KiB)
1668106901648.png (158.0 KiB)
1668106957708.png (99.7 KiB)
1668106986784.png (58.8 KiB)
1668107084229.png (140.2 KiB)
1668114470125.png (28.6 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

5 Answers
matt1309 avatar image
matt1309 answered ·

Hi,


My understanding of modbus isn't great but I believe you have defined registered/IDs for different pieces of information. So I imagine you need a way to map each piece of information from your meter to the specific modbus inputs needed in cerbos gx. Cerbogx needs a way of knowing what ID is what piece of information. ie what ID is watts, what ID is amps and what's volts etc.

I suspect this is setup for specific supported devices only or requires modified drivers in cerbogx to get working. So cerbogx knows EM24 mapping because its supported (i don't know this but suspect that's the case)

You may however be able to spoof a supported device if the waveshare device let's you choose the modbus mappings for the meter data. Essentially copy the modbus ID mappings of a modbus tcp meter you know is supported ie EM24. To almost make your meter act like a supported modbus tcp meter.

Anyone more informed please feel free to. Say the above is completely wrong, just an educated guess really.


I'm unfamiliar with EM330 but if it's supported by cerbogx might be easier going down my route and getting a second waveshare to convert back to rs485 and use usb adapter to plug into cerbogx.

Ie

Meter -> rs485<-(waveshare) ->tcp ip <-(waveshare) - > rs485 ->cerbo gx.



2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

fpvosper avatar image
fpvosper answered ·

Hi Matt,

Thank you for taking the time to respond. After further tinkering today I did eventually make a little bit of progress. I tried swapping the RS485 A-B connections on the Waveshare device. So meter is now connected A-B, B-A. Success! Modbus Poll and The Carlo Gavazzi Universal Configuration now both recognize the EM330 & can read some data. Whilst the EM330 is being polled I now get Rx&Tx being displayed on the meter screen (previously only Rx). Not sure if this is just my unit or how it is supposed to be wired, but is a word of warning to anyone else using Waveshare devices.

CG software shows some data is being polled (power, current, voltage, PF). Screen shot of energy screen below.

I went through the same process I detailed above to re-add the EM330 as a Modbus TCP/IP device (IP, Port, Unit) on the Cerbo GX, however it is still not showing up under Services or Grid Meters. Further investigation required there, but likely down to register mappings as you have suggested.1668274807974.png



1668274807974.png (123.1 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image
matt1309 answered ·

It's odd that the carlo software shows it up. Does it show all the information you'd expect or is it only showing some?


If it's showing it all you'd expect then it would be unlucky if the mappings are different between EM330 and EM24-eth.


Does the waveshare device let you change registers/IDs of the rs485 meter data?


If so you could align it with EM24 mappings and it should be recognised as a EM24 in cerbo gx.


I stumbled upon this. Might help with that

https://community.victronenergy.com/questions/111121/emulating-em24-ethernet-meter-via-modbustcp-server.html

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

fpvosper avatar image
fpvosper answered ·

In terms of the CG UCS 7 software I think it shows all the expected data now (screenshots below, note I only have single phase install). I am still struggling to get the Cerbo to pick up the unit on TCP/IP, so will likely try the TCP/IP->RS485/USB route next. Only concern here is that if the same device information is being sent over rs485/eth I could run into the same issue of the meter not being picked up irrespective of that route is taken. Maybe the cerbo is only looking for EM24 on ethernet as it does not expect the EM330 to be connected in this manner.


In terms of your set up please could you indicate what rs-485-usb adapter you used. I read in other threads that some users had issues with some rs-485-usb devices not being picked up by cerbo until the name of the device was changed.

As a measure of desperation I have also tried to change the name of the Waveshare device in lan/dchp settings to 'EM24 Ethernet' and 'EM330'. I try to add the unit again via Modbus TCP/IP page, but the device is still not picked up (also does not show up via scan).

I do not see any obvious options to change the registers/IDs of the rs485 meter data in the Waveshare device (all the available settings are screenshotted in original post).

Thanks for the link I will take a look.


1668370187836.png

1668370240432.png


1668370285928.png


1668370566766.png




1668370187836.png (133.5 KiB)
1668370240432.png (124.8 KiB)
1668370285928.png (124.7 KiB)
1668370566766.png (117.9 KiB)
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

I suspect you're right and it's more than just the name that Cerbo is checking when expecting EM24 instead of the EM330. Odd you would've expected at least something to show up. Think you've already mentioned this but just to confirm when you're viewing the data in Carlo software you're using Modbus TCP, you're not connected directly to the meter in any other way? Might be worth using a generic modbus tcp slave to read the data. (Might give you an indication how it differs from EM24 data structure)

It's a shame the Waveshare device doesn't natively allow you to adjust the modbus tcp data into the format of the EM24. An option if you're comfortable with it may be to add a raspberry pi or equivalent server "in between" to read the modbus tcp data from waveshare device and "reformat/re-order" it to put it into EM24 format. Seems a few people have done that on this forum not with the EM330 but other meters such as the one from Shelly. (many have used Node-red instead of programming languages if that's a part that worries you). That seems a fair bit more involved in my opinion though. And it also adds another point of failure ie if the raspi/server goes down the meter data wont make it to the cerbo.

(I did try and search the waveshare manuals to see if there was a way to edit the ModbusTCP data format. There maybe a way using JSON settings but it wasn't documented well enough to tell sorry, if you're in no rush maybe a question to email waveshare, "Can I edit the IDs/registers the RS485 data is mapped to when converted to ModbusTCP")

In regards to the RS485 to USB adapter I had read similar stories of not supported devices. Even when the advertised chipset is the same as the one victron sells. For this reason I originally bough the "victron" one, which is more expensive however you will get support on forum. If you use a non-Victron one folk will just reply to any queries on the forum with "get the victron one"

However I did have a spare FTDI rs485 to USB adapter lying around and have tested it and it did work for me. If you're in a rush/dont want to try getting a cheaper one, testing it and and sending back if it doesnt work then i'd just fork out the extra £10 for the victron one.




0 Likes 0 ·
fpvosper avatar image fpvosper matt1309 commented ·

I can confirm that I am connecting to the EM330 in GC UCS via Modbus TCP/IP (over Wifi). Thank you for the suggestions above, I will give them a try.

0 Likes 0 ·
fpvosper avatar image
fpvosper answered ·

Just to follow up. I have successfully connected the EM330 grid meter to the cerbo gx over TCP/IP. As the Cerbo did not recognise the meter directly over TCP/IP I ended up using a second Waveshare RS485 to ETH adapter operating as client + a Waveshare RS485 to USB adapter to directly connect into the Cerbo. Final set up is as follows:


EM330 -> Waveshare RS485-Wifi/Eth -> TCP/IP over Engenius Wifi Bridge (~200m)-> Waveshare RS485-Wifi/Eth POE -> Waveshare USB to RS485 -> CerboGX.


There are still to many steps for failure for my liking but so far the connection has been stable. If I have any long term issues I will report then here.

For those looking for an alternative to EM24 ethernet meter I can confirm that the EM330 (non-v27 version) works in the above setup.


Thank you @matt1309 for your help.Displaying Screenshot_2022-11-24-17-37-27-095_com.android.chrome.jpgDisplaying Screenshot_2022-11-24-17-41-51-961_com.android.chrome.jpg

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.