About Seatalk1 to Nmea183 Conversion of Depth

This forum is for discussing hardware (electronics) and software design aspects of multiplexers in general.
Post Reply
Luis Sa
Site Admin
Posts: 845
Joined: Thu May 04, 2017 4:12 am

About Seatalk1 to Nmea183 Conversion of Depth

Post by Luis Sa » Sun Nov 10, 2019 1:36 am

Hello,

Note on December 8th, 2019 - if you read this topic please ignore binary files 31G and 31H for which I have links below. There a file that I named as 32ST which is much better for debugging SeaTalk1 datagrams. Please see this topic.

George from Hungary gave me an enormous feedback and help when I tried to solve the problems of Seatalk1 to Nmea183 conversion. Two days ago he posted here on the forum another report on this subject. I took the liberty of moving his post here because it was originally posted on a topic regarding OTA update which is a different matter.

Following is the post be George (username Cormoran)

Dear Luis,

My Raymarine i40 and ST1000+ working correctly, the data comings from bought equipments! :-) I have only one problem with depth data. If you can see, the $SDDBT data displaying only foot dimension in the nmea sentence (no other dimensions eg. meters and fathoms) translating the seatalk to nmea183 messages):

$HCHDG,126,,,4,E*28
$SDDBT,56.4,f,,,,*3A
$VWVHW,,,126,M,13.52,N,,,*79
$IIMTW,5.1,C*27
$HCHDG,127,,,4,E*29
$SDDBT,54.9,f,,,,*35
$SDDBT,54.9,f,,,,*35
$HCHDG,128,,,4,E*26
$SDDBT,53.1,f,,,,*3A
$VWVHW,,,128,M,12.71,N,,,*77


And in the application on my Android and iPad doesn't recognise the water depth nmea sentences, not only my Raymarine equipments but your simulation files too. All of others are displaying!

Frome the simulation mode there is another depth nmea messages ($IIDBT) with all depth dimensions, but the app can't recognize too.

Regards, George


and following is my answer that I also deleted in the OTA post and paste it here:

Hello George,

In the simulation data I am using

$IIDBT,13.1,f,04.0,M,02.2,F*26

When converting Seatalk1 to Nmea183 I use

$SDDBT,13.1,f,, (all the rest blank) - I have not an example at hand to show here in this exact moment.

Is it the problem with the II or SD? Or because I am only sending value in Feet?

Suggestion - Could you create examples of DBT sentences (using the Nmea Studio by SailSoft for example) save them in a file. Then use my Nmea4Wifi tool to read that file and transmit it by wifi to your apps and see what is the format of the DBT sentences that your instruments accept? If you do that I will replicate that in the multiplexer.

Wait for your feedback. As this is a bit technically may be we could discuss it by email.

Best Regards, Luis


Following my post George send me an email with further information. I think, however, that we could discuss this subject here as there could be the case that more users have problems like this. I leave for George the decision to post here his email if he finds that is important for the discussion. Now I will comment on the next post.

Regards, Luis

Luis Sa
Site Admin
Posts: 845
Joined: Thu May 04, 2017 4:12 am

Re: About Seatalk1 to Nmea183 Conversion of Depth

Post by Luis Sa » Sun Nov 10, 2019 1:56 am

Hello George,

Let me resume what I know about SeaTalk1 Depth. Thomas Knauf document describes depth as follows:

Code: Select all

 00  02  YZ  XX XX  Depth below transducer: XXXX/10 feet
                       Flags in Y: Y&8 = 8: Anchor Alarm is active
                                  Y&4 = 4: Metric display units or
                                           Fathom display units if followed by command 65
                                  Y&2 = 2: Used, unknown meaning
                      Flags in Z: Z&4 = 4: Transducer defective
                                  Z&2 = 2: Deep Alarm is active
                                  Z&1 = 1: Shallow Depth Alarm is active
                    Corresponding NMEA sentences: DPT, DBT
In my code the bytes 00 02 YZ XX XX are referred to as ST[0] ST[1] ST[2] ST[3] ST[4].

As you you will see below I am only looking at ST[3] and ST[4]. Following is the code in version 31 that converts Seatalk1 to Nmea183 (if anyone reading this has a difficult in following the code below, please just ask here or privately)

