Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 08-05-2014, 16:47   #16
Registered User

Join Date: Oct 2012
Location: Brighton, UK
Boat: Westerly Oceanlord
Posts: 513
Re: Android GPS via BT to Laptop Opencpn

Quote:
Originally Posted by rgleason View Post
What is a TCP Server?
TCP also introduces the terms "server" and "client", the server being the peer that listen()s for an incoming connection.
That's fair, although it actually doesn't answer your other question

Quote:
Originally Posted by rgleason View Post
So when the NRelay app, using wifi, asks for the Server Address
Is that the IP address of the cell phone?
With apologies for not having read up on the details of these apps beyond what you've posted (so I could be talking nonsense), I'd guess that if this app is asking you for a server address then *it* intends to connect to *something else*, i.e. this app is the "client" and you give it the address of the "server" to connect to. Asking for a server address could conceivably be a legit question for a program which is itself a server, but let's not go there: it's unlikely to apply to a phone app and this is complicated enough already.

So should you get OpenCPN to act as a server and put in your laptop address? Unfortunately no: You're SOL with this configuration. Unless someone has changed it in a recent beta this is the big network dataconnections gotcha. OpenCPN can act as a tcp server but only to *send* data, not receive it. Server as talker, client as listener is a more common scenario (which OpenCPN implements) but it aint always so.

Your best bet is an app which implements a server, i.e. it sits there waiting for something else to initiate a connection to it, then sends the data. The app's instructions should hopefully tell you the port (if not configurable). If the app doesn't tell you the phone's IP address go to settings->About Phone->Status and the IPv4 address should be in there under "IP Address". Plug that address and port into the settings for your OpenCPN tcp data connection.

Of course I could waffle on about why tcp is the wrong protocol for this stuff and it's UDP you really want but that's just academic: get it working first and worry about finessing later :-)
muttnik is offline   Reply With Quote
Old 08-05-2014, 17:18   #17
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,630
Images: 2
Re: Android GPS via BT to Laptop Opencpn

Muttnik, I was hoping you'd see my struggle and help straighten me out! Thank you for the bigger picture explanation, it is very helpful and drives home the little I found out today by reading and searching. What you wrote above is worthwhile to re-read!

I did have some luck and help from Bluetooth GPS folks and got Opencpn working with GPS from my Samsung S4 phone via bluetooth, using BT Serial Com port.

Bluetooth GPS Output (BTGPS) with Samsung S4 & OpenCPN on Windows
Bluetooth GPS Output by Meowsbox
https://play.google.com/store/apps/d...meowsbox.btgps
================================================== =============
Here are a few things to check:

1. For a Windows Computer make sure 'Bluetooth Support Service' is running and set to 'Automatic' by going to -> Control Panel -> Administrative Tools -> Services (select it from the list)" If it is disabled enable it.

2. Did you create the Bluetooth pair from inside BTGPS app? If not, delete the pairing and start over. Pairing from within our app is different than the regular Android way. To delete the pairing, go to Devices and Printers, right click on the Samsung S4 and select Remove.
If you don't want to delete your existing pairing, then you'll need to create the outgoing virtual COM port manually.

3. Create a new pairing while Bluetooth GPS Output is running. One of the advantages to doing this is that your computer will automatically find and create the virtual COM ports as part of the pairing process. On the phone in the BTGPS app touch MENU, ADVANCED SETTINGS, then select EMULATED ONLY. (Usually required for Samsung S3 or S4) which launches Bluetooth GPS Output from your phone.

4. Make your phone discoverable via the BTGPS application menu. This is a convenient shortcut.

5. On your computer, search for Bluetooth devices and locate your phone in the list of available devices and initiate the pairing.

6. Pair the Samsung S4 Phone and your Laptop Bluetooth by confirming a number on each device. Check to see that the pairing worked under Devices and Printers.

7. Determine the correct Com Port for Opencpn. Under Windows 7: Control Panel > In search type Bluetooth > Pick Change Bluetooth Settings. Here you should see which Com Port is the "SPP Slave" use that Serial Com Port Number for the Opencpn Connection.

