Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 17-03-2020, 04:53   #1
Registered User

Join Date: Mar 2020
Posts: 13
OpenCPN and SignalK

Hey guys, Im new to OpenCPN and have a few questions.

I am running a RaspPi4 on have flashed the headless OpenPlotter image.

I have some questions regarding the way data is handled in OpenCPN and SignalK.

1. Do devices send all NMEA data to SignalK and then SignalK forwards all NMEA data to OpenCPN?

2. Am I best to add my GPS as a serial device directly in OpenCPN or in SignalK. When added as a serial device in OpenCPN i am experience dropouts about 5 seconds after OpenCPN is launched. The GPS just dies.

Also, in OpenCPN I have the connection added and enabled, however in SignalK it does not show any registered devices.

3. Also, how can I read data from I2C devices into OpenCPN such as a digital compass or accel?

Thanks for the help!
__________________

deanfourie is offline   Reply With Quote
Old 17-03-2020, 09:30   #2
Registered User
 
pinguino's Avatar

Join Date: May 2009
Location: SE Spain
Boat: Jeanneau SO 32I
Posts: 94
Re: OpenCPN and SignalK

1 No default connections are defined in openplotter. There are several ways to do the same thing, through signal K or Kplex and depending on our goals and devices.

2a This problem is difficult to evaluate without knowing how the connection is made or if it is a software or wiring problem. Details are missing.

2b It is normal. If you have only defined a connection in opencpn the rest of openplotter does not receive anything by default -see point 1-.

3 No, you can't. Opencpn is not able to read raw data from GPIO. To do this you must connect them using signal K and convert that data from signal k format to NMEA0183 format. Once transformed opencpn will be able to display them.

Bonus 1. Opencpn will soon be able to read Signal k data directly.

Bonus 2. Better ask the things related to openplotter in the specific forum of openplotter: forum.openmarine.net where the creator of openplotter and more advanced users can help you more directly.

It is important not to confuse openplotter with opencpn.
Openplotter contains, among other tools, opencpn but it is not opencpn. Yes, I know, the similarity of the names makes it too confusing.
__________________

pinguino is offline   Reply With Quote
Old 17-03-2020, 14:37   #3
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: charleston
Boat: bristol 27
Posts: 3,612
Re: OpenCPN and SignalK

For reading imu it is normal to use pypilot even if you do not use the sensors in an autopilot because pypilot can calibrate the sensors automatically and perform sensor fusion.

It is also critical that pypilot reads from the imu directly so the autopilot can react as fast as possible. Using signalk server to read the sensors and/or routing the imu through a network would lead to inferior performance in the autopilot.

From pypilot the inertial sensors are translated to signalk and/or nmea0183 and available for use by other programs.
boat_alexandra is offline   Reply With Quote
Old 17-03-2020, 14:51   #4
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

Quote:
Originally Posted by boat_alexandra View Post
For reading imu it is normal to use pypilot even if you do not use the sensors in an autopilot because pypilot can calibrate the sensors automatically and perform sensor fusion.

It is also critical that pypilot reads from the imu directly so the autopilot can react as fast as possible. Using signalk server to read the sensors and/or routing the imu through a network would lead to inferior performance in the autopilot.

From pypilot the inertial sensors are translated to signalk and/or nmea0183 and available for use by other programs.
Awesome thank you, that makes sesne.

What about GPS data? Im using a uBlox Neo 6M, I have setup the connection in SignalK using serial and pulling data from /dev/ttyS0

a sudo cat /dev/ttyS0 outputs the GPS data but I am unable to get the GPS lock in OpenCPN.

I have the connection setup in OpenCPN to talk with SignalK (was there by default) on TCP host 127.0.0.1 on port 10110

Also, in SignalK I also notice under Security >> Devices there is nothing registered and the same for Settings >> Access Requests there is nothing?

Does this mean that OpenCPN is not actively registered with SignalK?

Thanks
deanfourie is offline   Reply With Quote
Old 17-03-2020, 15:32   #5
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 2,792
Re: OpenCPN and SignalK

dean...
If you start to us SignalK for example for the I2C, connect the rest there as well and connect OCPN to SK via NMEA0183 as you did.
In SK enter your boat data at Server->Vessel data.
Use OpenPlotter serial for the GPS and connect it to SK.
Use OpenPlotter I2C to connect your instruments and connect it to SK. Compass or what it is.
You may visit Sailog or the inbound docs for manuals how use the serial and I2C. It's close to tricky the first time.
Good luck
Hakan is online now   Reply With Quote
Old 17-03-2020, 17:12   #6
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