Code: Select all

// DBT using integers
// ==================
  uint16_t Parse00() {
  const char DBT[] = "$SDDBT,";
  uint16_t len = 0;
  len += sprintf(nmea_4, DBT);
  // now you can test the filtering
  if ( CheckNmeaFlt_4() == false ) { return 0; }  
  //  uint16_t ii = (ST[3] << 8) | ST[4] ;  byte order is incorrect
  uint16_t ii = (ST[4] << 8) | ST[3] ;
  uint16_t DD = ii / 10;
  uint8_t F = ii - DD * 10;
  len += sprintf(nmea_4 + len, "%u.%u,f,,,,*", DD, F ); 
  int XOR = checkSum( nmea_4 );
  len += sprintf(nmea_4 + len, "%.2X", XOR );
  return len + 1;
}
I shift to the right the byte ST[4] by 8 positions and do a "OR" with ST[3] and put the result in the variable ii. So I need to divide by 10 the value contained in ii to get Depth in feet. Using integer arithmetic I get result of that division in the 16-bit integer variable DD (decimal part). I use another 8-bit integer variable called F (fractional part) where I get the fractional value that was lost with the integer division. If depth is 2975.3 feet DD will be 2975 and F will be 3. The rest of the code formats the Nmea sentence using SD as the identifier and filling with blanks the value for meters and fathoms. The result will be:

Code: Select all

$SDDBT,2975.3,f,,,,*37
I never could understand the meaning of Y&4 = 4. There was an occasion where I was testing that bit to decide if the XXXX value was meters or feet. I was using this:

Code: Select all

  if ( ST[2] & 0x40 ) { // DephBT is meters
    len += sprintf(nmea_4 + len, ",,%u.%u,M,,*", DD, F );
  }
  else { // DephBT is feet
    len += sprintf(nmea_4 + len, "%u.%u,f,,,,*", DD, F );    
  }
but I could not test fully test it (after writing this I found my old Raymarine E85001 bridge and it does nothing with regard to Y&4 = 4). I do do not remember but may be I tried that when I was using the wrong order for ST[3] with ST[4] as noticed in the code comment above. I got feedback that version 31 shown above gives correct readings. I admit that the instruments that receive depth in feet will be able to convert the value to meters or fathoms. Following George post of this week I Created a firmware that I called NMEA4WIFI31G.BIN where I use float numbers for the conversion and fill the fields for feet, meters and fathoms. The code is as follows:

Code: Select all

// DBT using floating numbers
// ==========================
  uint16_t Parse00() {
  const char DBT[] = "$SDDBT,";
  uint16_t len = 0; float x, y;
  len += sprintf(nmea_4, DBT);
  // now you can test the filtering
  float DepthBT = (ST[4] << 8) | ST[3] ; 
  if ( CheckNmeaFlt_4() == false ) { return 0; }
  DepthBT /= 10; 
  x = DepthBT * 0.3048; // x is in meters
  y = DepthBT * 0.1667; // y is in fathoms
  len += sprintf(nmea_4 + len, "%.1f,f,%.1f,M,%.1f,F*", DepthBT, x, y );    
  int XOR = checkSum( nmea_4 );
  len += sprintf(nmea_4 + len, "%.2X", XOR );
  return len + 1;
}
One example of a sentence produced is now like this:

Code: Select all

$SDDBT,12.2,f,3.7,M,2.0,F*31
The BIN file can be downloaded here and I appreciate any feedback. One note to George - I coud create a firmware that you could update using OTA which would not translate the Depth Seatalk1 datagram to Nmea183. Instead it would just send the datagram that could be stored in a file using for example my tool Nmea4Wifi. If you tell that you could try that I will do it. We could, one and for all, be sure about the exact meaning of the Depth datagram.

Regards, Luis

Cormoran
Posts: 35
Joined: Sat Feb 23, 2019 5:49 am
Location: Hungary

Re: About Seatalk1 to Nmea183 Conversion of Depth

Post by Cormoran » Sun Nov 10, 2019 2:46 pm

Dear Luis,

