KPLEX with Vexilar SP200 RC Boat

112 views
Skip to first unread message

SamT

unread,
Oct 2, 2020, 6:21:04 AM10/2/20
to kplex
I currently have a Vexilar SP200 connected to my phone using Navionics Boating App...

Issue is the navionics uses the gps of my phone and my phone is not on the boat, so what I would like to do is this:

Vexilar SP200 (via wifi) -> RPi KPLEX (via wifi) ->  navionics on phone

But at the point when the signal comes through kplex and is re-broadcast I would like to add GPS data to the broadcast from an USB GPS that is connected to the RPi (which is on the RC boat) in turn making Navionics use the boats location and not the location of my phone which is not on the boat.

The plan is to use the boat to map the bottom of lakes / ponds

Thanks in advance for any help!

Keith Young

unread,
Oct 2, 2020, 8:55:38 AM10/2/20
to kplex
I'm not familiar with the Vexilar SP200.  My initial thought was that this is putting out image data rather than NMEA-0183 sentences and if that's the case tehn kplex won't forward those data (it only forwards NMEA-0183).  Having said that a bit of googling unearthed this:
...which although I don't have time to read through it, would suggest that it's possible to get depth info out of the device, abeit with some coding.

Combining a usb gps with a source of depth information is trivial (as long as you know how to connect to your depth information). For example, if you knew you could get depth info from a tcp server at 192.168.1.1, port 5000 and you wanted to combine with with data from a USB gps which is connected to your raspberry pi on /dev/ttyUSB0 and then make the entire datastream available on tcp port 10110 on your raspberry pi you'd have a config file which looked something like this:
[tcp]
name=depths
address=192.168.1.1
port=5000
persist=fromstart
direction=in

[serial]
name=usb_gps
filename=/dev/ttyUSB0
direction=in

[tcp]
name=kplex_server
mode=server

If you can't easily get depth info out of the vexilar in nmea format and the coding is not something you want to try...does navionics not make an entirely separate (ie non-nmea) connection to that leaving you free to use navionics boating's nmea server configuration to connect to the raspberry pi?  The recent versions of Navionics boating allow you to configure a server for nmea data so you can just point it at the pi which is is serving data from the attached usb gps (ie similar to the above but without a connection for depth).  Presumably the split screen navionics sonar feature is independent of that setting?

Sorry to not be more familiar with the sp200.  The manual doesn't seem to give too many technical details

SamT

unread,
Oct 2, 2020, 9:27:16 AM10/2/20
to kplex
hi keith,

thanks for coming back to me...

I will take a look into the output a bit more of the SP200 to see exactly what is coming out data wise, hopefully its nmea data...

I also found https://github.com/Paulie-P/SonarInterface which looks like a nice simple py interface so this may give me more clues.

Thanks Sam

Keith Young

unread,
Oct 2, 2020, 10:44:14 AM10/2/20
to kplex
Interesting... It seems then it's definitely possible to extract depth from it.  There's a bit more detail in on message structure in:
In SonarPhony he's creating NMEA sentences from these data

I confess though I have no idea how such a device would transmit data.  Are those depth figures the reading directly under the transducer at any given time or does it scan forward a put out a vector of results at different ranges? (apologies for being lazy and not reading the code I linked to.. see previous disclaimer :-)

If you can hack together something to output DBT sentences, your choices are:
- write to a FIFO in the file system which a kplex interface reads from
- make kplex start a tcp server which your program connects to and feeds data to
- make your data available via a tcp server which kplex connects to
- multicast it
- feed it into kplex's standard input (probably the most straightforward)

Grzegorz Alkonowsky

unread,
Jan 4, 2021, 1:03:54 PMJan 4
to kplex
Hello everyone, the configuration with GPS and Navionics over TCP works for me and GPS.
My configuration:


[serial]
filename=/dev/ttyUSB0
direction=in
baud=57600

[tcp]
mode=server
port=10110
direction=out



But I can't configure the data to be received over UDP. Can anyone give me a config for UDP how should it look right ??

[udp]
port=2000
directin=out

