anchor chain counter to NMEA0183 Garmin proprietary sentences via arduino?

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
hello all,

almost managed to fit the whole idea in the subject line :)

I've checked various diy electronics projects presented here and it seems to me that what I'm thinking is doable and wonder if someone has already done.

Plan is to:
  • get a magnet/sensor set on the gypsy of my Lofrans tigress windlass
  • get the up or down signal from the windlass controller (so that I know if I'm counting up or down the revs...)
  • wire them to the digital and analogue inputs respectively of an arduino uno I have lying around
  • output the custom NMEA0183 sentences that AutoAnchor built to support/communicate their 601 black box to marine nav equipment
  • wire that to a GMI10 through the 7pin NMEA0183 comms cable (yes I know it's a NMEA2K gauge, but it does support the old standard as well)
  • view that on the f/b and lower helm GMIs on my boat.


I understand that not many ppl have GMI10s or 20s, but considering that the AutoAnchor 601 costs almost 1000usd, the cheapest non NMEA chain counter is 300+, the magnet sensor is 30euro and the uno another 20 or so, I recon it's worth a shot :D

So Qs:

anyone has done it?
any reason it wont work (am I missing something?)
For the time being, you'd still need the normal windlass toggle switch to operate the windlass.

cheers

V.
 

prv

Well-known member
Joined
29 Nov 2009
Messages
37,361
Location
Southampton
Visit site
Do you know whether the Garmin display understands oddball non-standard chain-counting sentences on its NMEA0183 input? My gut feeling is that it's unlikely...

Also I suspect the up/down "signal" will simply be a couple of 12v lines hence digital input rather than analogue, but that's easier if anything. Possibly will need some kind of anti-spike protection as well as the obvious downshifting to 5v / 3.3v.

Pete
 
Last edited:

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
Do you know whether the Garmin display understands oddball non-standard chain-counting sentences on its NMEA0183 input? My gut feeling is that it's unlikely...

Also I suspect the up/down "signal" will simply be a couple of 12v lines hence digital input rather than analogue, but that's easier if anything. Possibly will need some kind of anti-spike protection as well as the obvious downshifting to 5v / 3.3v.

Pete

The whole point of the project is that AutoAnchor 601 clearly states support for GMI10. It is also mentioned in the GMI firmware updates somewhere (don't have the time to check right now) Having said that, I've not managed to trace this page on my GMIs but I've not worked hard on that.
Basically again from the AA601 manual it does send two sentences, one is the identifier of the device, the other is the rode specs/data/state/length/whatever.
So I'll simply try and duplicate that. True, in all NMEA standards I've checked, there's no mention of these sentences, but there's explicit mention of Proprietary sentences (starting with a PO** iirc)

Correct on the digital vs analogue, thanks and also on the anti-spike.
I do have a couple of leftover 33V -> 5V transformers from my VIMAR USB sockets project, so no issues on that, 1.5A should be plenty for a arduino uno doing bugger all and just sending serial sentences.

Ideally I'd hope that the GMI screen would use the buttons to send other custom messages to the AA601 which would mean I could have the GMI fully controlling the windlass, but i'll have to see how that works.
I've yet to find anyone that has AA601 to ask a few qs. Keep in mind though that AA601 is a black box, no user interface, so got to have the GMI as a front end. If things look quieter over the w/e I'll try to establish what's going on.

cheers

V.
 

prv

Well-known member
Joined
29 Nov 2009
Messages
37,361
Location
Southampton
Visit site
The whole point of the project is that AutoAnchor 601 clearly states support for GMI10. It is also mentioned in the GMI firmware updates somewhere

Great, sounds like a goer then :encouragement:

Correct on the digital vs analogue, thanks and also on the anti-spike.
I do have a couple of leftover 33V -> 5V transformers from my VIMAR USB sockets project, so no issues on that, 1.5A should be plenty for a arduino uno doing bugger all and just sending serial sentences.

I didn't mean a stepdown for the power supply, though of course you'll need that too. I meant for the lines you'll be running from the solenoid box to digital inputs on the Arduino. I assume those aren't allowed to be over 5v, but the current drawn will be practically nil. Probably just a suitable resistor would do the job? My analogue electronics knowledge is pretty shakey though :)

Pete
 

Martin_J

Well-known member
Joined
19 Apr 2006
Messages
4,424
Location
Portsmouth, UK
Visit site
It looks like Garmin added the AutoAnchor 601 sentences to it's NMEA0183 vocabulary at version 3.20
http://www8.garmin.com/support/download_details.jsp?id=4819

A little article here showing the GMI20 AutoAnchor screen..
http://www.panbo.com/archives/2013/05/garmin_gmi_20_hands_on_surprises_found.html

It should be quite easy to re-create those sentences since AutoAnchor have published their sentence information here
http://www.autoanchor.co.nz/sites/default/files/NMEA_Message_Formats.pdf
I do have a GMI10 display on board but am rather busy at the moment trying to build the Arduino Autopilot. The last NMEA 0183 work I did was on the PIC18F (thanks to Angus' YAPP project) so can't say how easy it is on Arduino.
 

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
thanks for gathering and posting all the relevant links :D
Will do some tests with dummy values and see how it goes.

BTW, there is some interest in the mobo forum, and some work already done on this, so we may have to join the powers so to speak and see what we get.
Arduino autopilot sounds interesting, care to elaborate?

cheers

V.
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,517
Location
Hopefully somewhere warm
Visit site
thanks for gathering and posting all the relevant links :D
Will do some tests with dummy values and see how it goes.

BTW, there is some interest in the mobo forum, and some work already done on this, so we may have to join the powers so to speak and see what we get.
Arduino autopilot sounds interesting, care to elaborate?

cheers

V.
Couple things you probably know already...

One of the many available of these seem to work well to get to/from NMEA , on one extra of the hardware serial ports an arduino mega has anyway, sorts out the voltages and inverts the logic. -
http://www.ebay.co.uk/itm/High-Qual...038471?hash=item5672aba307:g:CrYAAMXQLw1R3NRX

Also, nmea sentences have a checksum at the end which you will need to calculate if you change the datatype or making from scratch, the subroutine below calculates it. Strip the "$" from the start of the string and everything from and including the "*" at the end, the add them in again with the checksum at the end. .
Hope that makes sense. :)


char checkSum(String theseChars) {
char check = 0;
// iterate over the string, XOR each byte with the total sum:
for (int c = 0; c < theseChars.length(); c++) {
check = char(check ^ theseChars.charAt(c));
}
// return the result
return check;
}
 
Last edited:

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
sorry, late in replying..

thanks for the checksum code, imported it on my test code, but need to test it on the GMI during the w/e. Curious if I got it right though as I need to grab a few "correct" NMEA0183 messages for test purposes.

Not sure I understand why I need the serial port as the uno has the Tx and Rx ports and I'm not going to use it for anything else... No idea of voltages that NMEA expects, will check.

I asked Hurricane who has already worked a lot on this topic, to start a thread on the mobo forum. Would be nice to keep the discussion together.

cheers

V.
 

skyflyer

Active member
Joined
26 Jan 2011
Messages
1,433
Location
Worcester, UK
Visit site
Of course you could be really clever and get the arduino to read the depth, and tidal state and prediction (not quite sure where from?) and calculate the required scope :)
 

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
Of course you could be really clever and get the arduino to read the depth, and tidal state and prediction (not quite sure where from?) and calculate the required scope :)