Quote:
Originally Posted by Hakan View Post
dean...
If you start to us SignalK for example for the I2C, connect the rest there as well and connect OCPN to SK via NMEA0183 as you did.
In SK enter your boat data at Server->Vessel data.
Use OpenPlotter serial for the GPS and connect it to SK.
Use OpenPlotter I2C to connect your instruments and connect it to SK. Compass or what it is.
You may visit Sailog or the inbound docs for manuals how use the serial and I2C. It's close to tricky the first time.
Good luck
The Sailoog documentation is so poor. There is nothing listed under the I2C section.

My real question at this point is the connection structure. I could work the rest out from there.

GPS Serial IN (ttyS0) >> PyPilot (lower latency)
PiPilot NMEA Out >> SerialK SERVER
SerialK CLIENT >> OpenCPN NMEA (port 10110)

This should give all data (GPS, MAG and IMU) from PiPilot to SerialK and in return send all SerialK data in NMEA to OpenCPN.

Am I on the right track here. And do I need to setup connections in SerialK for each of these steps?

Thanks I think I'm getting close 🤣🤣
deanfourie is offline   Reply With Quote
Old 17-03-2020, 17:14   #7
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

I will do a very I'm depth blog post on this when I get this running as there seems to be very limited documentation and lots of broken links.
deanfourie is offline   Reply With Quote
Old 17-03-2020, 17:27   #8
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

Also in SerialK when adding serial GPS ttyS0

What do I put for

Output Events
Sentence Event

Thanks
deanfourie is offline   Reply With Quote
Old 17-03-2020, 17:42   #9
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 2,792
Re: OpenCPN and SignalK

I'm not unpolite but now it comes far from OpenCPN what's the topic for this forum. Although interesting points I think you should rather use OpenMarine

where OpenPlotter resides.

Pure OpenCPN issues we are more than happy to discuss here. I know we are growing together more and more, not less with the coming SignalK connection in O, but still.....
Hakan is online now   Reply With Quote
Old 18-03-2020, 01:03   #10
Registered User

Join Date: Dec 2019
Posts: 44
Re: OpenCPN and SignalK

Quote:
Originally Posted by deanfourie View Post
Also in SerialK when adding serial GPS ttyS0

What do I put for

Output Events
Sentence Event

Thanks
I think you have to use NMEA0183.
My old USB-GPS is still only works on 4800 bps.

WIth settings in SignalK according the screenshot I only have to point OpenCPN to SignalK for alle connections.


That also means that openplotter-i2c-read, openplotter-pypilot-read and pypilot_boatimu are running in the background if you are using OpenPlotter properly (OP should do that for you, see sailoog.com and openmarine.net).
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2020-03-18 01-04-22.jpg
Views:	49
Size:	298.1 KB
ID:	210806  
hreuver is offline   Reply With Quote
Old 19-03-2020, 01:46   #11
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

Quote:
Originally Posted by hreuver View Post
I think you have to use NMEA0183.
My old USB-GPS is still only works on 4800 bps.

WIth settings in SignalK according the screenshot I only have to point OpenCPN to SignalK for alle connections.


That also means that openplotter-i2c-read, openplotter-pypilot-read and pypilot_boatimu are running in the background if you are using OpenPlotter properly (OP should do that for you, see sailoog.com and openmarine.net).
Thanks for the reply.

I managed to bring data source from serial into SerialK and then from SerialK into OpenCPN.

What I now would like to know if its possible to

Bring my source ttyS0 data and I2C IMU and Compass into PyPilot as first point of entry, then send that data as NMEA 0183 to SerialK and then use SerialK to send that data to multiple sources, one being OpenCPN.

Is this possible? I know some people are talking about Kplex.

Is SerialK basically doing the same job as Kplex? Im just a little bit confused as to what way to tackle this architecture.

Regards.
Dean
deanfourie is offline   Reply With Quote
Old 19-03-2020, 02:42   #12
Registered User

Join Date: Dec 2019
Posts: 44
Re: OpenCPN and SignalK

There are many points where I can't follow you line of thought.
First let's replace SerialK with SignalK, then it gets a little more logical for me.
I do hope I don't interprete you wrong.

Right now you have everything working on you OpenCPN pi (I assume?).

