Using NMEA 0183 or 2000 with an Arduino

Other than control. (Navigation, Sonar, Ect.)
kenl
Posts: 153
Joined: Oct 19th, 2013, 8:50 am
Location: South Western Australia

Using NMEA 0183 or 2000 with an Arduino

Post by kenl »

Hi all,

I have been trying to find information on using some unused boat stuff I have but not really seeing anything that I can understand.

I would like to connect a depth only type of transducer to my ROV so I know the distance to the bottom, this would then allow some fancy programming (by others smarter than I) to have a maintain current depth function

The other item I would like to fit is a paddle wheel that comes standard with many echo sounders, this could provide water speed when on the move and current when parked on the bottom. Not real important information, but of interest none the less.

Every thing I have found with regards to NMEA is in relation to GPS or when transducers are used they are connected to PCs.

So any ideas of
a) is it doable and
b) if so how
c) else forget it :(
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Using NMEA 0183 or 2000 with an Arduino

Post by a_shorething »

Hey Ken,

I'm not sure about that specific answer, but I was considering a similar function that I think I COULD code. 8-)

The guys over at OPENROV have developed a board that includes a pressure sensor that is apparently pretty sensitive.

What if you set it up so that the command was as simple as:

Void MaintainDepth()

set desired_presssure=read_pressure
{if (read_pressure)> desired_pressure; Upthruster
if (read_pressure)<desired_pressure; downthruster
}

It wouldn't address if you still want to know how far it is to the bottom, but if the goal is 'maintain depth' this might work.
kenl
Posts: 153
Joined: Oct 19th, 2013, 8:50 am
Location: South Western Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by kenl »

Shorething,

That's a great idea! Almost too obvious :oops:

Do you know where they get their sensors from? I have not read through the site.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by rossrov »

Yes can be done. Once you've got the bottom distance figure its just like a regular boat autopilot but makes the thruster go cw/ccw instead of the rudder motor. What a_shorething quoted from that other forum is a primitive feedback loop. You improve on this by making the motor commands proportional to the distance error (ie desired minus actual distance), otherwise the ROV might end up overcorrecting and bouncing up and down. To make things easier a bit of positive bouyancy in the ROV means that once you are off the bottom enough the thruster can be left slowly spinning, and increase speed gently when distance increases. A couple of more lines of code would get this working

I responded to Zaibach viewtopic.php?f=16&t=634&start=20#p6549 you may have read already...

here is an example of the NMEA 0183 sentence: http://www.eye4software.com/products/gp ... a/#nmeaDBT

Plenty of Arduino examples where you can learn about receiving serial data

Just saw you posted again Ken. If you read further down the above post link ROVER3D mentions pressure
kenl
Posts: 153
Joined: Oct 19th, 2013, 8:50 am
Location: South Western Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by kenl »

Hi Ross, I've seen similar sites showing the $DBT output, but what I don't get is how to feed that into the Aurduino, never mind the programming. Some sites talked about converting the sentence to a serial feed, and there was something about 12v signals not being compatible. I would also need to buy the NMEA transducer, I have the paddle wheel and standard lowrance transducer though.

Do you think the proportional programming would work with a pressure gauge? I too thought there should be some sort of control over how often and hard the thrusters would try to correct. Just wish I could type out a quick example code like shorething or yourself do, to show the basic concept.

I feel like someone who knows some basic (say German) sitting in on a conversation where I can tell if they are talking about the weather or what's for dinner. But am completely unable to contribute short if smiling and nodding.
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Using NMEA 0183 or 2000 with an Arduino

Post by a_shorething »

@Rossrov: I just made that up. Was there another thread that had those terms in it?

I did refer to the board OPENROV was using, but I didn't get the idea from them, just knew they had pressure/temp and something else. Story of my life: I'm constantly inventing things that already exist.

@kenl: The board is something they designed and built themselves, you'd have to get it from them or build your own (it's open source). I think they sell it from their store.

For the proportional control Rossrov spoke of you can just check the difference between the desired and target depth and use that to add a 'little' or a lot, or maybe just use an amount that you've tested to be agreeable (20% throttle for 'autodepth' or something like that). I think you'd want to set a maximum throttle amount or use an adjustment factor to ensure you're never giving 100% throttle even if it's off by a lot.


One option:(using the same variables)

Void MaintainDepth()

set desired_presssure=read_pressure
Diff=(difference between absolute value of (read_pressure) and absolute value of (desired_pressure)) (however you code that)