8
. In OpenCPN under Settings > Connections > Add New > Connection Type= SERIAL (not a network), DataPort= the COM port of your phone listed as "SPP SLAVE" (See the guide below for pictures and more detail), Speed=9600 baud is usually sufficient, Priority=0, Check Control Checksum, uncheck "Garmin mode for input". Other settings can be left to their defaults. Make sure the connection is checked.

9, Test by seeing your Boat become Red and move to true location and by Checking the Nmea Debug box under Connections, to see the Nmea commands being received.

10. For more details, related to Windows 8, but still applies:
https://software.intel.com/en-us/blo...re-apps-part-3

11. You are given 10 minutes per use to allow testing then requested to purchase. The best way to purchase is through Paypal as it is good for 5 devices that way. About $2. Their response to my questions was within 6 hours and quite detailed, with Opencpn information.

If you are using Windows 8, John - a user at Intel, has put up a great Windows 8 pictorial guide to getting set up.
Windows 8 Pairing Guide https://software.intel.com/en-us/blo...re-apps-part-3

SUCCESS!
I invite others to post their detailed APP settings and success.
http://meowsbox.com/btgps/support.html
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2014-05-08 19.51.05-sm.png
Views:	525
Size:	226.6 KB
ID:	80779  
rgleason is offline   Reply With Quote
Old 08-05-2014, 17:27   #18
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,630
Images: 2
Re: Android GPS via BT to Laptop Opencpn

Rick wrote:
Quote:
So when the NRelay app, using wifi, asks for the Server Address
Is that the IP address of the cell phone?
Muttnik wrote:
Quote:
So should you get OpenCPN to act as a server and put in your laptop address? Unfortunately no: You're SOL with this configuration. Unless someone has changed it in a recent beta this is the big network dataconnections gotcha. OpenCPN can act as a tcp server but only to *send* data, not receive it. Server as talker, client as listener is a more common scenario (which OpenCPN implements) but it aint always so.
Then in my opinion, this Nrelay app is Fubar (beyond all recognition) and is now banned from my phone. --Is it perhaps intened to bring GPS TO the phone? Not from what I read.
rgleason is offline   Reply With Quote
Old 08-05-2014, 17:41   #19
Registered User
 
idylours's Avatar

Join Date: Mar 2013
Location: Toronto on
Boat: Catalina 30
Posts: 46
Re: Android GPS via BT to Laptop Opencpn

I remember a time when the filber flange wouldn't mesh with grapple grommet..now that was a problem...
idylours is offline   Reply With Quote
Old 09-05-2014, 11:58   #20
Registered User

Join Date: Oct 2012
Location: Brighton, UK
Boat: Westerly Oceanlord
Posts: 513
Re: Android GPS via BT to Laptop Opencpn

It does sound as though Bluetooth is the right way to go in this application but let's just round off the TCP side of things as my interest was piqued, so I downloaded NRelay and BlueNMEA to test. Any comments on functional issues are not intended as criticisms as both are being given away free and the NRelay developer seems to have made the source available.

NRelay works as I guessed. The "Server Address" is the address of a server to connect to. It connects to a server elsewhere on the network and sends the phone's GPS data *to* it. That's not "wrong", it's just that many devices / programs, including OpenCPN, expect the data flow to be *from* the server *to* the client. I thought I could easily overcome this by using kplex to create a bi-directional tcp server which I could use to effectively join NRelay (as a client) and OpenCPN (as a client), but no data seemed to flow. A packet dump revealed that NRelay is terminating sentences with Carriage Return (ascii 0xd) rather than the NMEA-0183 standard Carriage Return - Line Feed (0xd0xa) so kplex was dropping it as an invalid sentence. NRelay also refused to work when using the phone as an access point, thinking that it wasn't connected to a network. I'd therefore suggest that NRelay is not the best choice for use in this context.