Thank you for your "exhaustive" answer, that was very detailed, and correct. Many times I want to understand all but I couldn't understand very deep the Thomas Knauf documents about the Seatalk datagrams but the Seatalk to NMEA183 or NMEA183 to Seatalk translation too. (I think the main reason for this is that, I'm not a programmer just an avid amateur :-) ).
I tried to find other money safe way to translate the Seatalk1 data to nmea183 using on my small sailboat. This was the Nmea4wifi equipment from Luis, which is working well now and I'm not ready my sailboat information system but I'm very glad with it now.

So, The DBT data from my Nmea4Wifi equipment with new "Firmware George 3.1" firmware (I mean DBT data) coming with all dimension, not only in feet, and all dimensions and levels are correct. I don't know which app working with only feet and calculating to meters or other dimension, but the DBT data from my Nmea4wifi was correct before when the depth data came only in feet. The same problem is present at this time in my Android app too than before, (I'm guessed when I was consulted earlier with Luis), but I contacted with the app developer who sad me, the app gauges interpreted the DPT not DBT! It may the problem is? I have no other idea for this problem, but the information from the developer and the information from the app is different and not clear for me.

https://photos.app.goo.gl/9xrJ6ugh6dUBr1st7

https://photos.app.goo.gl/R5YSDgXMHqX97AkS9


On the first page in the App when you can see the "Nmea message list", you can see the Water depth (DBT) as Depth Below Transducer, and the level is correct, same than on my i40 screen. And the other page in between the gauges there are same but no any data. It's may a mistake in the App???

The DPT sentences is means:

DPT Heading – Deviation & Variation
1 2 3
| | |
$--DPT,x.x,x.x*hh
1) Depth, meters
2) Offset from transducer;
positive means distance from transducer to water line,
negative means distance from transducer to keel
3) Checksum

and the DBT means is:

DBT Depth Below Transducer

1 2 3 4 5 6 7
| | | | | | |
$--DBT,x.x,f,x.x,M,x.x,F*hh
1) Depth, feet
2) f = feet
3) Depth, meters
4) M = meters
5) Depth, Fathoms
6) F = Fathoms
7) Checksum



There are two others and those are (as my logic) about same than the DPT but in two different sentences:

DBK : Depth Below Keel
DBS : Depth Below Surface


My i40 know this, I can to set to waterline or keel but I can't check it what kind of Seatalk datagrams come out from the equipent. Bought of them or only one. I think the datagrams are same than the other Raynarine equipment (eg. St60 or higher) which is working with Seatalk1.

I don't remember surly the Nmea4Wifi equipment what kind of Seatalk datagram can be translate to Nmea183. If I want to filtering the Nmea183 >P5 or UDP/TCP out sentence in the Nmea4Wifi tools on my PC, I found all of them (DBK, DBS, DBT, DPT).

Sorry for too long conversation :-)

Luis Sa
Site Admin
Posts: 845
Joined: Thu May 04, 2017 4:12 am

Re: About Seatalk1 to Nmea183 Conversion of Depth

Post by Luis Sa » Mon Nov 11, 2019 8:36 pm

Hello George (and all users that want to play and try to decode SeaTalk1 datagrams)

As I referred to in my previous post the Thomas Knauf document about SeaTalk1 only refers the datagram starting with 00 as the one that concerns to Depth. He refers that this datagram could be translated to Nmea 0183 as a DBT (depth below transducer) sentence or as a DPT (depth of water). As we have referred to in our private emails we could also use DBK (depth below keel) or DBS(depth below surface). It is obvious that I had to choose one of these possible conversions and as in many other commercial converters I chose DBT. There is one question that I need to decide:
  • shall I just include, in the DBT sentence, the depth in feet leaving for the receiving instruments the option to translate to meters or fathoms?
  • or shall I also fill the values in meters and fathoms as in the 31G firmware of my last post?
I am inclined for the first case as in my instruments I can set the displays to show meters even they are only receiving the depth in feet. I can also set the offset between the waterline and the transducer or even enter the depth of my keel to get the most useful information when I am sailing. So DBK or DBS are just redundant as far as I understand.

