question

model3rider avatar image
model3rider asked

EM540 via Ethernet

I would like to replace an EM24 Ethernet with an EM540 and can only connect to the Cerbo via a LAN cable.


can someone tell me if a standard RS485 to Lan converter, e.g. a Waveshare RS485 to RJ45 Ethernet Converter Module, works?

Energy Meter
2 |3000

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

3 Answers
rickc avatar image
rickc answered ·

I am currently doing this with an EM530 (same as EM540, but with external CTs, US split-phase).

But to accomplish this, I've had to add two custom services in /opt/victronenergy/service. It will not work out of the box without modifying Venus OS.


The first service runs this:

/usr/bin/socat pty,link=/dev/ttyV0,raw tcp:192.168.1.101:502

The second service runs this:

/opt/victronenergy/dbus-cgwacs/dbus-cgwacs /dev/ttyV0

These services create a virtual pty that the Cerbo GX or other Venus OS device can use like a regular serial port, and then starts a CGwacs instance on it. I like the services approach because they automatically reconnect if the ethernet is disconnected or power is cycled, it just keeps working.

This Waveshare device is used in Transparent mode on port 502. This is NOT modbusTCP! It is modbusRTU over TCP/IP. I also set the EM530 and waveshare to use a 115200 baud rate because I like my data snappy. This is working very very well in v3.00~36 for me. dbus-spy and the Cerbo menus are updating grid power at what appears to be 10 Hz.
img-6294.jpg


img-6294.jpg (953.8 KiB)
4 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.

pieh0 avatar image pieh0 commented ·

Just done this with my ET112 meter, works like a charm.

Thanks for putting this mod out there :)


Full process for anyone else wondering is...


cd /opt/victronenergy/service

mkdir meter1 meter2

cd meter1

nano run

paste this code

#!/bin/sh
exec 2>&1
exec /usr/bin/socat pty,link=/dev/ttyV0,raw tcp:<<RS485 TO ETHERNET IP HERE>>:502

Exit nano

chmod 755 run

cd ../meter2

nano run

paste this code

#!/bin/sh
exec 2>&1
exec /opt/victronenergy/dbus-cgwacs/dbus-cgwacs /dev/ttyV0

exit nano

chmod 755 run

Then reboot


After reboot, you'll see your ModbusRTU over Ethernet bridge working, and hopefully, the meter will have already been populated in the system.

2 Likes 2 ·
Ricardo Chavarria avatar image Ricardo Chavarria commented ·
Hi @rickc could you share pictures/details of how you connected the CTs and the inline fuses you used to connect N/L1/L2?


I'm about to receive my EM530 and can't find any info or examples of connections. It'll be a 3-wire split phase installation.


Thanks!

0 Likes 0 ·
Show more comments
ulfilas avatar image
ulfilas answered ·

I have a similar problem but i use FHEM as gateway. But i am not so familiar with the VenusOS.

Can you add some more comment on your solution?

In which file i can add the two lines to have the service available on startup?
How can i check if the service is running correct?
I get no responce on the console if i run the fist service and also there also no TCP-request on my gateway.


2 |3000

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

rickc avatar image
rickc answered ·

I’m not a Venus OS expert, all I did was clone one of the existing directories in /opt/victronenergy/services, creating two new directories, and then modified the command lines in the ‘run’ file in the new directories to what I posted above.

I recommend spending some time reading posts and the GitHub documentation of VenusOS. My solution is just a hack to make it work, it needs to be re-installed with every release. Others in the Modifications space with more VenusOS experience may be more helpful.

2 |3000

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

Related Resources