Code Monkey home page Code Monkey logo

signalk-to-nmea0183's Introduction

signalk-to-nmea0183

Signal K Node server plugin to convert Signal K to NMEA 0183. See the code for a list of supported sentences.

To use the plugin you need to activate the plugin and the relevant sentences in server's Admin interface. This will make the conversion results (NMEA 0183) available on Signalk's built-in TCP NMEA 0183 server (Port 10110).

As the plugin automatically sends NMEA 0183 data to Signalk's built-in TCP NMEA 0183 server, it is possible to have access to the NMEA 0183 strings without configuring anything (Aka a serial output device) by connecting to port 10110 with a TCP client (e.g. OpenCPN, Netcat, kplex etc)

If you want to output the conversion result into a serial connection you need to configure the serial connection in the server's Admin interface and add an extra line to the settings.json, specifying that the serial connection should output the plugin's output:

{
  "pipedProviders": [
    {
      "pipeElements": [
        {
          "type": "providers/simple",
          "options": {
            "logging": false,
            "type": "NMEA0183",
            "subOptions": {
              "validateChecksum": true,
              "type": "serial",
              "suppress0183event": true,
              "sentenceEvent": "nmea1data",
              "providerId": "a",
              "device": "/dev/ttyExample",
              "baudrate": 4800,
              "toStdout": "nmea0183out"          <------------ ADD THIS LINE
            },
            "providerId": "a"
          }
        }
      ],
      "id": "example",
      "enabled": true
    }
  ],
  "interfaces": {}
}

Note: Internally the plugin emits the converted NMEA 0183 messages as Events under the event identifier nmea0183out. The above configuration sends the converted data (NMEA 0183) under the nmea0183out events identifier to the serialport's output.

Troubleshooting: If you cannot connect to Signalk's built-in TCP NMEA 0183 server, ensure it is enabled. To verify the TCP NMEA 0183 server is enabled go to Signalk's Dashboard, then Server->Settings->Interfaces->nmea-tcp .

image

signalk-to-nmea0183's People

Contributors

captainron47 avatar cmotelet avatar davidsanner avatar dependabot[bot] avatar dirk-- avatar free-x avatar garywsmith avatar joabakk avatar netaction avatar ph1l avatar qa2yn2pu avatar sbender9 avatar sergei avatar tkurki avatar yachtie2020 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

signalk-to-nmea0183's Issues

RMC conversion results in 100% cpu

If I have RMC conversion active in my system, with nmea0183 going out to 4800 baud 0183 connection, the cpu will go up to 100%. Deactivating RMC conversion will bring it back down, but after a while, not immediately.

sentences/MWVT.js

key should be 'environment.wind.angleTrueWater' or 'environment.wind.angleTrueGround'

RMB sentence never generated by the plugin

I'm trying to have all data connection managed by signalk. I'm doing eveything in a test environment at home before tranferring to the boat. In this environment the autopilot serial connection is connected to a PC acting as a monitor (via putty serial) to see the Nmea183 sentences coming out from the SBC (a raspi clone) hosting signalk server.

The route info is coming from an external chartplotter app (in this environment an android phone with AvNav app installed). The GPS info is coming from a GPS mouse connected to Signalk and the app receives the GPS info from signalk (the internal smartphone GPS is disabled) via a TCPReader connected to signalk IP on port 10110.

The Avnav app manages the route and wp stuff generating the required autopilot info (RMB and/or APB) when a wp/route is engaged. The nmea output coming from the app is forwarded back to signalk via an UDP writer connection to signalk IP on port 28628.

If the plugin is set to send $XTE (plus other GPS sentences like $RMC or $VTG) everything works fine and the sentences are well read on putty window. The XTE info is obtained by signalk from the RMB sentence received from the AvNav app (in fact the signalk paths relative to this info are listed in signalk having as source the back connection ID plus the RMB sentence). So far so good.

But if I try to enable RMB in the plugin nothing happens and the RMB sentence is NEVER output from signalk even if all the necessary info is available. I tried also with APB with the same unsuccess.

I saw from issue #60 that there are invalid data path that the plugin uses to gather the wp lat/lon info and I tried to patch both the nmea0183 RMB hook (generating two new paths navigation.courseRhumbline.nextPoint.latitude and navigation.courseRhumbline.nextPoint.longitude) and the sentences/RMB.js to take into account the new keys with no success.