You want an (external) pypilot/device where the IMU is used (I assume?).
You want to use the IMU-data from the pypilot/device in signalK from your OpenCPN pi.

From the OpenCPN pi you can distribute the data via NMEA0183 / NMEA2000 / whatever??
I believe that is what SignalK is designed for. It basically depends on whether the pypilot device uses SignalK to share the information over the network.

The easy part is connecting the SignalK server as input to another SignalK server.
In the receiving SignalK server add a connection. Input type= SignalK, source is network, port should be googled but I think either 10110 or 3000, and probably UDP (but you could try both UDP and TCP).

The hard part will be filtering all information not required (I don't have experience here).

If you are talking about the pypilot software on the same hardware as OpenCPN you completely lost me. I'd think all data is already input in the same SignalK server and there is no problem.

Some things I have not discussed above:
- when I talk about connection I use OpenCPN 5.0.522 with direct SignalK connection (port 3000). I see no added value of KPlex in that configuration.
- when using OpenPlotter and OpenCPN 5.0.0 you use the "convert to NMEA0183" plugin and configure KPlex with input source SignalK. Then you connect OpenCPN to KPlex (port 10110 I think).
- when using KPlex it might be prefeable to connect the USBGPS to KPlex directly (less translations is better but it depends on where you use the data).


Also: you might find more experience on these issues in the openmarine.net forum (openplotter)
hreuver is offline   Reply With Quote
Old 19-03-2020, 03:43   #13
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

Ok, firstly I have tried posting over at openmarine, it just says that the posts are awaiting moderation. This was when my last post was posted.

In OpenCPN I have the GPS working. Not sure how to input any other data. Such as I2C (Compass and IMU) alos not sure if compass is required in OpenCPN.


Lets simplify things a bit.

Say I want to use GPS for 2 sources. I am guessing you can only pull one SERIAL stream from the source so I need a server in between. In this case I need GPS for OpenCPN and for PyPilot. Ideally I would like the GPS source to reach PyPilot first for less latency. So now I need to find a way to get GPS data to OpenCPN. This is my problem.

I was able to add GPS as my source in SerialK as a serial connection, the serve that connection to OpenCPN fine.

I would like to do the following.

GPS Serial UART0 >> PyPilot - successful
PyPilot >> SerialK - successful
SerialK >> ANY OTHER DEVICES NEEDING GPS

I cannot then get SerialK to send GPS data back to OpenCPN. Im not sure if im going about this the wrong way.

I guess my target is to use SeriaK as the MAN IN THE MIDDLE. It handles all connections then serves them out in multiple streams except for GPS, IMU and compass. Their first point of entry can be PyPilot then distributed to SerialK for other devices to access - via SerialK or via NMEA 0183

Im not sure if im just over thinking things, or trying to imagine a network that is larger then it will ever be.

To summarize. When I add sensors, ANY SERSORS. I want to add them in SerialK and SerialK only. Then distribute that data to the devices that require that data using the SerialK server protocol.

If im wrong here, then im missing the whole point of SerialK?

Thanks for taking the time! Im really struggling to find help with this!

Reagrds
Dean
deanfourie is offline   Reply With Quote
Old 19-03-2020, 06:35   #14
Registered User

Join Date: Dec 2019
Posts: 44
Re: OpenCPN and SignalK

Quote:
Originally Posted by deanfourie View Post
Ok, firstly I have tried posting over at openmarine, it just says that the posts are awaiting moderation. This was when my last post was posted.

In OpenCPN I have the GPS working. Not sure how to input any other data. Such as I2C (Compass and IMU) alos not sure if compass is required in OpenCPN.
Compass only adds magnetic heading i.e. when you heading is different from your COG.

Quote:
Lets simplify things a bit.

Say I want to use GPS for 2 sources. I am guessing you can only pull one SERIAL stream from the source so I need a server in between. In this case I need GPS for OpenCPN and for PyPilot. Ideally I would like the GPS source to reach PyPilot first for less latency. So now I need to find a way to get GPS data to OpenCPN. This is my problem.
Latency of GPS is an issue in airplanes, not on sailing boats.
A GPS position is how accurate? 10m/30ft? 30m/100ft?
Quote:
I was able to add GPS as my source in SerialK as a serial connection, the serve that connection to OpenCPN fine.

I would like to do the following.

GPS Serial UART0 >> PyPilot - successful
PyPilot >> SerialK - successful
SerialK >> ANY OTHER DEVICES NEEDING GPS

I cannot then get SerialK to send GPS data back to OpenCPN. Im not sure if im going about this the wrong way.

I guess my target is to use SeriaK as the MAN IN THE MIDDLE. It handles all connections then serves them out in multiple streams except for GPS, IMU and compass. Their first point of entry can be PyPilot then distributed to SerialK for other devices to access - via SerialK or via NMEA 0183

Im not sure if im just over thinking things, or trying to imagine a network that is larger then it will ever be.
Quote:
To summarize. When I add sensors, ANY SERSORS. I want to add them in SerialK and SerialK only. Then distribute that data to the devices that require that data using the SerialK server protocol.
I would consider that the normal way.

You use openplotter-pypilot for the IMU (compass + accell)

This is in the background provided by the script pypilot_boatimu and exported to signalK using openplotter-pypilot-read.

For any other sensors like barometer and temperature you use openplotter-i2c.
This is in the background exported by the script openplotter-i2c-read.

You connect NMEA0183 (for example USBGPS or WIND) directly from the serial port in teh SignalK server.

If you use NMEA2000 there is a different connection (canboat) but it basically works the same, directly from the canbus to signalK.

Normally you would not know which background scripts are used. If you configure OpenPlotter correctly this is handled for you. If you are really interested type "ps ax | grep openplotter" and you will see the scripts working in the background.

Code:
 ps ax|grep openplotter
 3697 pts/0    Sl     3:02 /usr/bin/python3 /usr/bin/openplotter-i2c-read
 3698 pts/0    S      1:27 /usr/bin/python3 /usr/bin/openplotter-pypilot-read
 6716 pts/6    S+     0:00 grep --color=auto openplotter
If the scripts are running the data should be available.

In short:
use openplotter-pypilot for the imu
use openplotter-i2c for the rest of the i2c sensors
use openplotter-can for NMEA2000
use the serial connection for NMEA0183

That was shown in the screenshot I posted earlier.
hreuver is offline   Reply With Quote
Old 20-03-2020, 04:09   #15
Registered User

Join Date: Mar 2020
Posts: 13
Re: OpenCPN and SignalK

Quote:
Originally Posted by hreuver View Post
Compass only adds magnetic heading i.e. when you heading is different from your COG.

Latency of GPS is an issue in airplanes, not on sailing boats.
A GPS position is how accurate? 10m/30ft? 30m/100ft?


I would consider that the normal way.

You use openplotter-pypilot for the IMU (compass + accell)

This is in the background provided by the script pypilot_boatimu and exported to signalK using openplotter-pypilot-read.

For any other sensors like barometer and temperature you use openplotter-i2c.
This is in the background exported by the script openplotter-i2c-read.

You connect NMEA0183 (for example USBGPS or WIND) directly from the serial port in teh SignalK server.

If you use NMEA2000 there is a different connection (canboat) but it basically works the same, directly from the canbus to signalK.

Normally you would not know which background scripts are used. If you configure OpenPlotter correctly this is handled for you. If you are really interested type "ps ax | grep openplotter" and you will see the scripts working in the background.

Code:
 ps ax|grep openplotter
 3697 pts/0    Sl     3:02 /usr/bin/python3 /usr/bin/openplotter-i2c-read
 3698 pts/0    S      1:27 /usr/bin/python3 /usr/bin/openplotter-pypilot-read
 6716 pts/6    S+     0:00 grep --color=auto openplotter
If the scripts are running the data should be available.

In short:
use openplotter-pypilot for the imu
use openplotter-i2c for the rest of the i2c sensors
use openplotter-can for NMEA2000
use the serial connection for NMEA0183

That was shown in the screenshot I posted earlier.
Thanks so much for your reply! Im finally gaining traction and understanding how this all comes togeather.

I am now sending all GPS data to OpenCPN via GPSD, and also importing GPS data directly into PyPilot via SERIAL.

Your thoughts on this setup? Its working really well from what I can see so far.

Thanks
__________________

deanfourie is offline   Reply With Quote
Reply

Tags
enc, opencpn

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Linux & signalk on win10 conachair Marine Electronics 0 16-05-2019 04:21
Epsolar plugin for SignalK dmdelorme Electrical: Batteries, Generators & Solar 0 13-02-2019 12:28
Water Temp in OCPN via SignalK deepthought OpenCPN 5 22-09-2018 03:51
SignalK development ? verkerkbr OpenCPN 122 02-04-2018 10:30

Advertise Here


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


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.