 |
|
03-11-2019, 12: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
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?
|
|
|
03-11-2019, 12:16
|
#17
|
Registered User
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.
|
|
|
03-11-2019, 12: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-
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.
|
|
|
03-11-2019, 12: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
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.
|
|
|
03-11-2019, 12: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
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
|
|
|
03-11-2019, 12: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
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?
|
|
|
03-11-2019, 12:33
|
#22
|
Registered User
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-
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.
|
|
|
03-11-2019, 12: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-
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-
|
|
|
03-11-2019, 12: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
|
|
|
03-11-2019, 12: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.
|
|
|
03-11-2019, 13: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
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
|
|
|
03-11-2019, 18:34
|
#27
|
Registered User
Join Date: Aug 2015
Location: Sozopol
Boat: Riva 48
Posts: 1,409
|
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.
|
|
|
05-11-2019, 18:10
|
#28
|
Registered User
Join Date: Mar 2011
Posts: 854
|
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)
|
|
|
13-11-2019, 11: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!
|
|
|
13-11-2019, 11: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-
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.
|
|
|
 |
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
Advertise Here
Recent Discussions |
|
|
|
|
|
|
|
|
|
|
|
|
Vendor Spotlight |
|
|