in the Med you don't need tidal state/tables, so yes, if we can "trace" depth info from the NMEA bus, and we combine with wind instrument data, we could recommend a scope :p
It is getting rather silly though :D
another idea is that we could use the same arduino board with a few more inputs and wire a couple of flow sensors and get instant consumption figures. Apparently flow sensors are around 200usd a pop, but the black box that does the calcs and sends the NMEA sentences are approx 800usd

Anyway, I'll be moving these ideas to the other thread in the mobo section

cheers

V.
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,517
Location
Hopefully somewhere warm
Visit site
sorry, late in replying..

thanks for the checksum code, imported it on my test code, but need to test it on the GMI during the w/e. Curious if I got it right though as I need to grab a few "correct" NMEA0183 messages for test purposes.

Not sure I understand why I need the serial port as the uno has the Tx and Rx ports and I'm not going to use it for anything else... No idea of voltages that NMEA expects, will check.

I asked Hurricane who has already worked a lot on this topic, to start a thread on the mobo forum. Would be nice to keep the discussion together.

cheers

V.

here's a very messy little bit of code I was playing around with making GPRMC sentences to see how fast OpenCPN could read them. But hopefully it might show how to put together a checksum better, you need to convert the HEX checksum into a string and add it into the sentence...

PS- The UNO serial port works differently to NMEA serial data, that little ebay board sits between the two , sorts out the voltages and turns 1's into 0's & vice versa so the two devices can talk to each other.

