Page 1 of 1

NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 6:35 pm
by h2obo
Hello,

I would like to connect my Navico 300 NAIS transceiver to my pi2 in order to display AIS data in Opencpn. The outputs from the NAIS transceiver are bare wire Rs232, with three connections: gnd, in, and out, power at 5v, 38400 baud.

In order to make this connection, could I simply cut off the mini - D end of a usb patch cable and connect the two data and one ground wires to the NAIS 300 and connect the usb plug into the pi 2?

I presume that some configuring of a ttyS* or ttyusb* Com port would be required.

I haven't tried this because I can't convince myself that I wouldn't sizzle my pi.

Any advice would be appreciated.

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 6:50 pm
by topguy
h2obo wrote: In order to make this connection, could I simply cut off the mini - D end of a usb patch cable and connect the two data and one ground wires to the NAIS 300 and connect the usb plug into the pi 2?
NO! An USB port is not a serial port.

Read up: http://elinux.org/RPi_Serial_Connection ... nal_levels

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 6:57 pm
by DougieLawson
In order to avoid frying either your RPi or your NMEA receiver OR BOTH. Spend £3 and get a simple USB to RS232 converter.
http://www.ebay.co.uk/itm/like/321110901546

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 7:32 pm
by h2obo
DougieLawson wrote:In order to avoid frying either your RPi or your NMEA receiver OR BOTH. Spend £3 and get a simple USB to RS232 converter.
http://www.ebay.co.uk/itm/like/321110901546
Thanks for the quick responses, guys.

Okay... Got it no direct connect. But I need bare wires at the other end of the usb cable, so what about one of those USB-TO-TTL Rs232 cables?

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 7:38 pm
by fruitoftheloom
h2obo wrote:
DougieLawson wrote:In order to avoid frying either your RPi or your NMEA receiver OR BOTH. Spend £3 and get a simple USB to RS232 converter.
http://www.ebay.co.uk/itm/like/321110901546
Thanks for the quick responses, guys.

Okay... Got it no direct connect. But I need bare wires at the other end of the usb cable, so what about one of those USB-TO-TTL Rs232 cables?
:?: http://www.amazon.co.uk/USB-TTL-Serial- ... B00CNUH6QG

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 10:01 pm
by davidcoton
Looks OK, though I haven't tried one.

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 21, 2016 10:23 pm
by B.Goode
h2obo wrote:so what about one of those USB-TO-TTL Rs232 cables?
I don't understand what that means.

In my mind at least, 'ttl' implies signalling with signal levels of 0v and some +ve logic level. Whereas RS232 implies signalling with two signal levels of + and - the same logic level [for instance -9 volts and + 9 volts], and 0v is not a valid value.

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 28, 2016 11:54 am
by h2obo
Well, I got the usb adaptor which has four colored wires. My AIS unit has three RS232 connections: -ve, gnd, +ve. I have looked at a pin out chart for the usb: red wire = +5v, white wire = data -, green wire = data +, fourth wire (black) not used.

The AIS manual does not say how to make the connection. Connecting the white wire to "-ve" produces gibberish on the serial terminal (GtkTerm) at any baud rate. Incidentally the AIS communicates at 38400. Further connecting the green wire to either of the two remaining connectors still produces gibberish instead of nmea data sentences. I have not tried connecting the red wire fearing to short something out.

Incidently, I know the AIS works because it outputs useable data to a chart plotter via a single wire connection on the "-ve" connector.

Googling has produced no instructions to configure the serial port and connections to produce readable nmea sentences. Does anybody have any suggestions to solve this problem?

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 28, 2016 1:12 pm
by geemac2000
Looking at the NAIS-300 manual it says it has a RS232 output/input. If the adapter you bought is a USB to TTL adapter, I'm afraid it won't work. You'll need a USB to RS232 adapter like Dougie said. It has a DB9 male connector, so you will need a DB9 female connector to solder wires on to connect to the NAIS-300. :)

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 28, 2016 7:08 pm
by h2obo
Thanks Geemac (et al). You are correct in that the adaptor does not work. The reason, I believe, is that NMEA data works with 5v logic and the USB-to-TTL console adapter uses 3.3v logic.

I happened to have both of the items you suggested - usb to RS232 adapter and the female cable adapter - and the connection works by connecting a single wire (a green one from the female RS232 adapter) and plugging it into the -ve terminal of the RS232 port on the AIS box. No other wires connected! So now I have an adapter that has 3 bare wires on one end, only one of which are necessary, and a usb plug at the other end, with a DB9 male/female connection in the middle. Not exactly parsimonious. I guess it works because it operates on a 5v circuit (?), not 3.3v.

So.....I am tempted to try my original experiment by simply cutting off one end of an old usb cord, plugging one end into the Pi, and the single exposed feed wire on the other end into the -VE terminal on the AIS box.

