Hi All,
I wanted to post this here so others can find it if they are also attempting to do the same thing. Also open to feedback if something is not best practice.
I have a caravan setup using Cerbo and wanted to track the van in VRM mostly for security. We have a Mikrotik LTAP Mini router for our internet connection with a 4g connection running all the time. I wanted to send the GPS data from the router to the Cerbo instead of running a seperate GPS receiver mostly due to the fact that the router has a GPS antenna mounted externally, and the Cerbo is down "in the bowels".
I had looked around this forum and elsewhere and did have running a script sending the GPS location to the Cerbo using MQTT and https://github.com/freakent/dbus-mqtt-devices however didn't like the complexity of this setup and wanted to do it in a cleaner way.
I found this post https://community.victronenergy.com/questions/17470/venus-gx-to-pull-gps-coordinates-from-onboard-rout.html using UDP and the SOCAT command and thought I could get something like this working with my Mikrotik.
The issue with the above example is that the "remote-access" function of the mikrotik uses TCP rather than UDP.
Ive modified the SOCAT commands from the original UDP example and now have a working solution. To get this working the below steps should be all that is required.
1. Setup the router - test and then disable the GPS functionality on the router under /system gps. Make sure you get a fix and location data in the /system gps menu then make sure to disable the service so your remote-access service can use the serial port.
2. Configure "remote-access" on the router to the serial port the GPS uses. This website is useful. https://wiki.mikrotik.com/wiki/Manual:Port If using Serial0 like my example you need to disable the system console on this port. Picture of my settings.
/system console disable 0
3. Create a script to run the commands at boot time of the Cerbo. Make sure to set the TCP address correctly to your router address and the port to the one you have set in remote-access above.
nano /data/etc/gps.sh
# # get GPS from rout /usr/bin/socat tcp-connect:192.168.88.1:10000 pty,link=/dev/ttyTCP10000,raw,nonblock,b115200 while [ `ps|grep gps_dbus|grep -v grep|wc -l` -eq 0 ] do sleep 1 /opt/victronenergy/gps-dbus/gps_dbus -s /dev/ttyTCP10000 -b 115200 -t 0 & done
4. Modify /data/rc.local on the Cerbo to run the above script. Below is mine. Just add the line
sh /data/etc/gps.sh
nano /data/rc.local
#!/bin/bash sh /data/etc/dbus-serialbattery/reinstalllocal.sh sh /data/etc/gps.s
5. Reboot. Your GPS data should now show up as per this pic.
This is working well for me however please let me know if you think there are any issues with this setup. Also please comment if you find it useful!
Best regards, Mike.