Since RMB is a very useful sentence to get out in a navigation system I think it was well debugged in previous version of the plugin and I suspect that something (update of the schema?) yelded a regression. The release of signalk I'm using is the latest (I believe). The release number is 1.46.3

Missing VHW NMEA183 sentence with speed through water

I do not get speed through water in OpenCPN when running the SignalK to NMEA183 converter. Most other data is OK. I'm using the converter to feed the Polar diagram recorder (also tested VDR, which works ok, but no STW). The speedThroughWater signalK works fine, display nicely on the instrument panel web app and OpenCPN dashboard. I do not find a tick box for VHW on the plugin config, but the file VHW.js exists and there is a reference to speedThroughWater in that file. I have also redirected the NMEA183 sentences to a file and searched for VHW without finding any.

It would be nice to have the Polar diagram based on speed though water in addition to speed over ground reference. Any possible fix for this ?

GPS not received by Navionics Boating app

Many apps receive the GPS location, but the Navionics Boating app doesn't.
When i look at the data (source are sample files from /opt/signalk-server/samples/) i see sentences with an $II prefix instead of $GP, for example:

$IIGGA,190048,5943.4074,N,02444.1567,E,1,11,0.8,2.26,M,0,M,,4E
$IIGLL,5943.4074,N,02444.1567,E,210048.020,A
21
$IIRMC,190048,A,5943.4074,N,02444.1567,E,6.7,187.3,150814,8.1,E*66

That doesn't seem to work for Navionics. If i use the standart gps.log sample (/opt/signalk-server/samples/), for some reason the output also includes $GP prefixed sentenced. And that does work, see example below.

$GPGGA,085609.000,5222.3257,N,00454.5851,E,1,6,1.18,15.1,M,47.0,M,,6E
$IIGGA,085608,5222.3257,N,00454.5851,E,1,6,1,15,M,0,M,,73
$IIGLL,5222.3257,N,00454.5851,E,105608.020,A
23
$IIRMC,085608,A,5222.3257,N,00454.5851,E,0.8,248.0,030414,0.0,E
6E
$GPGSA,A,3,02,16,23,13,29,07,,,,,,,1.48,1.18,0.890C
$GPRMC,085609.000,A,5222.3257,N,00454.5851,E,0.81,248.69,030414,,,A
6E

Questions:

  • in the source i see that signalk-to-nmea0183 is creating these $II prefixed sentences, why is that?
    I do see that Shipmodul can do the same, so i guess the prefix shouldn't matter for the consuming app: http://www.shipmodul.com/downloads/manuals/legacy/miniplex-42.pdf, page 9 Talker ID

  • If this is according to the standard, than still widely used apps like Navionics can not use this. Would it be possible to make this configurable? Similar to how Shipmodul is doing this for example? Or just a switch to use either $II or $GP?

wrong time in generated GLL sentence (local time instead of UTC)

There is a bug in the signalk-to-nmea0183 plugin when writing the GLL sentence:

        1       2 3        4 5         6 7
        |       | |        | |         | |
 $--GLL,ddmm.mm,a,dddmm.mm,a,hhmmss.ss,a*hh<CR><LF>

5 must be time in UTC of this position, hh is hours, mm is minutes, ss.ss is seconds

But the plugin is writing just local time into the sentence instead which leads to several problems.

The RMC sentence also has the UTC of the position and there it is implemented correctly.

The fix should be straigt forward in getting the timestamp in the same way as for the RMC sentence

Support Questions

Hi,

I don't use GitHub very often so I'd appreciate any advice on where to post questions like the following!

A Bit Of Background:

I would like n2k-to-signalk to send the 129029 PGN to signalk-to-nmea0183 and output GGA and ZDA to my laptop (which reads incoming messages) via USB.
I know this can be done by a regular converter like the NGW-1, but my intention is to familiarise myself with SignalK so that I can create the plugin to convert the 128520 PGN to the TTM sentence in the future, as to the best of my knowledge this is not supported at the moment.

My Questions:

  1. I have been using the sample n2k messages and I can see them coming in on the signalk dashboard, but how do I know if they are being converted to the signalk format?
  2. Once the n2k messages are converted to the signalk format, how do I setup signalk-to-nmea0183 to convert these to NMEA 0183 and transmit these to the USB port?
  3. Any advice for how to approach the custom plugin?