The fishfinder has the address: 192.168.0.1


Thank you for your help

Keith Young

unread,
Jan 6, 2021, 7:34:32 AMJan 6
to kplex
Can you explain the setup here a bit more?  Am I correct in guessing that you have the pi and navionics on a phone or tablet both connected to an network made by an SP200?  If that's the case and by "I can't configure the data to be received over UDP" you mean "received by Navionics, sent by kplex" then try the following:
1. Correct the typo if that exists in your config rather than just a mistake in transcribing it to the message :-) ("direction=out" rather than "directin=out")
2. Add:
device=wlan0
...assuming your wireless network is on wlan0: This is generally the case for the latest raspberry pi OS with one wifi interface but may differ for other OSes.  Putting the broadcast address (e.g. "address=192.168.0.255") would be an alternative but the device is fewer characters and will still be valid if your network address changes.
3. In Navionics  go to menu->Paired Devices and select settings the device you're using (or add a new one).  Ensure "UDP" is selected, put 2000 as the port, but here's the trick: "host" should be "0.0.0.0" and *not* the address of your pi.

Let us know if it worked or if my assumptions were wrong

Max Nae

unread,
Mar 21, 2021, 9:34:25 AMMar 21
to kplex
Hello the easiest way to map with boating hd is if you have a tcp server running on the raspberry in kplex. that works too. You can use the NTRIP Client app on the tablet (Android only) to fool the tablet into the location (GPS Mock Locations) of the boat.
That with the nmea data via udp does not work for me until now either. as soon as I add the udp steam to the tcp server, nothing works anymore. Boating HD needs the NMEA data on port 2000 if it is to run directly without an additional app.

Could someone here give me an example of how to adjust this?
[serial]
filename=/dev/ttyUSB0
direction=in
baud=9600
[tcp]
mode=server
port=10000
direction=out
everything I try after that doesn't work.   
my build is. I have a Raymarin echolot connected to wlan0. the data is forwarded to wlan 1 via socat. here they are then displayed to me on the tablet. everything works too. just how can i add the udp nmea stream.

hope someone can help me here

Max Nae

unread,
Mar 22, 2021, 11:52:43 AMMar 22
to kplex
I have the solution. you don't use kpex but socat. you can only use a gps once. Socat must be assigned its own gps. you can then send the data like this.
sudo socat /dev/ttyAMA0 UDP4-SENDTO:192.168.2.255:2000,broadcast
for me the gps is connected to the uart tx rx ports so ttyAMA0 the network i send it to is 192.168.2.255. this means that all devices can use the gps udp stream.

greeting max

Keith Young

unread,
Mar 26, 2021, 10:19:18 AMMar 26
to kplex
I've been trying to work out what you're trying to do here and I confess I'm still not completely sure.  What I believe is that you have a raspberry pi with one interface as a client of a raymarine fishfinder (marketed as "dragonfly" in english speaking countries?) and a tablet connected to the other (wlan1).  The fishfinder does not output NMEA data, so kplex would not forward any of those data.  Presumably the data is broadcast over UDP by the fishfinder, you are collecting that and forwarding it from wlan0 to wlan1 using socat.  So far so good?

Your kplex configuration references a USB GPS which I don't see you say is working.  Your second message talks about a GPS connected via the pi uart which presumably does work.  If you wanted to use that GPS and broadcast the data to port 2000 on wlan1 the configuration would look like this:
[serial]
direction=in
filename=/dev/ttyAMA0
baud=9600

[udp]
direction=out
device=wlan1
port=2000

For an output udp connection if you don't supply an address, kplex assumes you mean broadcast to the network interface's broadcast address.
The above configuration should do the same for you as your socat but with additional configuration kplex also gives you the opportunity to do error checking, make the data also available on a tcp server, only forward certain sentence types etc.

Where I'm getting confused is the NTRIP client.  This is not something I've had a lot of experience with but is it not usually the case that an NTRIP client will feed dgnss information to an associated gnss receiver or is this a program which synthesises a location by combining NTRIP data with an incoming NMEA datastream and makes it available over android's mock location provider?  And was the role of the tcp server in your configuration to feed GPS *to* the tablet or to receive a stream of corrected GPS data *from* the client?