Code:
String GPS, GPS2;
  int GPS3; 
  float gpsLong=0117.00;
  float gpsLat=5047.00;
  


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
  pinMode(13, OUTPUT);




}


void loop() {
  // put your main code here, to run repeatedly:


  GPS="GPRMC,081836,A," +String(gpsLat, DEC)  + ",N,"  + String(gpsLong,DEC)  + ",W,555.0,360.0,130998,011.3,E";
  // "$GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62"


GPS3=checkSum(GPS);
  
//Serial.println(GPS3, HEX);
GPS2="$" + GPS + "*" + String(GPS3, HEX);
Serial.println(GPS2);
gpsLat=gpsLat+0.1;
delay (20);


}


char checkSum(String theseChars) {
  char check = 0;
  // iterate over the string, XOR each byte with the total sum:
  for (int c = 0; c < theseChars.length(); c++) {
    check = char(check ^ theseChars.charAt(c));
  } 
  // return the result
  return check;
}
 
Last edited:

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
thanks point taken on the board, will order in a while.

my last night code is messier than yours, but managed to replicate an identical string with checksum, so happy with that for the moment.
Will have to start building the right strings for testing my GMIs once I get this board and hook them all up together.

void setup() {
// initialize serial communication:
Serial.begin(4800);}

void loop() {

/////////////////////////////////////
//checksum calculation from GHA
int thisNumber = 1;
String theseChars = "GPRMC,210230,A,3855.4487,N,09446.0071,W,0.0,076.2,130495,003.8,E";
char check = 0;
// iterate over the string, XOR each byte with the total sum:
for (int c = 0; c < theseChars.length(); c++) {
check = char(check ^ theseChars.charAt(c));
}


//////////////////////////////////////
//sent the NMEA0183 message to the bus
Serial.print("$" + theseChars + "*");
Serial.println(check, HEX);

//just a simple delay to repeat the message,
//will have to organise how messages are sent, and at what intervals

delay(3000);
}

As I said I'll report new progress on the mobo thread once we get the whole idea rolling.

cheers

V.
 

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
I'll keep an eye on mobo for progress, love all this kind of stuff :cool:

BTW,from the messy code above here's an arduino pretending to be a GPS and a boat doing 555Kts ;)

nice,

call it an airplane and you're fine I recon. It's not only the speed that's your problem in the video :p
It's been a few years since I was down there last, but I don't recall a dead straight canal cutting sw...

cheers

V.
 

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
Us sailing types feel a little bit above all that ;) :)

you sailing lot may feel above all that (wrongly imho...), but I'm feeling below all that arduino messing...

