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 03-11-2019, 11:10   #16
Registered User

Join Date: Nov 2019
Posts: 20
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by transmitterdan View Post
If you are only using one computer then UDP is still the easiest method. It works on all platforms supported by O. You don’t need any serial port. Just send your data messages to localhost or 127.0.0.1. All computers have this capability.
So you are saying that I can include this directly into my Python script so I dont need anything else than the script running which will send to 127.0.0.1 UDP and then setup OpenCPN to listen on that address? (I'll convert to NMEA myself). What port should I use? So something like:

Code:
  import socket
  
   UDP_IP = "127.0.0.1"
   UDP_PORT = 5005
   MESSAGE = "..... NMEA CODE.... like: $GPMWV,318.00,R,14.80,N,A*1D)"
   
   sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
Also, now that I'm on the topic how do I send all the data from OpenCPN to my tablet (assuming I have a network setup on my Pi later)? What address do I need to output to on my PI such that my tablet can connect and pick it up? Also localhost address?
peter- is offline   Reply With Quote
Old 03-11-2019, 11:16   #17
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Converting and sending data to opencpn using a script or program in Unix?

Yes, the same python script can convert the data an ship it out via UDP. No files are required.

You can use any unused port. A high one like 10110 is what I use. Just tell OpenCPN to listen on UDP and give it the same port number.
transmitterdan is offline   Reply With Quote
Old 03-11-2019, 11:18   #18
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by peter- View Post
So you to make sure that I understand it correctly:

Step 1: Have a script that pulls the data from my weather station 433MHz and saves it to a file.
Step 2: Use node-red to pickup the file and inject it into signalk
Step 3: Convert it to NMEA in Signalk and save to another file
Step 4: Use node-red to inject into OpenCPN.
Does the weather data come in through a serial dongle?
If so then you just need to select that dongle as a node red input, do a little string manipulation and send just the number to a signalk node. Then there's a signalk app which converts sigalk deltas to NMEA0183. I just did it sending just your text in a node-red insert node, works fine.

conachair is offline   Reply With Quote
Old 03-11-2019, 11:19   #19
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by transmitterdan View Post
Yes, the same python script can convert the data an ship it out via UDP. No files are required.

You can use any unused port. A high one like 10110 is what I use. Just tell OpenCPN to listen on UDP and give it the same port number.
Though signalk has many more options, view on a dashboard o any tablat or extremely useful, send to a database to view as a graph, great for weather data. All easy to set up, just a few menus.
conachair is offline   Reply With Quote
Old 03-11-2019, 11:23   #20
Registered User

Join Date: Nov 2019
Posts: 20
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by transmitterdan View Post
Yes, the same python script can convert the data an ship it out via UDP. No files are required.

You can use any unused port. A high one like 10110 is what I use. Just tell OpenCPN to listen on UDP and give it the same port number.
Super! Many thanks
peter- is offline   Reply With Quote
Old 03-11-2019, 11:25   #21
Registered User

Join Date: Nov 2019
Posts: 20
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by conachair View Post
Does the weather data come in through a serial dongle?
If so then you just need to select that dongle as a node red input, do a little string manipulation and send just the number to a signalk node. Then there's a signalk app which converts sigalk deltas to NMEA0183. I just did it sending just your text in a node-red insert node, works fine.

I'll look into signalk as well it is good to know many thanks! Also, can I send my data to a tablet directly from OpenCPN on my Raspberry Pi as an output or would I need signalk for that?
peter- is offline   Reply With Quote
Old 03-11-2019, 11:33   #22
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by peter- View Post
I'll look into signalk as well it is good to know many thanks! Also, can I send my data to a tablet directly from OpenCPN on my Raspberry Pi as an output or would I need signalk for that?
If your tablet accepts NMEA-0183 data over Ethernet (WiFi) or serial port then yes you can. OpenCPN can be set up to repeat all incoming messages to an outgoing port. The port can be a serial (USB) port or Ethernet.
transmitterdan is offline   Reply With Quote
Old 03-11-2019, 11:38   #23
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by peter- View Post
I'll look into signalk as well it is good to know many thanks! Also, can I send my data to a tablet directly from OpenCPN on my Raspberry Pi as an output or would I need signalk for that?
Openplotter/signalk works slightly differently and siganlk is so good it really is missing out on such a lot not having it installed, especially as installation is so easy. , all the data gets sent to signalk first then it sends out any nmea0183 automatically on port 10110 both on the network it creates, 10.10.10.1 and also to any network it's connected to, so if you've a mobile phone streaming web data which the Pi is also connected to with a usb dongle, it will stream everything to that network as well on whatever the pi address is, like 192.168.43.xxx.
If the data is signalk with no equivalent nmea then there are some very good webpage based dashboards to view the data on any tablet/phone.
The V2 openplotter also sets up the PPA for infludb & chronograf so they are simple to install, then there's a signalk app to write the data to that.
This is pressure during a near miss from a small tornado-
conachair is offline   Reply With Quote
Old 03-11-2019, 11:51   #24
Registered User

Join Date: Nov 2019
Posts: 20
Re: Converting and sending data to opencpn using a script or program in Unix?

Guys many thanks for all the support - I can't wait to play around with this in a month time when I'm back at my boat again.

Now the only thing I have remaining is finding a cheap radar solution in addtion to the AIS I have up and running already and I'll have all the stuff I ever wanted... or well maybe I should see if I can get Routing to work on my Raymarine autohelm as well... but not so important for now...

Kind Regards,
Peter
peter- is offline   Reply With Quote
Old 03-11-2019, 11:54   #25
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: Converting and sending data to opencpn using a script or program in Unix?

If you have the Pi at home then you can play around with the different bits with no input, there are simulator apps and a test script with dummy data.
conachair is offline   Reply With Quote
Old 03-11-2019, 12:21   #26
Registered User

Join Date: Nov 2019
Posts: 20
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by conachair View Post
If you have the Pi at home then you can play around with the different bits with no input, there are simulator apps and a test script with dummy data.
No worries I need to work like crazy so the month will be gone in no time. I also don’t have the PI with me
peter- is offline   Reply With Quote
Old 03-11-2019, 17:34   #27
Registered User

Join Date: Aug 2015
Location: Sozopol
Boat: Riva 48
Posts: 1,387
Re: Converting and sending data to opencpn using a script or program in Unix?

As discussed, there are a couple of components. One is the script (Python is the easiest). You need to learn how to open and close ports and how to read them. It is all very well documented. The other part is to install OpenPlotter and start adding the data. The cheap radar solution these days is OpenCPN plus either a navico Radar or a Garnin Radar depending on what some you can find.
Pizzazz is offline   Reply With Quote
Old 05-11-2019, 17:10   #28
Registered User

Join Date: Mar 2011
Posts: 651
Re: Converting and sending data to opencpn using a script or program in Unix?

Here is a perl script that I've just been recently using to test my engine dashboard.
I've added some other sample sentences, so if you can work out how to extract your wind data, it should be an easy solution.

You'll just need to configure a UDP connection in OpenCPN. (and of course rename the attachment)
Attached Files
File Type: pdf send.pdf (1.4 KB, 63 views)
stevead is offline   Reply With Quote
Old 13-11-2019, 10:36   #29
Registered User

Join Date: Nov 2019
Posts: 20
Re: Converting and sending data to opencpn using a script or program in Unix?

Hi all I'm back

I got it all setup today and it is working great. I'll be spending some time on learning SignalK and playing around with it all but I can't believe how much stuff is available for free some really good work has gone into this!

I'll also make all my sensor data wireless using arduinos and the fantastic NRF24L01 transceiver modules to send all the information to my Pi.


I'll be programming my own wind speed and direction sensor also because as of right now it only sends a value every 1 minutes and that is to rare. So in total I have AIS, wind, temp, sonar, GPS (=location, speed and direction). Do I need anything else besides of radar which I'll be getting next year?

Also, I have a couple of tablets with a valid Navionics subscription. I'm supposed to be able to send AIS data to Navionics does anyone know if I can do that with OpenCPN or does it require a proprietary device such as the DigitalYatch wifi? If yes, what UDP address should I send the data to?

I was looking a bit at OpenPlotter as well, but since I have it all setup I don't feel like going back to that. I guess we can still install all the elements that OpenPlotter contains right?

Kind Regards,
Peter

PS: Forgot to mention that I even have a DLNA setup in the boat now so everyone can stream movies on their tablets, phone etc... all without internet it is so great!
peter- is offline   Reply With Quote
Old 13-11-2019, 10:59   #30
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: Converting and sending data to opencpn using a script or program in Unix?

Quote:
Originally Posted by peter- View Post
I'll also make all my sensor data wireless using arduinos and the fantastic NRF24L01 transceiver modules to send all the information to my Pi.
ESP8266 or ESP32 are imho much better boards for this, built in wifi & have lots more CPU speed & memory. Then you can just send signalk data straight to signalk over wifi.
conachair is offline   Reply With Quote
Reply

Tags
enc, 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
Sending Data To Polar Navy awwbaker OpenCPN 3 25-11-2017 03:28
4g Radar not sending data str-alorman OpenCPN 5 09-10-2017 05:35
Problems sending autopilot data to PolarCOM RhythmDoctor OpenCPN 4 22-01-2014 19:22
Sending wind data from B&G Hydra 2000 to Raymarine Autohelm Bucaniere Marine Electronics 2 19-09-2013 08:49
Sending Data from GPS to two Virtual Ports in Ubuntu 12.04 Sail323 OpenCPN 1 19-07-2012 12:59

Advertise Here


All times are GMT -7. The time now is 01:52.


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.