question

rolandka avatar image
rolandka asked

Venus GX to pull GPS coordinates from onboard router (Teltonika RUT955)?

I have a Venus GX and a Teltonika RUT955 router installed in my motorhome. The router has a separate GPS antenna and aware of the current location. I was wondering if there is any way to transfer this to the Venus GX device and then to the VRM portal?


The router has RS232 and RS485 ports, it also supports Modbus TCP. It is highly customisable so I was wondering if there is any way VGX can receive it? Which would be the easiest way?

Venus OSVenus GX - VGXModbus TCPrs485
8 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.

wkirby avatar image wkirby ♦♦ commented ·

That sounds interesting. It's probably possible with some customization of the VenusOS.
I'm going to move this question to the "Modofications" section where these type of questions are better suited.

0 Likes 0 ·
rolandka avatar image rolandka wkirby ♦♦ commented ·

Thanks. As soon as my build is finished I will look into this in detail. Currently is at the very bottom of the priority list. I just thought I throw the question here and there might be someone had already figured out a solution to it.

0 Likes 0 ·
laurenceh avatar image laurenceh commented ·

I might ask why, depending on how you value your time? I have a Raspberry pi 3B+ and plugged in a £16 GPS USB device it worked first time without any issue, which included data being shared with the VRM portal.

If the use case is to play with the technology then I’m pretty certain it could be done. I can confirm that if no GPS device is found then there is no GPS data on the dbus so you could probably publish your own data without conflict.

0 Likes 0 ·
spanner avatar image spanner laurenceh commented ·

hi - can you provide a link please for the GPS? thanks

0 Likes 0 ·
Ulrich avatar image Ulrich spanner commented ·

I bought a USB GPS dongle from amazon, it will come tomorrow and will report whether it works.

0 Likes 0 ·
spanner avatar image spanner Ulrich commented ·

Excellent - thank you

0 Likes 0 ·
laurenceh avatar image laurenceh spanner commented ·

VK-162 Remote Mount USB GPS Dongle G-Mouse Navigation Module External GPS Receiver Antenna for Raspberry Pi Linux Window Google Earth DIYmalls https://www.amazon.co.uk/dp/B07FKRXXSM/ref=cm_sw_r_cp_api_i_0ZRGRHWP1ERH5EWMNYB1

I purchased mine a year ago it’s more expensive now. It worked fine.

0 Likes 0 ·
Ulrich avatar image Ulrich laurenceh commented ·

Hi All,

i bought this: https://www.amazon.de/gp/product/B07LBWF1P7/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

Be shure, that the device will be supported from linux without any drivers.

I plugged it into an available USB port and it worked immediately.

Here are a few examples of Grafana: https://www.zoomsoft.de/grafana

If you have any questions, I'll be happy to help.

0 Likes 0 ·
17 Answers
Marc Elvery avatar image
Marc Elvery answered ·

If we could select USB or Network and if network was chosen then enter an IP/hostname, port number (default 10110?) and type (tcp/udp) and just use NMEA as source, that should not be to hard to implement I would guess. Would be a nice addition. Source could then be a ShipModul Miniplex for example.