{if (read_pressure)> desired_pressure; Upthruster(Diff*(adjustment_factor)))
if (read_pressure)<desired_pressure; downthruster(Diff**(adjustment_factor))
}

In this example the throttle input parameter you pass is proportional to the amount of difference between your current and desired depth. You'd be passing a parameter that is multiplied by an adjustment factor that is probably a decimal value so that at no point do you give it more 'gas' than 25% or 50% or something like that. If you make it
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by rossrov »

Ken: The NMEA has certainly changed a bit over the last few years. I found this article: http://boatprojects.blogspot.com.au/201 ... -0183.html
Find out from your sounders specs what sort of serial hardware interface (they are all serial) it is using, as going by the article there ar 3 or more different types. Unless your gear is pre version 2.0 , you will likely need some sort of interface between arduino and the sounder.

Pressure transducer would be much easier to interface (a couple of resistors and straight into the Arduino A to D), but that will track the surface not the bottom???

My memory for programming is pretty hopeless: I probably could never, not without alot of experience, type fluently, not even in BASIC, which apart from mucking around with Javascript a bit, is the only language I have done anything worth mentioning in. I hadn't done any C and got an Arduino less than a couple of months ago. So if I can do it......
I start off with a program that I have written or modified from someone else's example, and add/change one thing at a time, often referring to other bits of working code on the screen to jog my memory, and look to the Arduino language reference often.

a_shorething: Yes I kind of read through your post a bit quickly. BTW haven't seen or looked for any depth holding arrangements either. Re-inventing the wheel is to be encouraged in this area - a good way to learn :)
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Using NMEA 0183 or 2000 with an Arduino

Post by a_shorething »

@Rossrov:Agreed on deciding whether the goal is knowing distance from the bottom or distance from the top. He mentioned 'holding depth' so I offered the pressure sensor as an input. If he does want to know how far from the bottom (also a very good thing to know, especially in low vis) then we've got a different issue.

And BTW- I don't think my code would compile as-is in any known language, was just giving an example for logic purposes. I 'know' 3 or 4 languages, but if they weren't visual languages I would never get anything to compile correctly. If C#.NET tells me I forgot the semicolons from EVERY LINE I ADDED one more time I'm going to put a little coffee into the keyboard to tell it to remember that I have that habit. If you know there is a semicolon missing, put it in there your own self! Sheesh. :)
User avatar
Lomax
Posts: 21
Joined: Dec 3rd, 2013, 8:18 am
Location: Sussex, England

Re: Using NMEA 0183 or 2000 with an Arduino

Post by Lomax »

a_shorething wrote:a pressure sensor
That is only useful if either a) you want to cruise along some distance from the bottom or b) the bottom is perfectly flat. And even then, having a pressure sensor in no way eliminates the usefulness of a depth sounder - the difference is significant. A depth sounder will tell you how far your ROV is from the sea floor, while a pressure sensor will tell you how far it is from the surface - since one value cannot reliably be deduced from the other they are both pretty important bits of information.

In answer to the OP, NMEA 0183 has been reverse engineered and you should be able to find documentation of the protocol on the internet. IIRC even the Wikipedia article has some pretty detailed information on this. Basically, a NMEA 0183 device will send a plain ASCII message at a fixed interval, consisting of a device identifier and a value. The connection is serial 4800n8n1. It should be trivial to pick this up and extract the relevant number (which would be the distance to bottom value). This is what I intend to do for my ROV, and the idea of a "bottom tracking" mode is more interesting to me than a "depth tracking" mode - though one certainly doesn't exclude the other! If you want a NMEA 0183 transducer that also sends speed data, have a look at the Airmar P66 for example - it also does temperature. Price new is quite high but if you look around they're not that rare second hand.

As for NMEA 2000, I don't know if anyone has reverse engineered it, but the protocol is fundamentally different. My impression is that even with the documentation it would be more complicated to interface with a NMEA 2000 transducer than a 0183 one - and the benefit would be zero as you'd still just get a distance to bottom and/or speed value.
kenl
Posts: 153
Joined: Oct 19th, 2013, 8:50 am
Location: South Western Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by kenl »

Thank you Lomax,

I am slowly starting to get the idea here, I think where I am really stuck is how to pick up the signal in the first place. You say, serial 4800n8n1, that will at least give a point to start searching. I assume it is not a simple case of plugging the RX wire from the device into the Arduino and reading it.. Is it? I also have read there are voltage difference issues.

The P66 looks to be a standard transducer, but I get your point, the P39 is NMEA 0183.
Post Reply