Now if you want to catch up the SeaTalk1 datagrams you can use firmware 31H that you can downloaded here. This version sends out the original SeaTalk1 datagram followed by the converted to Nmea183 sentence performed by the Nmea4Wifi multiplexer. I connected a SeaTalk1 generator that I built for testing purposes on port P4. I just set P4>P5 and set P5 baud rate to 38400 (could be any other value). I opened my revised Nmea4Wifi tool and in the menu Tools>Receiving I set up a file to record received sentences. In the same form I set the source of data as a COM4 (at 38400). I connected an USB cable to the Nmea4Wifi multiplexer (note that what comes out on P5 also comes out on the USB port). I closed the Tools>Receiving form and press the bar "Start Recording" in the main form which made the red dot to start blinking. After a while I stop the recording and when again to the Tools>Receiving form and opened the recording file. Here is some lines that where there:

Code: Select all

SeaTalk1 = 25 04 CB 1D 3B 13 00 
$IIVLW,762.7,N,49.23,N*45
SeaTalk1 = 26 04 02 88 02 10 00 
$VWVHW,,,318,M,348.18,N,,,*45
SeaTalk1 = 27 01 00 F8 
$IIMTW,6338.8,C*15
SeaTalk1 = 53 B0 19 
$GPRMC,140145,A,403.700,S,1243.956,W,25.6,321,181118,2,W*53
SeaTalk1 = 84 36 D8 5A 00 00 00 00 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 89 32 18 00 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 9C 31 18 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 00 02 40 39 74 
$SDDBT,2975.3,f,,,,*37
SeaTalk1 = 11 01 0C 03 
$WIMWV,123.5,R,12.3,N,A*16
SeaTalk1 = 21 02 00 71 0F 
$IIVLW,807.1,N,10119.68,N*75
SeaTalk1 = 25 04 CB 1D 3B 13 00 
$IIVLW,762.7,N,49.23,N*45
SeaTalk1 = 26 04 02 88 02 10 00 
$VWVHW,,,318,M,348.18,N,,,*45
SeaTalk1 = 27 01 00 F8 
$IIMTW,6338.8,C*15
SeaTalk1 = 53 B0 19 
$GPRMC,140145,A,403.700,S,1243.956,W,25.6,321,181118,2,W*53
SeaTalk1 = 84 36 D8 5A 00 00 00 00 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 89 32 18 00 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 9C 31 18 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 00 02 40 39 74 
$SDDBT,2975.3,f,,,,*37
SeaTalk1 = 11 01 0C 03 
$WIMWV,123.5,R,12.3,N,A*16
SeaTalk1 = 21 02 00 71 0F 
$IIVLW,807.1,N,10119.68,N*75
SeaTalk1 = 25 04 CB 1D 3B 13 00 
$IIVLW,762.7,N,49.23,N*45
SeaTalk1 = 26 04 02 88 02 10 00 
$VWVHW,,,318,M,348.18,N,,,*45
SeaTalk1 = 27 01 00 F8 
$IIMTW,6338.8,C*15
SeaTalk1 = 53 B0 19 
$GPRMC,140145,A,403.700,S,1243.956,W,25.6,321,181118,2,W*53
SeaTalk1 = 84 36 D8 5A 00 00 00 00 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 89 32 18 00 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 9C 31 18 00 
$HCHDG,318,,,2,W*33
SeaTalk1 = 00 02 40 39 74 
$SDDBT,2975.3,f,,,,*37
SeaTalk1 = 11 01 0C 03 
$WIMWV,123.5,R,12.3,N,A*16
SeaTalk1 = 21 02 00 71 0F 
$IIVLW,807.1,N,10119.68,N*75
As you see you have the SeaTalk1 datagram followed by its conversion. I hope this will be useful. This wil not will be included in any future revision of the software as its is only shared here for technical purposes. I would appreciate if George can connect its Seatalk1 data sources to P4 and grab some files for we to check or decode!

Regards, Luis

Luis Sa
Site Admin
Posts: 845
Joined: Thu May 04, 2017 4:12 am

Re: About Seatalk1 to Nmea183 Conversion of Depth

Post by Luis Sa » Sun Nov 24, 2019 6:00 pm

Hello,

I will open a topic with title Testing and Grabbing SeaTalk1 Datagrams where I will discuss in more general terms some of the matters of the present topic.

Regards Luis

Post Reply