Just got my TTL converter you recommended (took a month to arrive from China...), wired it up to Pin13 (tried also pin1) on my uno, wired the nmea0183 cable of my GMI10 to it and I get nothing at all on the GMI
Tried all sorts of sentences (having the equivelant screen on the GMI), nada.
Also tried sending readymade demo sentences with their checksum et al in case I got the checksum code wrong, (which I don't think so...) again nothing.

Have a feeling I got to try a step at a a time and need to now hook the arduino->TTL442 thingy to another pc (or the same using a USB->Serial converter only they are both male and I have a wee problem there...) and check on a terminal prog what is being sent (if anything!) If that works, then I'll debug the next step (i.e. the GMI10)

anything silly I may be missing?

cheers

V.
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,517
Location
Hopefully somewhere warm
Visit site
Just got my TTL converter you recommended (took a month to arrive from China...), wired it up to Pin13 (tried also pin1) on my uno, wired the nmea0183 cable of my GMI10 to it and I get nothing at all on the GMI
Tried all sorts of sentences (having the equivelant screen on the GMI), nada.
Also tried sending readymade demo sentences with their checksum et al in case I got the checksum code wrong, (which I don't think so...) again nothing.

Have a feeling I got to try a step at a a time and need to now hook the arduino->TTL442 thingy to another pc (or the same using a USB->Serial converter only they are both male and I have a wee problem there...) and check on a terminal prog what is being sent (if anything!) If that works, then I'll debug the next step (i.e. the GMI10)

anything silly I may be missing?

cheers

V.

What sketch have you got running on the Arduino? I think the software serial library is built in to the latest arduino IDE software, if so you'll see a softwareserial item in the file/examples. It defaults to pins 10 & 11 for RX/TX. Then to example sketch should echo anything sent from the arduino serial monitor out of pin 11, and recieve from pin 10.

Apologies if you know all this already.

https://www.arduino.cc/en/Reference/SoftwareSerial
 

vas

Well-known member
Joined
21 Jun 2011
Messages
8,084
Location
Volos-Athens
Visit site
What sketch have you got running on the Arduino? I think the software serial library is built in to the latest arduino IDE software, if so you'll see a softwareserial item in the file/examples. It defaults to pins 10 & 11 for RX/TX. Then to example sketch should echo anything sent from the arduino serial monitor out of pin 11, and recieve from pin 10.

Apologies if you know all this already.

https://www.arduino.cc/en/Reference/SoftwareSerial

I know nothing and that's my problem it seems.. :D

tried:

void setup() {
// initialize serial communication:
Serial.begin(4800);
pinMode(13, OUTPUT);
}


void loop() {

Serial.print("$SDDBS,2348.56,f,715.78,M,391.43,F*4B");

delay(1000);
}

but obviously wont cut it as not all serials are the same and this serial.print only comes up on the serial monitor window..,
Upgraded my arduino to the latest ver, there is indeed a softwareserial lib in there, didn't have time to read and understand properly what's going on, so will try again and report tonight hopefully.

cheers

V.
 

laika

Well-known member
Joined
6 Apr 2011
Messages
8,209
Location
London / Gosport
Visit site
I know nothing and that's my problem it seems.. :D

I know next to nothing but if I understand the problem correctly your problem is that you want to declare a SoftwareSerial object and call methods on that to initialise it and write through it. What you're doing now is working with the Serial object defined in the HardwareSerial library which refers to the first (and in the case of the uno, only) UART.

I haven't even used my (not so) recently acquired arduinos for anything useful yet, hence the Jon Snow disclaimer.

I've had a look at the SofwareSerial library on github and it seems that there's no way to declare a SoftwareSerial object to be transmit only (anyone who knows more feel free to correct me here), so you either have to just use an unused pin in the declaration of your SoftwareSerial, use one of the many hacks people have done to SoftwareSerial to alter that, or roll your own.

A brief (possibly inadequate) spin back through this thread hasn't made it clear to me why you're wanting to use SoftwareSerial on a general purpose pin rather than using the uno's UART which would seem simpler.
 
Top