What could go wrong? :?

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 28, 2016 9:45 pm
by davidcoton
h2obo wrote: So.....I am tempted to try my original experiment by simply cutting off one end of an old usb cord, plugging one end into the Pi, and the single exposed feed wire on the other end into the -VE terminal on the AIS box.

What could go wrong? :?
Lots, including (but unlikely) release of the Magic Smoke. A raw USB connection will not understand NMEA data.

Another plan would be to connect the NAIS-3000 data to the RPi's UART pins, using a simple resistor divider to reduce 5V to 3V3. You should need a two-wire connection, GND to GND, and data out to data in. The signal names you have for the NAIS-3000 output do not entirely make sense, but it would probably need an oscilloscope to sort out what is really coming out.

Signalling over a single wire does not usually work (if you can make it reliable, get a patent quick). You may have a ground (0V) connection already if the two units share a power supply. Otherwise the"signal" you think is arriving may be just noise.

Re: NMEA data to RPi2 via USB port

Posted: Thu Jan 28, 2016 9:58 pm
by B.Goode
h2obo wrote:the adaptor does not work. The reason, I believe, is that NMEA data works with 5v logic and the USB-to-TTL console adapter uses 3.3v logic.
Partially, but perhaps not sufficiently, correct.

I'll try to restate it more clearly. We are talking about representing data by a series of symbols that can have one of two states - Mark or Space; True or False, etc. Binary.

TTL represents these two states with 2 voltages: 0v for one of them, and the 'logic level' - in your example 3.3v - for the other.

RS232 also represents these two states with 2 voltages: in this case (using 5v logic as the example) +5v (a positive signal wrt ground) as one state, and -5v (a negative signal wrt ground) as the other. RS232 does not recognise 0v (ground) as a valid signal state.

Depending on implementation, sometimes you can get away with connecting TTL and RS232 signals together. But more often than not it will not work, or will not work reliably. And there is a risk that a high voltage rs232 signal could permanently damage a ttl receiver circuit.

Re: NMEA data to RPi2 via USB port

Posted: Fri Jan 29, 2016 4:59 am
by karrika
Hi guys.

Nautical serial signals are not standard RS232. The transmitter is really RS485 and the receiver is a resistor and an opto for isolating the receiving end from the transmitter.

When you connect these equipment on a vessel you never have ground loops because of this.

So we are talking about current loops - not voltages.

The good things s that you should be able to receive and send the data also with a normal RS232 chip. It is not optimal but it works.

NMEA does not follow any existing shore-based standards. Except the IEC 61162-1 that is created for this purpose. The actual hardware is defined in the standard. So all NMEA equipment need to implement this.

Using adapters may or may not work. It is more difficult than with standard serial wires.

Re: NMEA data to RPi2 via USB port

Posted: Fri Jan 29, 2016 6:14 am
by h2obo
Good info, Karika.

As it happens, my NAIS 300 also has rs485 output with bare wire terminals, so I have two further questions.

1. Can you give me an example of an adapter with a "normal Rs232 chip" that I could put into the usb port of the RPi?
2. How could I use the rs485 output to connect to the usb port on my RPi?

Re: NMEA data to RPi2 via USB port

Posted: Fri Jan 29, 2016 6:33 am
by karrika
This is how the NMEA receiving side should look like:
NMEA.png
NMEA.png (44.13 KiB) Viewed 4562 times
Unfortunately there is no USB based equipment that implements the reception as defined by the standard. A good USB dongle should be able to output negative and positive voltages. Something like this should work.
http://www.aten.com/products/Mobility-& ... qsHXl6li90

Or you can buy similar RS485 converters. They cost more though.

The great thing with NMEA is that it really does not matter if you use voltage or current interfaces. The input circuitry works with both.

Perhaps Raspberry Pi needs a real NMEA hat for using Pi's on board :D

Re: NMEA data to RPi2 via USB port

Posted: Fri Jan 29, 2016 8:31 am
by B.Goode
Good catch @karrika. The light goes on! If the interface is really CL that explains the description of the pinouts as being "My AIS unit has three RS232 connections: -ve, gnd, +ve." [Whereas rs232 is usually described as Tx, Rx, Gnd.]

Like others, I was blindsided by continued references - like the one above - by @h2obo to the rs232 connections on his unit.

Re: NMEA data to RPi2 via USB port

Posted: Tue Oct 11, 2016 10:56 am
by GrumpyCy
Hi,

I'm interested in setting a NAIS-300 through a RPI too, maybe using Openplotter.

Did anyone have success with this (before i start purchasing stuff and end up down a blind alley!).

The only experience I have is a bit of Linux and starting to set up a Pi Therm for my Dad.

I think I've got a USB to RS232 converter, I just need to check it's of sufficient quality.

Thanks

Cy