Thanks in advance!

Alarm System

I could set notification and reset alarms at SignalK (using Node-Red), example for man over board:

Set:
Path: notifications.mob
Value: {
"state": "emergency",
"method": [
"visual",
"sound"
],
"message": "Person über Bord!"
}
Reset:
Path: notifications.mob
Value: null

Unfortunatly I could find no way to make it usaable for instance for OpenCPN or AvNav via the plugin.
I found some NMEA0183 sentences ACK ,AKD, ALA here:

but with no description.
Would be great to have a biderectional alarm communication between the plotters and SignalK.

Thank you for your development so far.

If Longitude is > 99, the RMC output is wrong

elektron@x61s-4280:~/code/signalk-to-nmea0183$ npm test

> @signalk/[email protected] test /home/elektron/code/signalk-to-nmea0183
> mocha

  RMC
    ✓ works without datetime & magneticVariation
    1) works with large longitude

  1 passing (37ms)
  1 failing

  1) RMC works with large longitude:

      AssertionError [ERR_ASSERTION]: '$SKRMC,,A,3749.6038,N,02225.2480,W,1.9,114.6,,,E*42' == '$SKRMC,,A,3749.6038,N,12225.2480,W,1.9,114.6,,,E*43'
      + expected - actual

      -$SKRMC,,A,3749.6038,N,02225.2480,W,1.9,114.6,,,E*42
      +$SKRMC,,A,3749.6038,N,12225.2480,W,1.9,114.6,,,E*43

      at Object.emit (test/RMC.js:42:18)
      at plugin.unsubscribes.push.Bacon.combineWith.changes.debounceImmediate.onValue.nmeaString (index.js:47:17)
      at node_modules/baconjs/dist/Bacon.js:1048:16
      at node_modules/baconjs/dist/Bacon.js:463:23
      at processAfters (node_modules/baconjs/dist/Bacon.js:359:11)
      at Object.inTransaction (node_modules/baconjs/dist/Bacon.js:439:9)
      at Dispatcher.push (node_modules/baconjs/dist/Bacon.js:1214:24)
      at Dispatcher.handleEvent (node_modules/baconjs/dist/Bacon.js:1267:17)
      at Bus.sink (node_modules/baconjs/dist/Bacon.js:242:17)
      at Bus.push (node_modules/baconjs/dist/Bacon.js:2371:21)
      at Context.done (test/RMC.js:53:59)

npm ERR! Test failed.  See above for more details.

RMC not calculated when SOG=0 and no COG available

My SITEX N2K AIS with GPS does not put out a COG when at standstill. That seems to cause this plugin to not put out a RMC sentence.

Use case: I have some old wxtoimg sat-image receiving system that needs to have RMC as ground station location. When the boat is not moving, it fails to get the lat/lon, since no RMC is received

Could the need for COG be made dependent on having a SOG>0, otherwise just plug a zero into COG?

VWT Wind Angle should be +/- 0-180

I appreciate the VWT sentence is deprecated but the parameters are incorrect. The wind angle should be relative to the boat (0-180 degrees) and the next parameter either L or R (for port or starboard)

MDA sentence out

I have I2C connected humidity/temp/pressure sensor (BME860) to get data into SignalK and out again to the NMEA0183 network. I have the signalk-raspberry-pi-bme860 plugin and that brings data into SignalK. I want to use signalk-to-nmea0183 to get the data out to the NMEA0183 network (wifi)

I would like map the following (out from signalk-raspberry-pi-bme860) to an MDA sentence?

environmental.inside.humidity
environmental.inside.pressure
environmental.inside.temperature

VHW sentence should you not subtract the variation from headingTrue

In VHW.js

var headingMagnetic = headingTrue + magneticVariation
you are adding the magneticVariation to headingTrue to get the headingMagnetic should you not subtract.

From the documentation on https://signalk.org/specification/1.5.0/doc/vesselsBranch.html

Description: The magnetic variation (declination) at the current position that must be added to the magnetic heading to derive the true heading. Easterly variations are positive and Westerly variations are negative (in Radians).

RMB sentence specifies invalid keys

RMB.js specifies the following keys..