If I look at the Teltonika wiki, it can send the GPS data to a server but not function as a server itself (or I'm misreading). Then we would need gpsd inside venusos

https://wiki.teltonika.lt/view/GPS

5 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.

rolandka avatar image rolandka commented ·

I don't think it can function as a server, I might shoot that question at their forum. I was wondering if there is any way to communicate with the VRM online portal? (in case it is too difficult to send it to VenusOS we could try sending it to VRM straight)

I know it has an API but that is only for reading out values as far as I can see. https://vrmapi.victronenergy.com/v2/docs

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ rolandka commented ·

Hello all, making a non Victron product send gps data straight to our vrm portal would be rather complex for anyone to achieve.


and adding support to receive GPS data over IP, in NMEA or other format to Venus OS is a feature thats surely possible but from Victron side its not worth the effort. We already offer enough options now that besides USB-GPS-es, also NMEA2000 types will work.

Doesnt mean someone could do that himself though: all tools and necessary information is available publicly.

0 Likes 0 ·
bradfordharley avatar image bradfordharley mvader (Victron Energy) ♦♦ commented ·

MVader---I understant completely!

Community--So, I have been looking at the system as I'm relatively new to venus. It appears that modbus tcp has entries for the GPS. I'll examine it when I get to the boat this afternoon, but before I dig too deeply, has anyone tried to insert data into modbus for the GPS? I found a plugin for node-red that claims to be able to write to modbus-tcp, and I'll look into that as well. Just wondering if there is any experience out there....
Brad

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ bradfordharley commented ·

Hi, let me put on my community hat for a second:


writing to the gps with modbustcp is (probably) possible, but only if you first run a “dummy” service on Venus to create a dbus service and required paths for a gps.

See our github, and then velib_python, it will have some dummy service code.

And see here:

https://github.com/victronenergy/venus/wiki/howto-add-a-driver-to-Venus


this wont be something you pull off in a few hours. One thing you could do to work on this at home is get a raspberrypi:

https://github.com/victronenergy/venus/wiki/raspberrypi-install-venus-image

Btw we’re also working on a project that involves node-red:

https://www.victronenergy.com/live/venus-os:extended


0 Likes 0 ·
bradfordharley avatar image bradfordharley mvader (Victron Energy) ♦♦ commented ·

Thanks for the pointers! If I get it working, I'll post back.


0 Likes 0 ·
teejmiller avatar image
teejmiller answered ·

I am also interested to see if anyone has been able to configure an IP based NMEA device! I have a Verizon MiFi 7730L which also sends raw NMEA text data over port 11010. When using telnet to this port, I am able to see the raw NMEA data. I have been able to use socat to manipulate the stream as an attached device, but I am without a clue on how the Venus system understands a GPS device is connected. If there was a way to just input the IP and Port settings that would be a very cool feature! For now, I'll keep poking around with socat and try to learn more about how Venus detects and parses GPS data.

2 |3000

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

Ralf Klüber avatar image
Ralf Klüber answered ·

Hello,

I have a similar setup (Venus GX and RUT955). I would like to understand whats the best way to get GPS data from RUT955 to Venus GX. Any hint appretiated.

Regards Ralf

1 comment
2 |3000

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

Ralf Klüber avatar image Ralf Klüber commented ·

The description of the protocoll used from the RUT955 can be found here:

https://wiki.teltonika-networks.com/view/RUT850_GPS_protocols

0 Likes 0 ·
bradfordharley avatar image
bradfordharley answered ·

I'm also interested. We are on a sailboat, and while it's easy to add a GPS device, we already have 4 GPS sources available over IP or NMEA. It would be great to be able to have venus subscribe to a tcp stream, signalk or something similar.


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.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Hi @bradfordharley, support for NMEA2000 GPS is available in the v2.60 beta series. And will become officially available once we finish v2.60 development and testing.

0 Likes 0 ·
stager avatar image stager commented ·

Having more than one GNSS receiver on Venus OS is rather pointless. No way to choose the best one. You can only see if a particular receiver is working or not.

0 Likes 0 ·
Ulrich avatar image
Ulrich answered ·

Any news on this?

2 |3000

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

tpn0711 avatar image
tpn0711 answered ·

Any News here? Iam also Watching for pulling the GPS Coordinates via RUTX12 Router to the Cerbo. Greetz!

2 |3000

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

mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi all, we won't be working on this ourselves anytime soon.

For anyone of you wanting to spend time on this, I suggest two possible routes to look into:

1. Make a python (or other language) script that takes the data from TCP and puts it on the D-Bus.

2. Install our Venus OS Large, which includes SignalK, and then see if either the signalk-venus-plugin supports pushing gps info from signalk to venus, or somewhere in SignalK make something that takes data from TCP and publishes it on N2K, where then Venus OS will pick it up automatically - as long as published on N2K correctly ofcourse.

2 |3000

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

bathnm avatar image
bathnm answered ·

Another quick option is too purchase a cheap USB GPS module and plug it directly into the Venus GX. This will then deliver GPS directly into the VenusOS!

1 comment
2 |3000

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

harold avatar image harold commented ·
Not shure if it will properly work, in a aluminium boat, inside a cabinet ;-)


0 Likes 0 ·
gootch avatar image
gootch answered ·

Hi,

Just as a possible solution.

I have the RUTX11 (forward the NMEA sentences via UDP or provide the position via ModBus) and a Cerbo GX.

I wrote a python script which pulls the data from the RUTX via ModBus and puts it on the dbus.

