Using NMEA 0183 or 2000 with an Arduino

Other than control. (Navigation, Sonar, Ect.)
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 »

@kenl,

If the voltages are different you can get a logic level converter.

I have found some for 3.3vdc<>5vdc (bi-directional)

The theory is this: It's specifically designed to deal with bi-directional serial communication (although in this case you only need one direction since you presumably won't be sending anything to the depth sensor) across a network or wires with two different logic levels.

Here is one from Adafruit that lets you connect 3.3vdc devices to 5vdc serial bus or vice versa:

http://www.adafruit.com/products/395

Here is another one, slightly different with different features (still not 12vdc though) I think this one does I2C but the previous doesn't. I'm not sure how you'd communication in the program with the protocol described above for a transducer.

http://www.adafruit.com/products/757

In that case you would (I think) connect the serial pair from the 12vdc device into the 12vdc logic side, and the lower voltage pair (TX/RX) to the side of your Arduino, Beaglebone, RaspPi or whatever.

You would have to power the devices separately and this would be the only connection between them.

There is a 'how-to' and help forum at Adafruit too. When I did a google search on '12v to 5v logic level converter' the second hit was pointing me back to the forum from Adafruit wherein they describe a way to use one of the ones above with resistors.
http://forums.adafruit.com/viewtopic.php?f=8&t=43642

HTH
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 »

kenl wrote: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.
Good point! However the NMEA standard signalling is not RS232 +/-12V but differential TTL level 5V/0/5V - I suppose you could just ditch the inverted comms line and hook the other straight to the Arduino Rx, but I'd recommend converting (and isolating) it using some chip (see attached datasheet for an example). Other than that, I think that yes, it should just be a matter of hooking up the transducer to one of the serial ports on the Arduino (the Mega has three IIRC) and initialising it at 4800 baud, no parity, 8 bits, no handshake and 1 stop bit. You'll need to have a function that listens for data on the chosen port and extracts the information you are after - what happens after that I don't know!
kenl wrote:The P66 looks to be a standard transducer, but I get your point, the P39 is NMEA 0183.
I'm pretty sure the P66 is also NMEA 0183, in fact I think pretty much all of Airmar's "P" series transducers are NMEA 0183.
Attachments
Ti SN75176 differential bus transciever.pdf
Ti SN75176 differential bus transciever datasheet
(511.99 KiB) Downloaded 405 times
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by rossrov »

Good call on that chip Lomax. I'd still like to try just using one of the outputs of the sounder if differential NMEA0183 and see what happens, especially if the chip was going to take a couple of days to arrive in the post. If the NMEA0183 output is RS232, then I'd be trying a diode and a couple of resistors. Arduino's software serial library can invert RXD apparently. Would not approve of such rough improvisation if I was say making a product to sell. http://arduino.cc/en/Reference/SoftwareSerial

Software serial will be handy (if not using an I2C interface like a_shorething mentioned) to listen to the attached NMEA0183 device so you see what your arduino is doing on the IDE's serial monitor. I have a UNO-like board that only has one UART (hardware serial port), but I think some other Arduinos have more. In end use the UART serial port would typically be used for surface comms.

Ken, my thoughts would be to stay away from NMEA2000 if possible for now. Also, don't forget that transducers may not be waterproof to the depth you want.
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 »

rossrov wrote:I'd still like to try just using one of the outputs of the sounder if differential NMEA0183 and see what happens
I'm sure it will work just fine, with RS422 differential signalling you basically have two copies of the data, one of which is inverted. This is to increase reliability over long cable runs and in noisy environments. Here's someone explaining it rather better than I can.
rossrov wrote:If the NMEA0183 output is RS232
It's not; NMEA 0183 uses differential 5V signalling, aka RS422. RS232 is +/-12V on a single wire, -12V meaning 1 and +12V meaning 0 - connecting this without voltage conversion would fry your Arduino in a jiffy. RS422 uses two wires with 5V (nominal) signal level, and sends an inverted signal down one of them. This is fortuitous as it means you could just grab the positive signal and connect it straight to the Rx pin of one of your Arduino's serial ports. It is not how you're supposed to do it (the data should be extracted by comparing with the inverted signal), but unless you have a lot of noise from your ESCs or some other source I'd be willing to bet you a couple of pints it will work just fine.
rossrov wrote:Also, don't forget that transducers may not be waterproof to the depth you want.
This is a very good point, though I fear the only way to find out is by trial and error - I doubt the manufacturer will have a maximum depth specification for the transducer, or that they would be willing to share it if they do (they won't want to open themselves to pressure damage warranty claims). Fortunately, loss of depth sounder data should not be a critical failure - but the risk that a failure will send 12V down the data line is significant, and another reason why that isolating chip is so important.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Using NMEA 0183 or 2000 with an Arduino

Post by rossrov »

Admittedly most NMEA0183 depth transducers are using RS422 these days, however the NMEA013 interfaces inside other items vary, so again, it is important to know details of the interface inside that specific device. Some even use "logic level RS232", which is like proper RS232 but goes from 0 to 5 volts.

Here is a transducer that actually sends NMEA0183 RS232: http://www.cruzpro.co.nz/active.html

No, was not suggesting connecting a regular RS232 output straight to the Arduino, but through diode and resistors, as stated. :?
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 »

rossrov wrote:No, was not suggesting connecting a regular RS232 output straight to the Arduino
And I never said you did - apologies if it sounded that way! I merely wanted to clarify the happy coincidence that NMEA 0183 devices (ok then, in most cases) use a 5V/0/5V differential signalling scheme, and not the symmetric (typically +/-12V) scheme of RS323, which means that the eager hacker (bodger) could connect a device straight into the Arduino for some quick messing around.

I am loath to be dragged into some pointless argument about the arcane intricacies of serial communication specifications, I really don't care all that much, but to dispel some of the confusion I think this quote from the NMEA FAQ located at www.kh-gps.de/nmea.faq might be useful:
The NMEA-0180 and 0182 standards say that the talker output may
be RS-232, or from a TTL buffer, capable of delivering 10 mA at
4 V. A sample circuit shows an open collector TTL buffer with a
680 ohm resistor to +12 V, and a diode to prevent the output
voltage from rising above +5.7 V.

NMEA-0183 accepts this, but recommends that the talker output
comply with EIA-422. This is a differential system, having two
signal lines, A and B. The voltages on the "A" line correspond
to those on the older TTL single wire, while the "B" voltages
are reversed (while "A" is at +5, "B" is at ground, and vice
versa)
Post Reply