How to Connect any NMEA-0183 Device to an Arduino
NMEA-0183 uses 12V signals to communicate with each other. The oldest instruments use RS-232, or a single wire that sends a high voltage followed by a low voltage, to indicate on or off. Newer NMEA-0183 devices us the RS-422 protocol, which uses two wires (a positive and a negative) that alternate between high and low to achieve the same effect, with greater accuracy and less chance for error. But the point is, both use 12 volts along their wires, and that will fry your Arduino if you plug it directly in.
EDIT 24 May, 2016: Apparently this is incorrect. 5V is the industry standard for RS-422, and 10V is the max voltage allowed for open circuits. See Max44's comments below the entry for more.
Recommended Gear
The following contain Amazon Affiliate links, which supports King Tide Sailing and keep this page ad-free.
- Any NMEA-0183 device (such as the Airmar DST-800 Thru-Hull Triducer Smart Sensor)
- Arduino Mega (or any other Arduino)
- An RS-232 to TTL converter or...
- An RS-422/485 to TTL converter (not sure which one you need? See the next section)
- USB-A Cable (for the Arduino)
- Jumper Cables
- Header Pins
- Soldering Iron (don't forget the actual solder)
- Nylon Screws to mount everything
- Something to mount it all to
NMEA-0183: RS-232 or RS-422 or RS-485?
This part is really easy. If you have a single transmit wire from your device (most likely labeled TX or NMEA OUT or something like that), then it uses the RS-232 protocol, and you need the respective converter. If your device has two wires coming out (typically labeled NMEA OUT+ and NMEA OUT- or TX+ or TX-), then you have RS-422. What about RS-485? For our purposes, it's the same thing as RS-422. The difference is that with 485, you can connect a bunch of different devices that can all talk to each other, which is cool and all, but not applicable for our NMEA device. For our purposes, treat RS-485 the same as RS-422, since the protocal is identical (just RS-485 can support a lot more devices than RS-422, like on the order of 80 or so more).
Wiring Diagrams for NMEA-0183 and Arduino devices
There are way too many converters out there to cover them all, but I'll cover a few here. You are basically looking at a simple system: the NMEA-0183 device sends a signal to the converter (either a single wire or two), and that tones the signal down to 3-5V for the Arduino, and pipes that signal out to the input on the Arduino itself. For the most part, you don't need power since most NMEA-1083 devices require 12V, something the Arduino can't put out. So here are a few examples:
SparkFun MAX3232 Wiring Diagram (for RS-232)
SparkFun MAX3232 Wiring Diagram (for RS-232)
NMEA-0183 | MAX3232 | ARDUINO |
---|---|---|
TX | T1 OUT | |
R1 OUT | Receive Pin |
SparkFun RS232 Shifter (No DB9) (for RS-232)
NMEA-0183 | RS-232 Shifter | ARDUINO |
---|---|---|
TX | Pin 2 (right next to the square hole) | |
TX-O | Receive Pin |
RS-422/485 Shifter
NMEA-0183 | RS-422/485 Shifter | ARDUINO |
---|---|---|
NMEA+ | B | |
NMEA- | A | |
VCC | 5V | |
GND | Ground | |
RE | Ground | |
RO | Receive Pin |
It also goes without saying that you need to ensure your device is powered through the boat's electrical system. Now that we have our device physically connected, let's work through the code.
My super hi-tech test bed |
The NMEA-0183 Arduino Library
Marten Laamer's has done a fantastic job building this useful and lightweight library. You'll need to download his library and check out his website over here first. There are hundreds of tutorials out there to get a GPS working (including some that come with the library), which is useful but pretty easy to figure out, so I'm going to show how to use his library to parse any NMEA sentence.
First, you must open up nmea.h and change this line
to this
First, you must open up nmea.h and change this line
#include "WConstants.h"
to this
#include "arduino.h"
Then open up nmea.cpp and change this line
to this
The most basic application is to receive an NMEA sentence, and then send it without doing anything. Here's a quick sketch for doing just that (remember, you must have the NMEA library included).
#include "WProgram.h"
to this
#include "arduino.h"
The most basic application is to receive an NMEA sentence, and then send it without doing anything. Here's a quick sketch for doing just that (remember, you must have the NMEA library included).
#include <nmea.h>
NMEA nmeaDecoder(ALL);
void setup() {
Serial.begin(4800);
Serial2.begin(4800);
}
void loop() {
if (Serial2.available()) { // if something is incoming through the Serial Port
if (nmeaDecoder.decode(Serial2.read())) { // if it's a valid NMEA sentence
Serial.println(nmeaDecoder.sentence()); // print it
}
}
}
Pretty boring and basic. Here's what the Serial Monitor output looks like. So if you connect this to your chart plotter, this is what it will see. If you connect more than one instrument, then just include each "If Serial is Available" loop for each appropriate Serial Port.
If you have no clue what's going on, this basically scans the Serial port that we plugged our converter into (the Receiver Pin in the wiring diagrams above). We're using Serial Port 2 as our input for my DST-800, which is using the RS-422 converter. If you are using an RS-232 device (with only one NMEA Transmit wire), then you actually have to get a little more fancy because the converter inverts your signal. So if you are using an RS-422 device, and you're not getting good output, then maybe just swap the A and B wires and try again.
But you can't just do that with an RS-232 signal, since there's only one wire. So what you have to do is use the Software Serial Library. Here's a sample sketch that uses an RS-232 NMEA-0183 device.
Note that this includes the SoftwareSerial Library. This is basically taking a Serial signal, and instead of plugging it into a Serial Port, we're plugging it into a digital pin and simulating a Serial Port. We have to do it this way because this is the only way to invert the Serial Signal on an Arduino. I suppose you could get another converter, and wire two of them together to invert the signal twice (ending with the original signal), but that's wholly unnecessary.
Something else to note with this is that I tried hooking up my wireless wind vane to it, but the signal kept getting garbled. Unfortunately, I don't know if it was the converter not doing it's job, or if it was the unit itself. It occasionally spat out a wind sentence, but it wasn't usable because it was one constant stream of meaningless characters interspersed with a valid sentence. I ended up returning the wind vane, and hopefully the next one works fine. But it DID put out valid sentences for the first week; so I know it works with the Max3232 converter.
But now let's get a little more complicated. Here's a sample sketch that parses the sentence, and allows you do manipulate it how you want. Then we reconstruct it as a valid sentence, including a checksum function. A huge thanks goes to Tom over at https://mechinations.wordpress.com/ for guiding me in the right direction for the sentence creation on an Arduino. I highly recommend you go over there to check out his cool stuff (especially this post).
And here's the output:
As you can see, we can extract different terms from the sentence quite easily, and manipulate them if need be (but be careful--if you don't redeclare each term, then it will reflect the previous sentence if the new sentence doesn't have one). For example, my DST-800 has a temperature sensor on it which gives out the YXMTW NMEA sentence, which is the Mean Temperature of the Water (the first two characters, "YX," are largely meaningless for NMEA-0183--they just designate the name of the device transmitting. You could put anything there and it would still work fine). A good place to start for NMEA sentences is this page here, and we see that the MTW sentence format is as follows:
And there it is! We have parsed the sentence, converted it to Fahrenheit, and then printed out a new NMEA sentence. Pretty simple, right?
If you have no clue what's going on, this basically scans the Serial port that we plugged our converter into (the Receiver Pin in the wiring diagrams above). We're using Serial Port 2 as our input for my DST-800, which is using the RS-422 converter. If you are using an RS-232 device (with only one NMEA Transmit wire), then you actually have to get a little more fancy because the converter inverts your signal. So if you are using an RS-422 device, and you're not getting good output, then maybe just swap the A and B wires and try again.
But you can't just do that with an RS-232 signal, since there's only one wire. So what you have to do is use the Software Serial Library. Here's a sample sketch that uses an RS-232 NMEA-0183 device.
#include <SoftwareSerial.h>
#include <nmea.h>
SoftwareSerial nmeaSerial(10,11,true); // RX pin, TX pin (not used), and true means we invert the signal
NMEA nmeaDecoder(ALL);
void setup()
{
Serial.begin(4800);
nmeaSerial.begin(4800);
}
void loop()
{
if (nmeaSerial.available() > 0 ) {
if (nmeaDecoder.decode(nmeaSerial.read())) {
Serial.println(nmeaDecoder.sentence());
}
}
}
Note that this includes the SoftwareSerial Library. This is basically taking a Serial signal, and instead of plugging it into a Serial Port, we're plugging it into a digital pin and simulating a Serial Port. We have to do it this way because this is the only way to invert the Serial Signal on an Arduino. I suppose you could get another converter, and wire two of them together to invert the signal twice (ending with the original signal), but that's wholly unnecessary.
Something else to note with this is that I tried hooking up my wireless wind vane to it, but the signal kept getting garbled. Unfortunately, I don't know if it was the converter not doing it's job, or if it was the unit itself. It occasionally spat out a wind sentence, but it wasn't usable because it was one constant stream of meaningless characters interspersed with a valid sentence. I ended up returning the wind vane, and hopefully the next one works fine. But it DID put out valid sentences for the first week; so I know it works with the Max3232 converter.
But now let's get a little more complicated. Here's a sample sketch that parses the sentence, and allows you do manipulate it how you want. Then we reconstruct it as a valid sentence, including a checksum function. A huge thanks goes to Tom over at https://mechinations.wordpress.com/ for guiding me in the right direction for the sentence creation on an Arduino. I highly recommend you go over there to check out his cool stuff (especially this post).
#include <nmea.h>
NMEA nmeaDecoder(ALL);
void setup() {
Serial.begin(4800);
Serial2.begin(4800);
}
void loop() {
if (Serial2.available()) {
if (nmeaDecoder.decode(Serial2.read())) { // if we get a valid NMEA sentence
Serial.println(nmeaDecoder.sentence());
char* t0 = nmeaDecoder.term(0);
char* t1 = nmeaDecoder.term(1);
char* t2 = nmeaDecoder.term(2);
char* t3 = nmeaDecoder.term(3);
char* t4 = nmeaDecoder.term(4);
char* t5 = nmeaDecoder.term(5);
char* t6 = nmeaDecoder.term(6);
char* t7 = nmeaDecoder.term(7);
char* t8 = nmeaDecoder.term(8);
char* t9 = nmeaDecoder.term(9);
Serial.print("Term 0: ");
Serial.println(t0);
Serial.print("Term 1: ");
Serial.println(t1);
Serial.print("Term 2: ");
Serial.println(t2);
Serial.print("Term 3: ");
Serial.println(t3);
Serial.print("Term 4: ");
Serial.println(t4);
Serial.print("Term 5: ");
Serial.println(t5);
Serial.print("Term 6: ");
Serial.println(t6);
Serial.print("Term 7: ");
Serial.println(t7);
Serial.print("Term 8: ");
Serial.println(t8);
Serial.print("Term 9: ");
Serial.println(t9);
Serial.println("--------");
}
}
}
And here's the output:
As you can see, we can extract different terms from the sentence quite easily, and manipulate them if need be (but be careful--if you don't redeclare each term, then it will reflect the previous sentence if the new sentence doesn't have one). For example, my DST-800 has a temperature sensor on it which gives out the YXMTW NMEA sentence, which is the Mean Temperature of the Water (the first two characters, "YX," are largely meaningless for NMEA-0183--they just designate the name of the device transmitting. You could put anything there and it would still work fine). A good place to start for NMEA sentences is this page here, and we see that the MTW sentence format is as follows:
1 2 3
| | |
$--MTW,x.x,C*hh
1. Temperature
2. Units
3. Checksum
In order to print our own NMEA sentence, we will also need the PString Library available over here. Let's go ahead and change that Fahrenheit, with the following sketch:
#include <PString.h>
#include <nmea.h>
NMEA nmeaDecoder(ALL);
void setup() {
Serial.begin(4800);
Serial2.begin(4800);
}
// calculate checksum function (thanks to https://mechinations.wordpress.com)
byte checksum(char* str)
{
byte cs = 0;
for (unsigned int n = 1; n < strlen(str) - 1; n++)
{
cs ^= str[n];
}
return cs;
}
void loop() {
if (Serial2.available()) {
if (nmeaDecoder.decode(Serial2.read())) {
char* title = nmeaDecoder.term(0);
if (strcmp(title,"YXMTW") == 0) { // only run the following code if the incoming sentence is MTW
Serial.println(nmeaDecoder.sentence()); // prints the original in Celsius
float degc = atof(nmeaDecoder.term(1)); // declares a float from a string
float degf = degc*1.8+32; // and converts it to F
// Time to assemble the sentence
char mtwSentence [18]; // the MTW sentence can be up to 18 characters long
byte cst;
PString strt(mtwSentence, sizeof(mtwSentence));
strt.print("$YXMTW,");
strt.print(degf);
strt.print(",F*");
cst = checksum(mtwSentence);
if (cst < 0x10) strt.print('0'); // Arduino prints 0x007 as 7, 0x02B as 2B, so we add it now
strt.print(cst, HEX);
Serial.println(mtwSentence);
}
}
}
}
Would you know whether the TTL/RS232 conversion and signal inversion can be done with an opto-isolator? I'm using an Arduino Due for multiplexing N0183 and that is limited to 3.3v so was going to use an o/i to ensure the voltages on the Due side are kept below that value, whereas typical network signal voltages are - i think - about 5v.
ReplyDeleteThe o/i inverts the signal anyway (no need then for Softwareserial) and I assume the change of voltage (upwards when outputting multiplexed signal back to 0183 network from Due) will be readable by network?
I do not know. However, I do know that any of those standard converters that I linked to above step down the voltage from +/-12 to TTL levels (I think +/- 3v).
DeleteI have also connected my depth sounder directly to a Serial Port on the Arduino Mega, and it read it no problem. That's kind of dangerous, though... my depth sounder, even though it outputs it's NMEA signal at RS-422 levels (+/-12V), actually only output signals at up to +/- 5V (I connected the lines to a voltmeter), and thus the RS-422 to TTL converter wasn't necessary. But that may have just been a one time fluke, so I got the converter above just in case. Otherwise I'd have to buy a new Arduino.
But to answer your question... I don't actually know what an opto-isolator is. But I do believe all you have to do is step the overall voltage down--the actual signal itself should remain the same.
I'm currently working with a NAVMAN Depth 3100 and a standard through hull transducer.
DeleteThe NAVMAN has a NMEA output (single wire).
I'm going to try to get the information from this to my Arduino.
But:
Is there a way to directly connect the transducer to the Arduino?
Hello all I am missing something that i haven't understand about Nmea 2000,
Delete1 Can L
2 Can H
3 shield
4 GND
5 vcc12 volt.
Is all nmea devices signal is 5 volt or can they be 12 volt like i have seen on the web.
if 12 volt how to manage the signal.
Hi sir, would you give me schematic of Arduino to RS485 and RS485 to Airmar DST800. I have do try it but it didn't give me serial output in my Arduino Serial Monitor. By the way, I used Arduino Mega 2560. Thank you.
ReplyDeleteI have it connected exactly as in the table in the blog post, using this RS-422/485 Shifter (http://amzn.to/1M4WSso). DST800+ to ShifterB, DST800 to ShifterA. Then I have the ShifterVCC to Arduino5V, the Ground to Ground (obviously, nothing special here). Then I ALSO have ShifterRE to ArduinoGround, and then finally the ShifterRO to the ArduinoRx pin, whichever port you use.
DeleteI have buy 485 shifter. After I wire it with my Arduino, seems like on your blog, my 485 shifter getting warm. I don't know why, so I decide to buy a MAX485 IC. But it still won't show on my Serial Monitor. Do you know why is it? By the way, what version of your Arduino IDE and how about supply for DST800? Is it 12V, higher or lower? Thank you. Please help me.
DeleteThis is my email: novitiyono.54@gmail.com
The DST-800 is powered by 12v. I'm not sure what else could be happening. You may want to read the comments in this post here: http://kingtidesailing.blogspot.com/2015/10/the-king-tide-sailing-arduino-nmea-0183.html
DeleteAlso, I no longer use the Arduino. I use a Raspberry Pi now, which I think is better and cheaper.
Last night I try to see the data and it show. But only one time. I think I have a problem with the circuit. The program is OK. Thank you very much
DeleteI have it connected exactly as in the table in the blog post, using this RS-422/485 Shifter (http://amzn.to/1M4WSso). DST800+ to ShifterB, DST800 to ShifterA. Then I have the ShifterVCC to Arduino5V, the Ground to Ground (obviously, nothing special here). Then I ALSO have ShifterRE to ArduinoGround, and then finally the ShifterRO to the ArduinoRx pin, whichever port you use.
ReplyDeleteI use an oscilloscope, and the signal from my IC came out. But my serial monitor still won't show the data. I think I have a problem with my program. I have download NMEA library and change it.
DeleteHi, I found your site and think it is fantastic. I would like to use your Arduino programming to control a 12V winch so that the depth information from the transducer will be sent to the Arduino which in turn will raise or lower the winch so that I can keep the terminal end of the winch the same distance from the bottom. Do you think your coding will work for this? I have no computer skills so I'm relying on talented folks like yourself to guide me. On a related note, I keep having difficulty returning to your post "Connect Any NMEA 0183 to an Arduino". I see it for a second then I get redirected to your Raspberry Pi post. Any help with my project would be greatly appreciated. Cheers, Mark
ReplyDeleteI think that's a fantastic idea! I was working on figuring my next project, and I think this is a good way for me to spend more time with the boat. Though I'm not sure how to implement it, you'd need some sort of rotational sensor on your winch that would tick up every rotation, and then you'd know (by the diameter of the winch) how much line has gone down, and how much has wound up.
DeleteSo yes, this code would work for that application. But I'm not sure how to implement it. Probably a hall effect sensor installed NEXT to the winch, with a magnet on the winch itself. Something along those lines. And then it would keep track of how much line has gone out by writing that number to the EEPROM data on the Arduino. Whew, this is already beyond my capabilities.
And try the new layout. I hated the other one, and I kind of hate this one, but at least it works.
Thanks for getting back to me. The new layout is working better. It just seemed to be some sort of bug as I could get in but not every time. What are the chances you are on the Weest Coast of Canada as your blog URL is .ca? I would love to give you way more detail in an email if that is possible? Im happy to share it with others but too much for a blog post. my coordinates are: the4thzeke'at'gmail.... Send me a PM if that works for you? If not we can toggle back and forth here.
DeleteNope, I'm in California. I think google automatically changes the url to your country you're viewing in.
DeleteI'd prefer to keep everything in the comments, so as to help anyone else who is looking. That's actually how I figured out the DST-800 to Arduino--it was from a comments section.
Not a problem I'm up north in Vancouver. What I am doing is working on linking my sounder to my downrigger for fishing near the bottom The downrigger will need to raise and lower with the contour of the bottom. Im pretty good woth mechanicalthings but hopeless with writing code as Im over 50 years old! The plan is to use the Arduino to control the downrigger, a linear actuator, a optical?? counter and hopefully a IR remote. Pretty ambitious - I know - but fun to build. Thestumbling block for me was getting the depth info into the Arduino (as well as all the other coding) so I have been watching hour after hour of YouTube to try and learn this stuff Im open to any help others can provide and gain from this.
DeleteMy last sentence was supposed to be "and have others gain from this". So other people can do the same based on what I can piece together.
DeleteThat's a pretty clever implementation of this. I do not know exactly how to do it, but I'd start with this. Get the Arduino code from some example somewhere to control a motor, and adapt that to control your winch motor somehow. Then once you've that figured out, figure out how to measure how much line is out on the winch using two hall effect sensors (or a paddle wheel?) so you can know if it's extending line or retracting line. THEN incorporate the above code to tell it how far to extend or retract the line.
DeleteI'm sure you already figured out that's the direction you should go, but that's about all I can do for you.
This may be a little late as i have only just seen this link.
DeleteAn anchor winch controller is somethinig i am working on. You will need a reed switch or hall effect device. I am using a micro reed for r&d. Pull up resistor and input diode protection to filter transients and clamp voltage. I am trying differens display types due to bright outdoor lighting, including 8x8 led matrix.
I am using a high current relay for the up and down control. When i get the pulses from the reed, i check to see if the up or down button is being pressed, in order to work out the direction..ie..adding or subtracting. To get the ammount of chain calculation, i am using Pi function and some math, in order to work out how much chain per click on the reed switch. Its not hard at all. I am just making a standalone unit to i can singlehand my liveaboard in Australia. Sorting out NMEA standard is a harder item i am trying to learn. So much miss information on the net. My chain counter is standalone. The NMEA is for my wind speed and direction home made unit. Converting all to WiFi so i can feed data into my navionix app on my android TAB. Also for kpen pn on my tablet. Marine electro ics is so expensive and plays of lack of players in the market. I am developing a range of products for the retired persons cruiser market. Wind speed $1000 upwards, chain counter $450 upwards...what a joke.
I was looking more for a "is this possile or not " so I don't waste many more hours learning code for something that is impossible. I think your work with the sounder already gave me the confidence to try it so I cant thank you enough. I will update you as I make progress. Thanks for being my launching pad!
ReplyDeleteOh yeah, it's definitely possible. Keep me updated on your progress!
DeleteHi Connor! Is there any chance you know why I would be getting the following error when I run the program " "Serial2 was not declared in this scope'. I am stumped. Im wondering if it is because you used an older IDE? Any help would be greatly appreciated.
ReplyDeleteMe again, After working on this for most of the night I think I have solved the issue - the Uno does not accept a Serial2 but the Mega does. I'll test this theory later today and let you know.
ReplyDeleteYes, you are correct. I believe the Uno only has one serial port, hence there is no Serial2 available to connect to.
DeleteI read your posts with lots of interest. I'm looking to make a device that gives direct nmea input to my autopilot computer. Am I correct this setup wil not work since there wil not be a 12v NMEA output?
ReplyDeleteI believe it should work. All you have to do is follow this guide in reverse--instead of receiving NMEA data from the serial port (like I have described above), all you have to do is print to the serial port. I don't know if it could be bi-directional though. But it will output at 12V for NMEA instruments no problem.
DeleteThis comment has been removed by the author.
ReplyDeleteThanks for the knowledge. Like I mentioned above, I really don't know what I'm doing--most of this info I pulled from various places around the web. 5V being the standard level makes sense then, since when I plugged my depth sounder directly into the Serial Port, it didn't fry it. Also, the 485 converter I linked to above--I believe that's the max485 chip, is that the one you're referring to?
DeleteYou are correct. Most of the informatiin on the web does say 12 volt. Seatalk (version 1) is 12volt. RS 232 is +-12volt. The correct IEEE standard for RS485 is 5 volt. What fully complient NMEA standards say the input and output...talker or listeners are to be opto isolated. Most RS485 converters have a resistor and zenner diode over voltage protection circuit on the input and output. This is what has stopped your devices from blowing up. In saying this, even some manufacturers use serial/RS232 at five or twelve volts. I worked for years as an RandD enguneer in industrial electronics. RS485 and fibre optics was a common design for us. This is why i know the standard so well. Its great w all share information even if some of it, i suspect, has been put on the web as disinformation by those not wishing to allow end users to make thier own devices. Thanks for sharing guys.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi, I was wondering if you could please help. I am trying the first sketch with a lowrance dsi transducer. I bought the same RS485>TTL shield and did the wiring as above, but nothing is being received. From the pinout for the transducer it seems there is XDR+/XDR- & XDR Shield. Should the Shield be connected to ground?
ReplyDeleteThis blog gave me inspiration to try this, feeling a bit frustrated as it looked pretty easy :)
Cheers!
Ok follow up, i connected directly to the com port 1 of the fish finder it was reading the data successfully! So my wiring for coms etc is fine.
DeleteMy issue seems to be there is no power on the transducer without the chartplotter connected. Without cutting the cable, how can I get power to the transducer?
The pinout: http://65.38.22.198/Lowrance/Images/DSI-pwr-pinout.jpg
Can i somehow short it or is it actually not getting any power?
It's not too difficult, fortunately. I'm doing the same thing but with a Furuno RD30 display unit, though mine came with no cord. After a few trial and error attempts, I figured out which pins are which on the unit. To my luck (and probably yours too), the jumper cables I use fit perfectly onto the pins.
DeleteI'm talking about these (http://amzn.to/1TYkUew) and I'm guessing if you take the male/pin end, it will fit just fine into the cord. For me, I'm using the female end of the jumper cable to fit over the pins.
You can, of course, short it by touching the Batt+ and Batt- wires together. As far as the shield, you can ignore that (I think...). As far as I understand, the shield is just there to create a sort of magnetic shield field around the cord so that other cords or magnets don't change the voltage in the wires (if you recall from physics, any electricity moving through wires generates a magnetic field... and a magnetic field can generate voltage in those wires). So you can safely cut that shield and not worry about connecting it to anything.
However, you will have to connect the Batt+ and Batt- to the respective battery terminals. Let me know if this helps.
Hi Connor,
ReplyDeleteThanks for getting back to me, I actually want to try power the transducer without connecting it to the fishfinder. I the lowrance power cord runs next to the data lines and meet at the lug which I posted earlier with the pinout. I though initially it did get power, but doesn't seem to be the case.
Any suggestions without having to cut open the data lines to see where the power returns?
Cheers
Can you post model numbers so I can have a better idea? It sounds like you three components: the Fishfinder (the display, right?), the transducer in the water, and the cord which you posted that connects the fishfinder to the actual transducer. Is that right? And where does the Arduino fit into this setup?
DeleteHi Connor,
ReplyDeleteIt is the Elite 4-Dsi.
So the transducer and the power cord are attached to each other, but they only meet at the plug which connects to the display. Only when I turn on the display, the transducer starts "ticking". I want to connect the arduino directly to the transducer, without using the display or having it attached. I assumed in your initial post you had the same setup, the arduino directly connected to the transducer?
Here is an image of what I mean, not the same model, but the same cable less a few data lines
http://www.panbo.com/assets_c/2015/04/Digital_Yacht_Sonar_Server_Lowrance_Elite4_wiring_diagram_aPanbo-11193.html
From your picture it seems your transducer could be powered directly, somehow I should be able to do the same
Oh, I see what you're saying. I'm not really sure how to implement that without cutting the cable... I think the best way is the same way I have mine... in that I cut the cable that is directly attached to the transducer, and connected the appropriate wires (Batt+/-, NMEA+/-, and a Shield, although I don't have the shield connected to anything. Just the Batt and the NMEA).
DeleteI didn't want to cut as it would mean it is a permanent installation, but maybe it is a good time to tell the wife I need a new unit :)
DeleteI will keep you posted, planning to get two Arduinos to send/read the data via RF.
Cheers
Ok, feedback again. I cut my friends old humminbird and only discovered two wires and a bare wire. A quick google and I found this pinout, last picture on the first page:
Deletehttp://www.crappie.com/crappie/fishing-electronics-and-photography/113856-quick-humminbird/
Seems no power cables run into the transducer?
This comment has been removed by the author.
ReplyDeleteHi, very interesting tutorial but is this also applicable to Airmar B122 Smart™ Sensor? I was hoping to use this sensor to measure the depth of a river.
ReplyDeleteI plan to connect the sensor to the arduino and monitor the measurements through the Arduino IDE in my laptop.
Yes, that will work. Just make sure you have the NMEA-0183 version of the B122. The NMEA-0183 version is this:
DeleteFuruno NMEA 0183—235DHT-LMSE——Airmar—44-082-1-01
The NMEA-2000 version is this:
Furuno NMEA 2000®—235-MSLF——Airmar—44-151-1-02
However, I'm not too familiar with the wires on this one. If there are two NMEA output wires, you're in luck, because it'll work very well per above. If there's only one NMEA output wire, then it'll still work, but it'll be much more prone to errors and you'll have to follow the RS-232 section above.
Also keep in mind that you'll only have these sentences:
$SDDBT - Depth
$SDDPT - Depth
$YXMTW - Water Temperature
I see, I changed my mind, I'll also just use Airmar DST-800 since you already tested it.
DeleteDid you try measuring the depth of a water? in your code, your output is the temperature, how can I make it output the measured depth in meters?
I only recommend getting the DST800 over the B122 if you want the paddle wheel as well. It'll probably be cheaper and less complicated, but in any case, they'll work the same with the same code. Just be sure to get the NMEA-0183 version of the DST-800:
DeleteManufacturer Part Numbers—NMEA 0183
Furuno Plastic—235DST-PSE——Airmar—44-072-1-41
Furuno Bronze—235DST-MSE——Airmar—44-072-1-51
Garmin—010-11051-10——44-072-2-01
And then you just have to change the void loop() section above to read this:
void loop()
if (Serial2.available() > 0 ) {
if (nmeaDecoder.decode(Serial2.read())) {
char* title = nmeaDecoder.term(0);
if (strcmp(title,"SDDPT") == 0) {
char dptSentence [22];
byte csd;
PString strd(dptSentence, sizeof(dptSentence));
strd.print("$SDDPT,");
strd.print(nmeaDecoder.term_decimal(1));
strd.print(",");
strd.print(!!TDO!!);
strd.print("*");
csd = checksum(dptSentence);
if (csd < 0x10) strd.print('0');
strd.print(csd, HEX);
Serial.println(dptSentence);
}
}
and replace
!!TDO!!
with your transducer offset in meters (if it's .5 meters from the waterline, put .5 but if it's .5 meters from the keel, put -.5). Also please note that this may not be formatted correctly since I just copied/pasted from my other post here:
http://kingtidesailing.blogspot.com/2015/10/the-king-tide-sailing-arduino-nmea-0183.html
Let me know how it works.
Do I really need to be in a boat to use this sensor? because i only want to mount the device on a pole and dip it underwater for it to measure the river depth. My problem is the power supply since there are no outlets outside, will ordinary 12v batteries work?
Deletehttp://ep.yimg.com/ca/I/theshorelinemarket_2424_694957635
The reason why I plan to use Airmar DST800 is because it works underwater and also compatible with Arduino. Ultrasonic sensors like HC-SR04 or Maxbotix only works in air thus it wont read well in Water.
You absolutely don't need to use a boat. I stuck mine in a bucket of water when I was making this code, but it actually works fine out of water too. But yes you can just stick it on a pole and stick that in the water and it'll work fine, although you'll want to change the code to this:
ReplyDeletevoid loop()
if (Serial2.available() > 0 ) {
if (nmeaDecoder.decode(Serial2.read())) {
char* title = nmeaDecoder.term(0);
if (strcmp(title,"SDDBT") == 0) {
Serial.println(nmeaDecoder.sentence());
}
}
}
That will output this sentence:
DBT - Depth below transducer
$--DBT,x.x,f,x.x,M,x.x,F*hh
Which gives depth in:
f = feet
M = meters
F = Fathoms
again, I haven't debugged that code, so it might not work quite correctly. Try it out and let me know.
As far as that 12V battery goes, I think it'll work okay, but it probably won't last very long. If it doesn't work, you'd probably want to attach it to your car battery and set it up until it does work so at least you know the DST and code works fine.
Thanks a lot, i want to try it out but i don't have a sensor yet.
DeleteIs this sensor the same as yours? http://www.imarineusa.com/AirmarDST800PV-S.aspx
Ive been looking around the net and some DST800 have a different cable than yours. I mean your cable have 5 colored wires while some DST800 on the net have a connector plug. Like this one http://rcdn-1.fishpond.co.nz/0042/420/866/147901665/6.jpeg
Negative, that sensor you linked to is the NMEA-2000 version, which will not work. (the NMEA-2000 Manufacturer Part Number is 44-072-2-02, while the NMEA-0183 Manufacturer Part Number is 44-072-2-01.
DeleteAlso no worries about that plug... you just cut the cord and now you have the wires!
Oh I see, how about this one?
Deletehttp://www.p2marine.com/catalog/product_info.php?products_id=17612
Just to be sure.
Yes, that appears to be the compatible NMEA-0183 version.
DeleteI didn't use any commercial level converter to hookup my Garmin Etrex Vista to the arduino pin 10 configured as serial RX input. I connected ground and the signal via a simple voltage :2 divider by cutting the 6-7 volts signal in half through 2 x 10 k-ohms resistors. Works neat and is pretty cheap !
ReplyDeleteit outputs $ GPRMB,GPRMC, PGRME, PGRMZ, PGRMM all fine!
DeleteLowrance MArk-4 :
ReplyDeleteit took me 2 days to figure out how NMEA is arranged at this cheap fishfinder. Actually, at power & skimmer-side, the XDCR-cable is talking RS-422, in & out, which I couldn't directly bring to my Arduino without symmetrical voltage to asymatric level convertors I haven't got right now.
But bringing the Mark-4 into advanced mode setting, it lets you configure the extra 4-pins speed/temp connector into a NMEA-0183 TX & RX port. I just managed to get it to talk @4800 baud to my Uno with my simple 2-resistor voltage-divider !
DeleteNow all I need to find is a Lowrance NMEA-cable with a plug on one side which can be soldered to the Arduino ports, because I used some primitive wiring to hook it up! Looks like http://www.gpscity.com/lowrance-nmea-0183-adapter-cable.html is the right one but I think it's a bit expensive, plus, on the shop comments page a user reported thwo hidden diodes of which one was soldered backwards ?!
Anyone getting a better alternative, like the connector alone ?
... and yes, indeed, now we're talking RS-232 and I'm getting plenty of phrases: $ GPGLL, GPGSV, GPRMC, GPAPB, GPBWC, and even exactly what I was looking to get: $ SDDBT, SDMTW and SDDPT so I can finally have depth and water temperature logged in function of gps-readings...
Delete(it's good to know that this is the only way to output depth data, since on the Mark-4, the tracklog neither the waypoints provide enough info to be used as depth logs!)
Hi V-King, could you perhaps help me out regarding the symmetrical voltage to asymmetric level converters, required to link the lowrance transducer directly? My whole idea was to make my lowrance wireless, but after discovering that it is not that simple to get the transducer firing standalone, I gave up.
Deletehi George,
DeleteIf you've got symmetrical voltages (so you're talking RS-422 or RS-485), I recommend using standard RS-... to TTL converters. Grounding the negative terminal of the transducer's TX- port running down to -15 volts) might shortcircuit its output chips, so it's not recommended. The right converter board for your wireless/zigb/arduino is pretty cheap, usually not more than a few bucks. Like this one: http://yourduino.com/sunshop2/index.php?l=product_detail&p=323 used in this example: https://arduino-info.wikispaces.com/SoftwareSerialRS485Example
Good luck !
BTW: I received my Lowrance NMEA NDC-4 cable from http://www.nootica.fr/cable-de-liaison-nmea-0183-lowrance-pour-elite-mark.html
DeleteI can confirm what I've heard about it: indeed, it's got a hidden diode shrinkwrapped on the yellow (TX>RX)-line at the loose-cable end (I didn't cut the connector apart, but I'm sure the 2nd one will be soldered there between GND and the RX<TX line!).
But this should be no problem at all: the reason the diodes are 'soldered backwards' is simply because they are protecting the data-lines against reverse polarity. However, I remarked a slight voltage drop in the output of my new cable, and therefore I had to adapt my voltage divider to 8.2 Kohms over 12 Kohms because the NMEA-signal picked up by my Arduino was slightly under-voltaged to get a clean input. All is working fine, even without cutting the diodes away (as some webpages on this NDC-4 cable might suggest).
The best solution is on the way: I've ordered a few RS-232 to TTL converters, so there will be no more need to experiment with voltage dividers as the Max-232 series chips are intelligent enough to cope with voltage levels! http://fr.aliexpress.com/item/RS232-To-TTL-Converter-Module-MAX3232CPE-MAX232-Transfer-Chip-Serial-Port-232-to-TTL-Communication-Module/1873008503.html?isOrigTitle=true
Hi V-King, I see your first post is exactly what I also got working some time ago. I was under the impression you had managed to connect the transducer directly to the Arduino. Have you explored that option?
DeleteHi,
ReplyDeleteit's can work with this transducer hummlinbird [url]http://www.navicom.fr/plaisance/sondeurs/accessoire-sondeurs/sondes/sonde-tableau-arriere-temp-tous-modeles-sauf-quadri-3d-si#panel-features[/url].
i would like to connect to android with arduino !
well done !
thank
Hi Philippe,
DeleteNice transducers, I think you could get them to talk to Arduino with the right coding.
But I was lucky enough to buy a new Mark-4 at decathlon for the price of only the transducer:)
Good luck & keep us informed. I'll try to find some code for you.
Re Finalement je viens de m'apercevoir que mon sondeur à une sortie nmea0183. Je vais donc m'orienter vers un multiplexeur wifi. Sais-tu si je dois utiliser le module RS-485, j'ai 3 fils ?
DeleteIts an international site. English pls :)
DeletePhilippe: Parfois, pour RS485 il y a un NMEA + , NMEA - , et une masse, mais vous ne devez pas connecter le sol à quoi que ce soit. Je suis désolé pour mon mauvais français, je suis en utilisant Google Translate.
Deletehi Philippe,
Deleteif your sounder has an NMEA-0183 output, and you have only 3 wires, the shield goes to ground (écran ou noir = masse); the yellow or blue is TX so goes to the Receive(RX) or Data-input of your module; orange or green is RX so goes to the Send(TX)or Data-output of your module.
If you are sure it talks RS-422 (or RS485) then normally, there should be 4 or 5 wires (s'il n'y a pas 4 ou 5 fils, peu de chance que c'est du RS-422 ou 485)
This comment has been removed by the author.
ReplyDeleteHi, what software do you recommend me to use to create a depth map, since dr. depth is not available anymore?
ReplyDeleteI've thought about this before, and I think it would be really cool to make a plugin for OpenCPN to do this. However, I don't know enough coding to do that.
DeleteBut perhaps you can start here and this will give you somewhere to look?
https://www.robotshop.com/letsmakerobots/sea-rendering?page=4
I'm using matlab, but it is very difficult to orient any kind of maps. I also have a copy of ARGIS on my computer, but again, it likes to freak out at scatter data instead of matrix data. There is also QGIS which is free! Kinda steep learning curve as well though. Everything else seems like you have to pay a boatload of money for it.
DeleteThis comment has been removed by the author.
ReplyDeleteI have no idea why it didn't work, and now I have no idea why it does.
ReplyDeleteI have a DT800, the RS485 converter that was linked, and an arduino Uno. I hooked up everything to a GPS I have and a serial line was being printed no problem, then trying to hook up to the transducer, and nada. A combination of pulling cables here and inserting cables there, I got lines to finally display, here is what I had to do.
RS485
A <=> NMEA+
B <=> NMEA- AND my TX pin of the arduino!
VCC <=> 5V
gnd <=> ground
RO <=> RX pin of arduino
RE <=> Grnd of arduino
Now this initially didn't work, UNTIL, I unplugged the ground from the ground terminal on the RS485 leaving the RE ground connected. Then serial lines started displaying
$SDDPT,44.3,*4A
$SDDBT,147.7,f,44.3,M,24.6,F*00
$YXMTW,32.5,C*16
I have to plug them in and unplug them in the right order, or else I don't get anything. If I just hook up the RX and TX to NMEA+ and - respectively, I only get MTW and DBT, but not DPT...No idea why. So confused. Maybe there is a capacitor on there that needs to be charged up, then the ground needs to be taken away?
What are you using to display this output? This makes me suspect that perhaps there's an issue there, because I had an issue where it wouldn't display the last sentence of the whole sequence because it didn't have the "/r/n" correct at the end of the last line of the last sentence.
DeleteGraceful written content on this blog is really useful for everyone same as I got to know. Difficult to locate relevant and useful informative blog as I found this one to get more knowledge but this is really a nice one.
ReplyDeleteliycy
Thank you! It's been a while since I've tinkered with the boat, I'm looking at making some additions soon.
DeleteThis comment has been removed by the author.
ReplyDeleteDear Sir!
ReplyDeletei try do the same: connect Mega R3 and Honda Electronic TD28 , 50/200 kHz ( 3 -wire, not include Vcc and 0 wires) via MAX485. It not work. Help me. Thanks and best regards
Very nice and usuful tutorial, I'm very new and I'm reading many articles, so I was wondering if arduino can not only receive signals but also send too through NMEA 0183 devices. In particular is it possible to send to a ST2000 Tiller Pilots?
ReplyDeleteThanks
Antonio
Hello, I'm currently working on a similar project with a raspberry Pi and an Arduino. Unfortunately my old equipment (NASA speedlog LOG-77A and NASA echosounder Target2 sounder) communicate to the CDU with a coaxial cable (3C-2V 75ohms). Would it be possible to connect those coaxial to the Arduino? I couldn't find much info about that on the web. Ant help would be much appreciated. Thanks, Jeremy.
ReplyDeleteHi. Not sure if you are still following this thread but I'd appreciate any help you can give. On my boat I am trying to interface a new NASA Clipper Wind Sensor to my Arduino/Amica Node ESP3266. I have tried and tried (lost count of the time) to make this work but no joy. I purchased this ( https://www.amazon.com/Serial-Converter-Equipment-Upgrades-Doupont/dp/B01N42QW8X/ref=pd_sim_147_5/132-3251838-1444428) Serial <--> TTL converter to take the 12v-powered RS422 NMEA stream from the wind sensor to the Node but cannot seem to get a valid signal through the wires. The RCV LED lights indicating a signal passing to the converter, but nothing valid seems to flow from there. I've tried other sensor sources including GPS so I know my micro-controller and associated code (from this article) is ok. I suspect I am missing something in the multiple ground connections or a mismatch between the 12V that powers the wind sensor and the 3.3V that powers the Node (these are separate power supplies of course.) Also tried on the Arduino Mega with same results. Any help or tricks to make this work appreciated!
ReplyDeleteHi Matthew, there is an NMEA 422 output on the new(er) models which has 2 wires - D+ and D- (and ground of course.) I can see the data on my RPI using a USB-Serial adapter, but just can't seem to get it to my Arduino. Thanks!
DeleteOk, working now. Not sure why Software Serial is not working with my ESP3266 devices (Amica Node, Adafruit Huzzah), but I switched to HW serial and things are working well. Thanks for the great projects and inspiration on your site.
DeleteJust a quick update which might be helpful for those working with ESPs. I have reverted back to Software Serial due to better compatibility with the ESP environment (ie, 3.3V) and discovered that success seems highly dependent on which TTL converter one uses. I was able to make my NASA Clipper wind sensor work well with the ESP8266 Node MCU by using this RS232-TTL converter: DROK TTL to RS485 Adapter Module 485 to TTL Signal Single Chip Serial Port Level Converter (https://www.amazon.com/gp/product/B075V2NMV8/ref=ppx_yo_dt_b_asin_title_o06_s00)
DeleteHi. Not sure if you are still following this thread but I'd appreciate any help you can give. On my boat I am trying to interface a new NASA Clipper Wind Sensor to my Arduino/Amica Node ESP3266. I have tried and tried (lost count of the time) to make this work but no joy. I purchased this ( https://www.amazon.com/Serial-Converter-Equipment-Upgrades-Doupont/dp/B01N42QW8X/ref=pd_sim_147_5/132-3251838-1444428) Serial <--> TTL converter to take the 12v-powered RS422 NMEA stream from the wind sensor to the Node but cannot seem to get a valid signal through the wires. The RCV LED lights indicating a signal passing to the converter, but nothing valid seems to flow from there. I've tried other sensor sources including GPS so I know my micro-controller and associated code (from this article) is ok. I suspect I am missing something in the multiple ground connections or a mismatch between the 12V that powers the wind sensor and the 3.3V that powers the Node (these are separate power supplies of course.) Also tried on the Arduino Mega with same results. Any help or tricks to make this work appreciated!
ReplyDeleteMarten Laamer's NMEA-0183 Arduino's libraries are at https://github.com/ericbarch/arduino-libraries/
ReplyDeleteHi
ReplyDeleteI need your help.
I have an ublox antenna that works at 12v.
It has 4 cables (rx, tx, vcc, gnd)
How can I connect it to arduino to program?
Native ublox modules run on 3.3vds. you may have a regulator on that module. If you can post a link to the module you are using we can help.
DeleteIf you're using a MAX485 to convert from NMEA A/B signal to something usable by your arduino, you need to pull pin "RE" (which should be called RE-with-a-bar-on-top) to low to enable received data...but that's not enough. You also need to pull pin DE low, to DISable transmitting data. If you have these two pins both enabled (i.e., RE low and DE high), the chip will do nothing at all. Sigh. Ask me how I know.
ReplyDeleteHi,
ReplyDeleteWe use NMEA-0183 wind sensor. We try this sensor with max3232 module and arduino. There is current draw we see. But we cannot reach data
Reading through this, I am very confused. The above wiring table for a NMEA 183 device with a single output wire shows making two connections on the max3232 converter board:
ReplyDeleteNMEA 183 to max3232 R1-OUT
max3232 T1-OUT to Arduino Receive pin.
According to the max3232 datasheet R1-OUT and T1-OUT are both output pins. Should the connections be:
NMEA 183 to max3232 R1-IN
max3232 T1-OUT to Arduino Receive pin.
This seems more logical to to pass the rs232 output from the NMEA 183 device through the converter board and onto the serial receive pin on the arduino? Was the R1-OUT and T1-OUT from the above table just a cut and paste error and the author really intended R1-IN and T1-OUT?