I recall from using navionics on my phone that it stops paying attention to internal GPS when you provide it with an external data feed.

Max Nae

unread,
Mar 27, 2021, 4:32:05 AMMar 27
to kplex
Hello, I have the Raspberry with a GPS receiver in the bait boat and the echo sounder is in the bait boat. The Raspberry also receives wlan0 the echo sounder and forwards it to wlan1. unfortunately the echo sounder does not have its own gps signal. In the raspberry, the tcp server runs with kplex and sends the gps data to the tablet on wlan1. the ntrip client app also runs on the tablet and simulates the location of the boat with the kplex gps data. That works so far. With the direct udp stream, I no longer have to use the ntrip app. the data are processed directly in boating hd.

I have now also found the problem. as soon as I have set the tcp server in kplex, kplex starts automatically when starting. as soon as I use the udp stream, kplex no longer starts automatically. if I start kplex over the console then it works. does anyone know the problem?

Keith Young

unread,
Mar 27, 2021, 11:49:02 AMMar 27
to kplex
What's your full kplex configuration?  There was no reference to the udp configuration in what you posted earlier.   Is your socat command which you're using to forward from wlan0 to wlan1 listening on the same port and interface as you're trying to make the udp interface do?

Max Nae

unread,
Mar 28, 2021, 9:27:38 AMMar 28
to kplex
this is my complete kplex configuration

[serial]
filename=/dev/ttyUSB0
direction=in
baud=9600
[tcp]
mode=server
port=10000
direction=out

and that also always works with autostart
as soon as I use udp or add it to it, it no longer works. the port is not occupied by another program.

this cannot be started automatically, and neither can tcp and udp at the same time.
[serial]
direction=in
filename=/dev/ttyUSB0
baud=9600

[udp]
direction=out
device=wlan1
port=2000

Keith Young

unread,
Mar 28, 2021, 11:09:55 AMMar 28
to kplex
I think I can have a good guess at the problem.  This will be about kplex trying (and failing) to start before wlan1 is fully configured.  Are you using a unit file or the legacy scripts which come with the kplex deb?  If you remove ditch the legacy startup scripts and go with a unit file which looks something like this, you may get better results:

[Unit]

Description = NMEA 0183 Multiplexer

Documentation = http://www.stripydog.com/kplex/configuration.html

After=syslog.target network-online.target audit.service

[Service]

Type=forking

PIDFile=/var/run/kplex.pid

ExecStart=/usr/bin/kplex -p /var/run/kplex.pid -o mode=background

KillMode=process

[Install]

WantedBy=multi-user.target

Max Nae

unread,
Mar 30, 2021, 2:49:28 PMMar 30
to kplex
I've found another way terminate the service
sudo service kplex stop
then start kplex with rc.local
sudo nano /etc/rc.local

then insert it here
_IP = $ (hostname -I) || true
if ["$ _IP"]; then
   printf "My IP address is% s \ n" "$ _IP"
fi
iptables-restore </etc/iptables.ipv4.nat
(sleep 10s && sudo kplex) &
exit 0

Keith Young

unread,
Mar 31, 2021, 7:40:20 AMMar 31
to kplex
I've found another way terminate the service
sudo service kplex stop
then start kplex with rc.local

This probably isn't as good a way as using systemctl, ie instead of your rc.local edits:
Remove the sysv compatibility scripts:
sudo mv /etc/init.d/kplex /usr/share/kplex/kplex.init
sudo update-rc.d kplex remove
Install the unit file I posted above as /lib/systemd/system/kplex.service .  This is on the kplex website so you can do:
sudo wget -O /lib/systemd/system/kplex.service https://stripydog.com/download/kplex.service
...and enable it:
sudo systemctl enable kplex

This way kplex will be shut down cleanly when you reboot and you can start and stop it using systemctl
Reply all
Reply to author
Forward
0 new messages