BlueNMEA wants permission to look at my phone ID and status which seems unnecessary but I proceeded in the name of science! I'm guessing from the name that Bluetooth is the primary intended use mode but I'm on a roll with the TCP thing here...

BlueNMEA implements a tcp server and it does work with OpenCPN. It doesn't allow you to change the port it runs on from 4352 but no big deal. In OpenCPN's connections menu create a network data connection, protocol = tcp, address = <ipv4 address of phone>, port = 4352. Unfortunately BlueNMEA doesn't help you out by telling you the address of the phone. If connected to a wifi network, you can get the phone's address from the android settings menu as mentioned in a previous post. BlueNMEA also works when the phone is acting as a wifi hotspot, but in that case the android settings menu is telling you the phone's address on the phone network, not what your PC sees it as. I used my laptop's default gateway which worked. Someone else may suggest a more android-y way to get this info (a little googling suggests all android devices don't use the same subnet for tethering). So this works with OpenCPN. Unfortunately kplex was rejecting all the data and a packet dump revealed BlueNMEA was doing the opposite of NRelay: terminating sentences with just a line feed (0xa) rather than 0xd0xa. OpenCPN's parsing let that slide but kplex's was fussier, as might other software be.

Let's not forget that the NMEA-0183 standard is not free (as in beer or as in speech) and doesn't even apply to transmission over IP so it's not correct to say that these apps are terminating sentences incorrectly: There just isn't a defined, open standard for this stuff. There's always the danger of a segue into a political rant at a point like this...
muttnik is offline   Reply With Quote
Old 09-05-2014, 15:35   #21
Registered User

Join Date: Oct 2012
Location: Brighton, UK
Boat: Westerly Oceanlord
Posts: 513
Re: Android GPS via BT to Laptop Opencpn

Having taken a look at the OpenCPN code it seems to be rather liberal about sentence termination that it accepts, so my guess is that it would be fine with the format NRelay uses. I suspect something like socat (on linux) would be useful there.
muttnik is offline   Reply With Quote
Old 09-05-2014, 16:24   #22
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,630
Images: 2
Re: Android GPS via BT to Laptop Opencpn

Muttnik
Thank you for pursuing the TCP alternative, because I was thinking that we needed a wifi solution as well!

I see that keplex is a linux, freebsd program and is not for windows, so NRelay is not useful for this purpose.

However it appears BlueNmea will work with your instructions:
Quote:
BlueNMEA implements a tcp server and it does work with OpenCPN. It doesn't allow you to change the port it runs on from 4352 but no big deal. In OpenCPN's connections menu create a network data connection, protocol = tcp, address = <ipv4 address of phone>, port = 4352. Unfortunately BlueNMEA doesn't help you out by telling you the address of the phone. If connected to a wifi network, you can get the phone's address from the android settings menu as mentioned in a previous post. BlueNMEA also works when the phone is acting as a wifi hotspot, but in that case the android settings menu is telling you the phone's address on the phone network, not what your PC sees it as.
Don't know what I did wrong, but I'll try it again. Thanks so much.
rgleason is offline   Reply With Quote
Old 09-05-2014, 18:29   #23
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,630
Images: 2
Re: Android GPS via BT to Laptop Opencpn

BlueNmea

After uninstalling and reinstalling several times, with the same results when I open BlueNmea to
Provider: button=GPS no button=network
Provider status: unknown
Bluetooth client status: not available
Bluetooth server status: failed: BT is disabled
TCP Status: listening on port 4352
Click on options: There is a note "Disconnect All" and that is all!
It seems to me that this app had more choices down there but I may be confusing it with another.
Anyway uninstall and reinstall did not change that, so on to the next thing.
Opencpn > Options > Connections > Add Connection > Type: Net, Port 192.168.1.123, Dataport 4352, Priority 0, Protocol TCP, Output No, Input Accepted all, Control Checksum (tried checked and unchecked)

I found the IP 192.168.123 on the About page of the Samsung S4 and also in my router's list. This IP has been assigned by the Router. Since this will be on the boat with no router, I am wondering how to make a direct wifi connection, anyway the end result is that Opencpn does not seem to be picking anything up in the debug window and the boat has not moved and is still brown.

What have I done wrong?
rgleason is offline   Reply With Quote
Old 09-05-2014, 20:46   #24
Registered User

Join Date: Jan 2011
Posts: 670
Re: Android GPS via BT to Laptop Opencpn

A couple quick comments that might help you.

I've tried several apps on my Android phone to transmit the GPS via Bluetooth. The only one that worked for me was GPS over BT. Others have reported problems with this app and success with others, so YMMV. But when I experimented with this, I was able to bring the GPS into an Android tablet (hacked Nook Color) and into my WindowsXP netbook running OpenCPN with Toshiba Bluetooth stack. I believe that I also got it to work with generic Microsoft Bluetooth drivers on either a Windows7 netbook or Windows8 tablet - it's been so long that I can't remember, and I've moved on to other things since then.

I am just starting to play with WiFi for sharing NMEA data. I am confused that the TCP connections all seem to be half duplex - either outbound servers or inbound clients. This is very limiting, especially if you want to send data out to an autopilot. I agree with the guy who said that UDP protocol is much superior, but configuring this stuff to avoid echoing data back and forth is not simple. For the autopilot, Bluetooth is a far superior method, because it allows me to bring in GPS data and send out autopilot data, both on a single full duplex COM port (emulated over Bluetooth).

To set up a WiFi network, something has to act as the DHCP server. In your home this would be done on a WiFi router. On a boat, there are some alternate ways to do this, and you should strive for one with much lower power consumption than your typical home router. One method is to turn on tethering on an Android phone, activating its WiFi hotspot capabilities. Then your laptop will see the phone as if it's a WiFi router, and it will be assigned an IP address by the phone. Alternately, some versions of Windows can host an "ad hoc network" where the computer is the DHCP server through its WiFi. However, many home versions of Windows will not do this, most notably Windows 8. There are 3rd party Windows programs that will do this, but I haven't tried them. A further limitation of this method is that Android phones refuse to connect to ad hoc networks (unless they're rooted).

To avoid both of these issues, I went ahead and bought a router for the boat. The Zyxel MWR102 can be found on Amazon for $18 if you time it right. It's extremely tiny and runs off of USB power, so it's very low power drain, which is important on a sailboat. I've used it to host a WiFi network on my boat, allowing my netbook and Win8 tablet to share NMEA data between the two of them using PolarCOM with the UDP protocol. But I've barely scratched the surface in testing it, and will not have time to do much more.
RhythmDoctor is offline   Reply With Quote
Old 10-05-2014, 03:29   #25
Registered User

Join Date: Oct 2012
Location: Brighton, UK
Boat: Westerly Oceanlord
Posts: 513
Re: Android GPS via BT to Laptop Opencpn

So...this morning I proved that OpenCPN will work with NRelay if you use something to bridge it: I used socat on a linux box to create a tcp server that NRelay could send to and another that OpenCPN could connect to. But arguably that's rather more hassle than average boater is looking for in an app like this

Quote:
Originally Posted by rgleason View Post
BlueNmea
[...]
What have I done wrong?
The screen you describe seems to be about all you get: pretty sparse. BlueNMEA displays the IP address of clients when they connect to it, so if that doesn't happen maybe you've got a connectivity issue. Can't see anything obviously wrong with the steps you describe. I assume location services is turned on and the phone has a gps fix? That's obviously an issue if you live in an apartment block...

You can test connectivity with good ol' telnet. If using windows, open a command window and do:
telnet <address of phone> 4325
Data obviously means the app is working fine. A message that you're connected but no data means the app is running but no data is being output
If you get "connection refused" there's something at that IP address but no server listening on the specified port.
If it just hangs there and eventually comes back with "no route to host" or similar
you've got the wrong address.

On the boat without a router you can use the phone as a portable hotspot and connect to that. BlueNMEA will still give out data. I invite suggestions from the floor as to how best to determine your phone's address from the phone or windows in that situation (it'll be that of the default router on the PC once you're connected)
muttnik is offline   Reply With Quote
Old 10-05-2014, 08:05   #26
Registered User

Join Date: Jan 2011
Posts: 670
Re: Android GPS via BT to Laptop Opencpn

In case anyone is interested in trying the ZyXEL pocket router that I mentioned above, its highly volatile price on Amazon just dropped back to $18 today. It's a good time to pick it up if you want it.

RhythmDoctor is offline   Reply With Quote
Old 02-06-2014, 03:39   #27
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,630
Images: 2
Re: Android GPS via BT to Laptop Opencpn

Thanks RhythmDoc and Muttnick.
This link happened to come up in my Browser.
No GPS? No problem! Using GPSDirect to develop location-aware apps
https://software.intel.com/en-us/blo...3/part-1#part1
Welcome to GPSDirect and GPSReverse GPS NMEA Windows 7 Windows 8 Sensor Driver iOS Android TCP

"GPSDirect is basically a bridge solution. It's middleware that takes a GPS device connected on a virtual COM port and connects it to the Windows Location Sensor. To date, not many manufacturers provide a true sensor driver for their GPS receivers, and GPS receivers that are integrated into tablet and ultrabook platforms are still fairly rare. For those wishing to develop precision location-aware apps-- or even just use them-- GPSDirect represents the best way to make that possible when a native GPS sensor is not available on the system."

which uses one of the following Android Apps
https://play.google.com/store/apps/d...ows7gpssharing
https://play.google.com/store/apps/d...rboirc.tgps.v2
rgleason is offline   Reply With Quote
Old 07-11-2016, 08:17   #28
Registered User
 
CareKnot's Avatar

Join Date: Sep 2016
Location: Greater Houston Galveston Metroplex
Boat: 1979 Endeavor 32
Posts: 337
Re: Android GPS via BT to Laptop Opencpn

I realize I am very late to the party, but did anyone try:
Quote:
netsh wlan set hostednetwork mode=allow ssid=laptop key=P@$$W0rd!
netsh wlan start hostednetwork
or something similar? This works on my 64 bit Win 10 Pro machine (HP EliteBook 8440p i7 M 620 @ 2.67GHz x 2 - 4GB RAM).

I used the laptop when my router was down.
__________________
Kindest Regards,
Phillip
CareKnot is offline   Reply With Quote
Old 08-11-2016, 16:44   #29
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,630
Images: 2
Re: Android GPS via BT to Laptop Opencpn

Never too late Careknot. There are some other apps under Supplementary Software on opencpn.org which I used for awhile.
rgleason is offline   Reply With Quote
Old 08-11-2016, 22:20   #30
Registered User
 
CareKnot's Avatar

Join Date: Sep 2016
Location: Greater Houston Galveston Metroplex
Boat: 1979 Endeavor 32
Posts: 337
Re: Android GPS via BT to Laptop Opencpn

Quote:
Originally Posted by rgleason View Post
Never too late Careknot. There are some other apps under Supplementary Software on opencpn.org which I used for awhile.
Thanks Rick, I'll take a look.

To answer my own earlier question, the gentle reader may wish to look here: How to turn your Windows 10 PC into a wireless hotspot | Windows Central
__________________
Kindest Regards,
Phillip
CareKnot is offline   Reply With Quote
Reply

Tags
enc, gps, laptop, opencpn


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenCPN - internal GPS - AIS via Wlan klaus53123 OpenCPN 14 17-05-2018 03:00
Connection Android device via Bluetooth Press1992 OpenCPN 3 30-03-2014 12:08
Android Phone as Bluetooth GPS with OpenCPN RhythmDoctor OpenCPN 1 04-01-2014 00:46
Using Blue NMEA for Android via bluetooth familycruisers OpenCPN 42 30-12-2011 08:08
Getting NMEA 0183 Data to a Laptop via Raymarine S1 Autopilot night0wl Marine Electronics 9 19-10-2011 07:18

Advertise Here


All times are GMT -7. The time now is 23:49.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.