sentence: 'RMB',
    title: 'RMB - Heading and distance to waypoint',
    keys: [
      'navigation.courseRhumbline.crossTrackError',
      'resources.waypoints.next.position.latitude',
      'resources.waypoints.next.position.longitude',
      'navigation.courseRhumbline.nextPoint.distance',
      'navigation.courseRhumbline.bearingTrue'
    ],
...

the keys resources.waypoints.next.position.latitude and resources.waypoints.next.position.longitude are not part of the spec.

I would suggest that these keys should be replaced with navigation.courseRhumbline.nextPoint.position.

Also the use of courseRhumbline vs courseGreatCircle should be reviewed for consistency across sentences (APB uses courseGreatCircle). Additionally signalk-derived-data plugin populates courseGreatCircle paths.

Wrong GGA implementation

Hi,

now GGA sentence looks:
$IIGGA,085210,5408.7630,N,01328.9580,E,DGNSS fix,8,1,0,M,0,M,,*60

7th field is wrong. It must be numeric

GGA - Global Positioning System Fix Data, Time, Position and fix related data fora GPS receiver.

                                                  11
    1         2       3 4        5 6 7  8   9  10 |  12 13  14   15
    |         |       | |        | | |  |   |   | |   | |   |    |

$--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh

Field Number:

  1. Universal Time Coordinated (UTC)
  2. Latitude
  3. N or S (North or South)
  4. Longitude
  5. E or W (East or West)
  6. GPS Quality Indicator,
    0 - fix not available,
    1 - GPS fix,
    2 - Differential GPS fix
  7. Number of satellites in view, 00 - 12
  8. Horizontal Dilution of precision
  9. Antenna Altitude above/below mean-sea-level (geoid)
  10. Units of antenna altitude, meters
  11. Geoidal separation, the difference between the WGS-84 earth
    ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level
    below ellipsoid
  12. Units of geoidal separation, meters
  13. Age of differential GPS data, time in seconds since last SC104
    type 1 or 9 update, null field when DGPS is not used
  14. Differential reference station ID, 0000-1023
  15. Checksum

Request: Add AIS sentences

We do the reverse in the parser module, why not here too? Also, I'd actually need it for my use-case.

sentences/RSA.js

/**
Rudder Sensor Angle:
$--RSA,x.x,A,x.x,A*hh
Field Number:
1 Starboard (or single) rudder sensor, "-" means Turn To Port
2 Status, A means data is valid
3 Port rudder sensor
4 Status, A means data is valid
5 Checksum
 */

const nmea = require('../nmea.js')
module.exports = function (app) {
  return {
    title: 'RSA - Rudder Sensor Angle',
    keys: ['steering.rudderAngle'],
    f: function (rudderAngle) {
      return nmea.toSentence([
        '$SKRSA',
        nmea.radsToDeg(rudderAngle).toFixed(2),
        'A',
        '',
        ''
      ])
    }
  }
}

APB sentence not emitted

The APB sentence is not emitted even when all of the rquired paths navigation.courseGreatCircle.crossTrackError, navigation.courseGreatCircle.bearingTrackTrue and navigation.courseGreatCircle.nextPoint contain data.

To reproduce:
requires signalk-derived-data, freeboard-sk-helper, sk-resources-fs plugins installed and configured.
Using Freeboard select navigate to a location, Waypoint or activate a route to populate nextPointPosition and have the derived-data plugin to calculate the XTE, bearingTrue values.

In my testing the only sentence emitted was RMC.

Request: add GSV

Request to add conversion to GSV

GSV - Satellites in View shows data about the satellites that the unit might be able to find based on its viewing mask and almanac data. It also shows current ability to track this data. Note that one GSV sentence only can provide data for up to 4 satellites and thus there may need to be 3 sentences for the full information. It is reasonable for the GSV sentence to contain more satellites than GGA might indicate since GSV may include satellites that are not used as part of the solution. It is not a requirment that the GSV sentences all appear in sequence. To avoid overloading the data bandwidth some receivers may place the various sentences in totally different samples since each sentence identifies which one it is.

The field called SNR (Signal to Noise Ratio) in the NMEA standard is often referred to as signal strength. SNR is an indirect but more useful value that raw signal strength. It can range from 0 to 99 and has units of dB according to the NMEA standard, but the various manufacturers send different ranges of numbers with different starting numbers so the values themselves cannot necessarily be used to evaluate different units. The range of working values in a given gps will usually show a difference of about 25 to 35 between the lowest and highest values, however 0 is a special case and may be shown on satellites that are in view but not being tracked.

$GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75

Where:
GSV Satellites in view
2 Number of sentences for full data
1 sentence 1 of 2
08 Number of satellites in view

  01           Satellite PRN number
  40           Elevation, degrees
  083          Azimuth, degrees
  46           SNR - higher is better
       for up to 4 satellites per sentence
  *75          the checksum data, always begins with *

Not all sentences passed to Serial O/P

Via TCP I am receiving the following sentences
GGA,GLL,RMC,DBK,DBS,DBT,HDG,HDM,HDT,MTW,MWD,MWV,VHW,VWR,VWT,ZDA

Via Serial output I am only receiving the following, all the output types are ticked in the plugin config.
GGA,GLL,RMC,HDG,HDM,HDT

Server v1.35.2 Plugin v1.7.1

How to send nmea0183 using this plugin?

Hello,
I want to send nmea0183 data using signalk and using this plugin. I read this and I think this is just what I need, however I still do not know how to actually send something back trought my serial connection.

I have bidirection rs232/483 connection and I can read, now I want to write.

I have install this plugin, now I want to send a value for the HSC pgn for example...

What would be the end 2 end steps!?

Thanks in advance!

Sentence HDG: swapped Variation and Deviation fileds

According NMEA0183 Documentation you swapped the position of Variation field with Deviation field!

HDG - Heading - Deviation & Variation

    1   2   3 4   5 6
    |   |   | |   | |

$--HDG,x.x,x.x,a,x.x,a*hh

Field Number:

  1. Magnetic Sensor heading in degrees
  2. Magnetic Deviation, degrees
  3. Magnetic Deviation direction, E = Easterly, W = Westerly
  4. Magnetic Variation degrees
  5. Magnetic Variation direction, E = Easterly, W = Westerly
  6. Checksum

specifying/creating device (/dev/xxx) which signalk-to-nmea0183 writes to

Greeting from Norway :)
Im playing with openplotter on a boat with a nmea2000 bus, signal k receives data (through actisense ngt-1), but I haven't managed to forward those data to opencpn. I thought I could use signalk-to-nmea0183 for this task, writing to a serial device, and setup opencpn to read from this. Is this the intended way? If so - do I create a new serial port on the rpi, and set "device" in the signalk config to this?
Best regards
Kai

Request: add GSA

GSA - GPS DOP and active satellites. This sentence provides details on the nature of the fix. It includes the numbers of the satellites being used in the current solution and the DOP. DOP (dilution of precision) is an indication of the effect of satellite geometry on the accuracy of the fix. It is a unitless number where smaller is better. For 3D fixes using 4 satellites a 1.0 would be considered to be a perfect number, however for overdetermined solutions it is possible to see numbers below 1.0.

There are differences in the way the PRN's are presented which can effect the ability of some programs to display this data. For example, in the example shown below there are 5 satellites in the solution and the null fields are scattered indicating that the almanac would show satellites in the null positions that are not being used as part of this solution. Other receivers might output all of the satellites used at the beginning of the sentence with the null field all stacked up at the end. This difference accounts for some satellite display programs not always being able to display the satellites being tracked. Some units may show all satellites that have ephemeris data without regard to their use as part of the solution but this is non-standard.

$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39

Where:
GSA Satellite status
A Auto selection of 2D or 3D fix (M = manual)
3 3D fix - values include: 1 = no fix
2 = 2D fix
3 = 3D fix
04,05... PRNs of satellites used for fix (space for 12)
2.5 PDOP (dilution of precision)
1.3 Horizontal dilution of precision (HDOP)
2.1 Vertical dilution of precision (VDOP)
*39 the checksum data, always begins with *

Request: Sentence format adjustments

I am trying to display data from the SignalK server running on a pi on my old stowe Dataline instruments, with Dataline being an early take on NMEA0183 as I understand. They are receiving the data, however are expecting a slightly different format, i.e. the VHW sentence from this plugin outputs XXX.X, M for the magnetic heading while the instruments expect XXX, M without a decimal. At the moment I am getting values on the screen, but apart from the STW they are alll wrong and some of them going all over the place each time the display is updated.
Is there a way I am not aware of to adjust the format? Otherwise it would be a great feature.
I would love to help as much as I can but have no experience at all with javascript.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.