But this is not even necessary! (at least as soon as Teltonika fixes the issue that the UDP messages are sent multiple times)

The simplest way is to redirect the UDP frames to a serial interface.

So I just created a service which starts socat and opens the UDP port and redirects the traffic to /dev/ttyUDP0

socat UDP-RECV:8500 pty,link=/dev/ttyUDP0,raw,nonblock,echo=0,b115200

And another service which starts gpsdbus

/opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyUDP0 -b 115200 -t 0

Best Regards

Joachim


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.

nebulight avatar image nebulight commented ·

I just received my mikrotik LtAP router. They provide info here: https://wiki.mikrotik.com/wiki/Manual:System/GPS and Here: https://wiki.mikrotik.com/wiki/Manual:GPS-tracking

Anyway you may be able to adjust what you've done there to help me get my mikrotik working?

I made sure to set for NMEA:

[admin@MikroTik] > system gps set coordinate-format


* id prefix

dd Decimal Degrees DDD.DDDD

ddmm NMEA format DDDMM.MM[MM]

dms Degrees Minutes Seconds

" start of quoted string

$ substitution

( start of expression

[ start of command substitution

[admin@MikroTik] > system gps set coordinate-format=ddmm

When I do a system gps monitor here is what I get:

[admin@MikroTik] > system gps monitor

date-and-time: jan/28/2022 03:24:46
latitude: xxxx.xxxx (masked this info out)
longitude: -xxxxx.xxxx (masked this info out)
altitude: 723.200012m
speed: 0.351880 km/h
destination-bearing: none
true-bearing: 287.829987 deg. True
magnetic-bearing: 0.000000 deg. Mag
valid: yes
satellites: 9
fix-quality: 1
horizontal-dilution: 0.86

I purchased a serial to USB adapter with a PL-2303 chip but get nothing when I plug into the venus (expected but had to give it a shot)

0 Likes 0 ·
bathnm avatar image bathnm nebulight commented ·

The output needs to be in NMEA 0183 ascii messages, such as this (source is a Teltonika)..

$GNGNS,112250.00,5048.728557,N,00107.605473,W,AAN,15,0.7,2.6,47.0,,*03

$GPGSV,3,1,12,10,23,313,37,12,18,205,41,13,42,130,34,14,26,049,44*78

$GPGSV,3,3,12,23,36,277,43,28,,,38,36,,,38,39,,,34*49

$GPGSV,4,1,13,10,23,313,46,12,18,205,45,13,42,130,45,14,26,049,47*79

$GPRMC,112252.00,A,5048.728557,N,00107.605474,W,0.0,75.6,280122,3.6,W,A*09

$GNGSA,A,2,10,12,13,14,15,17,19,23,24,,,,1.1,0.7,0.8,1*37

$PQGSA,A,2,,,,,,,,,,,,,1.1,0.7,0.8,4*32


If You an get output like this then the solution below of creating a service on VenusOS that runs this command would work..

socat UDP-RECV:[port] pty,link=/dev/ttyUDP0,raw,nonblock,echo=0,b115200

and also

/opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyUDP0 -b 115200 -t 0


The first command will take the data off the network and present it to a TTY interface. The second command loads the VenusOS gps_dbus interface to take the data from the TTY interface and load into dbus.

0 Likes 0 ·
bathnm avatar image
bathnm answered ·

@Gootch Great solution...

A bit of tweaking on the forwarding cache and I seem to only be sending 1 message.

Have to remember this for the future as it is a great way of getting GPS data into the device simply.

1642614544139.png


1642614544139.png (85.5 KiB)
1 comment
2 |3000

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

luphi avatar image luphi commented ·
Hello bathnm,

could you please explain in more details, what you did get thr router only sending one message?

Currently it works, but the load of my Cerbo is >5, which really slows it down.

Cheers,

luphi


0 Likes 0 ·
gootch avatar image
gootch answered ·

Hi @Bathnm,

yes it's simple and it seems to work reliable.
I have now also figured out a solution to distribute it across the whole network as there might be additional receiver of the position.

I added also a service to my Teltonika RUTX11 which sent the position as Multicast.
I just configured the NMEA forwarding to localhost 127.0.0.1 and added a service

socat UDP-RECV:8500 UDP4-DATAGRAM:192.168.9.255:6666,broadcast,range=192.168.9.0/24

which opens the local port and put it on the multicast address.

This by the way also fixe my issue with multiple messages sent by the RUTX11. Now I get every second one NMEA Sentence (for the selected ones) on Port 6666 as multicast.

Lowers the CPU load on the VenusOs by a lot.

And every Linux device in the network has now a GPS Position by creating a virtual serial port as described in my last answer.

Regards Joachim

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.

bathnm avatar image bathnm commented ·
@Gootch I must go and investigate socat a little more, not really used it. May I ask how you created a service on the Teltonika? Was it as simple as creating a script in /etc/init.d and adding it to the relevant run level?
0 Likes 0 ·
gootch avatar image gootch bathnm commented ·

Hi @Bathnm,

at least that is what I did.

I just did a quick search if there is also a mechanism to survive a firmware update like for the venus os, but I didn't find one.

So I just added a script to init.d and enabled it for autostart.

I also didn't use socat before but that's also what I thought as well have to investigate it more.

Regards Joachim

0 Likes 0 ·
luphi avatar image
luphi answered ·

All,

I added the following lines to /data/rc.local. Works fine.

#
# get GPS from router
#
/usr/bin/socat UDP-RECV:8500 pty,link=/dev/ttyUDP8500,raw,nonblock,echo=0,b115200 &
while [ `ps|grep gps_dbus|grep -v grep|wc -l` -eq 0 ]
do
  sleep 1
  /opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyUDP8500 -b 115200 -t 0 &
done

Cheers, luphi

1 comment
2 |3000

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

Holger Watermann avatar image Holger Watermann commented ·

Great solution - it works from my other SignalK computer after enabling the sk-udp plugin there.

(i added your script to

/data/rcS.local


... so it autostarts at boot)


many thanks

Holger

0 Likes 0 ·
czarofak avatar image
czarofak answered ·

@Gootch , @luphi , could you explain it in more detail?

i have got a RUT955 and would like to share the GPS signal with the Cerbo GX and my HomeAssistant. Therefore, i think your solution is perfect.

is this correct:

1. Forward NMEA to localhost 127.0.0.1 in the RUT955 and add the service:

socat UDP-RECV:8500 UDP4-DATAGRAM:192.168.9.255:6666,broadcast,range=192.168.9.0/24

2. Copy the following lines to the end of Cerbo's "/data/rcS.local"

```

#

# get GPS from router

#

/usr/bin/socat UDP-RECV:8500 pty,link=/dev/ttyUDP8500,raw,nonblock,echo=0,b115200 &

while [ `ps|grep gps_dbus|grep -v grep|wc -l` -eq 0 ]

do

sleep 1

/opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyUDP8500 -b 115200 -t 0 &

done

```

3. Add the sk-ups plugin in the Signalk Server, if you need the GPS position for it

Questions:

  1. How do i setup a service in the RUT955?
  2. i can't find the "sk-ups"-plugin
1 comment
2 |3000

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

Holger Watermann avatar image Holger Watermann commented ·

the signalk-plugin to send the gps-date ist called "signalk-udp"


and from venus os you are able to see the gps data for testing:

cat /dev/ttyUDP8500

and these commands autostart and restart the service in victron os -> paste it to "/data/rcS.local". just modified the second "&" it was at the wrong position: it should be after the while loop to restart the reading if it was gone for any reason. the first socat runs stable in the background here, so it does not need an while loop.


#
# get GPS from router
#
/usr/bin/socat UDP-RECV:8500 pty,link=/dev/ttyUDP8500,raw,nonblock,echo=0,b115200 &

while [ `ps|grep gps_dbus|grep -v grep|wc -l` -eq 0 ]
do
sleep 1
/opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyUDP8500 -b 115200 -t 0 
done &


exit 0




0 Likes 0 ·
bathnm avatar image
bathnm answered ·

@CzarofAK, regarding your 2nd question. I have a RUTX11, and under system, there is a customs script. I pasted this into it

socat UDP-RECV:8500 UDP4-DATAGRAM:x.x.x.255:6666,broadcast,range=x.x.x.0/24 &

On every reboot this command is run.

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.

czarofak avatar image czarofak commented ·

@Bathnm, thanks for you swift reply.

I guess like that.

unbenannt1.png

How did you configure the GPS NMEA page, like that?

unbenannt1.png

even i have done it like that an restartet the router as well as the Cerbo, i have not got a GPS signal yet. see below my rcS.local file:

unbenannt1.png

0 Likes 0 ·
unbenannt1.png (20.5 KiB)
unbenannt1.png (10.9 KiB)
unbenannt1.png (22.1 KiB)
czarofak avatar image czarofak commented ·

Here my analysis with wireshark.

unbenannt.png

is the destination IP and Port wrong?

0 Likes 0 ·
unbenannt.png (13.5 KiB)
czarofak avatar image czarofak czarofak commented ·

I changed this:

socat UDP-RECV:8500 UDP4-DATAGRAM:192.168.2.255:6666,broadcast,range=192.168.2.0/24 &

into this:

socat UDP-RECV:8500 UDP4-DATAGRAM:192.168.2.20:8500,broadcast,range=192.168.2.0/24 &

192.168.2.20 is my Cerbo GX

Now i get a position even in SignalK, but without heading...

0 Likes 0 ·
Holger Watermann avatar image Holger Watermann czarofak commented ·
the last "&" of your rcS.local file is at the wrong position,: it should be positioned after the done!

So the complete while loop is running in the background and restarts the dbus-reader if something goes wrong with the gps connection. This runs fine here for many weeks now.


regards - holger

0 Likes 0 ·
gootch avatar image
gootch answered ·

Hi @CzarofAK ,

I'm not the linux expert on services and as each distribution has it's own init daemon makes things not simpler.

So on the VenusOs I added the two calls in two run scripts as they are supervised and if a process somehow crashes it will be restarted.

I did the similar thing on the RUTX by adding a script to the init.d folder and also added the respawn parameter.

#!/bin/sh /etc/rc.common

USE_PROCD=1
START=99

start_service() {
         procd_open_instance [instance_name]
         procd_set_param command socat UDP-RECV:8500 UDP4-DATAGRAM:192.168.x.255:6666,broadcast,range=192.168.x.0/24
         
         procd_set_param respawn ${respawn_threshold:-60} ${respawn_timeout:-5} ${respawn_retry:-5}

}

you need to start the service and enable the service for autostart via the cli.

RUTOS is a openwrt fork so the openwrt documentation helps a lot in addition to the teltonika one.

I cannot help with SignalK as I don't use it.

Regards Joachim

2 |3000

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

pau1phi11ips avatar image
pau1phi11ips answered ·

Thanks so much to all the posters in this thread to make this happen. Works amazing using socat!

It took me way longer than it should've done to get working since I didn't change the default NMEA forwarding from TCP to UDP and assumed I'd messed up something when editing over SSH instead but got there in the end.

2 |3000

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

nebulight avatar image
nebulight answered ·

EDIT: FIXED! I forgot to do a chmod 755 on my rc.local file. Once I did that it startups up perfectly!

Hello all. I just purchased an RUTX11. I was able to get this working with the following settings but I'm having issues (see below). There is not startup script in the router as I have nothing else on the network that is going to use GPS. The second photo I'm just pointing the NMEA forwarding directly to the GX (192.168.1.146 is my GX) :

1667920103828.png

1667920129959.png

1667920161061.png

but sadly it won't start automatically. I put the following in my rc.local:

#
# get GPS from router
#
/usr/bin/socat UDP-RECV:8500 pty,link=/dev/ttyUDPRUTX11,raw,nonblock,echo=0,b115200 &
 
while [ `ps|grep gps_dbus|grep -v grep|wc -l` -eq 0 ]
do
sleep 1
/opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyUDPRUTX11 -b 115200 -t 0 
done &
 
 
exit 0

If I reboot the GX, even with this in the RC.local, it won't be there at startup. I have to SSH in and manually run rc.local then it shows up and works great until the next reboot.

1667920624867.png

Then after I run rc.local:

1667920659597.png

I tried to modify the script to have a sleep 30 but that still doesn't work. Any ideas? Running 2.92 on a raspberry pi. I have a cerbo, but for all my testing I've been using this pi.


1667920103828.png (42.5 KiB)
1667920129959.png (65.5 KiB)
1667920161061.png (45.7 KiB)
1667920624867.png (42.3 KiB)
1667920659597.png (48.9 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.