NMEA 0183 Multiplexer and logger

rgarside

Well-Known Member
Joined
24 May 2009
Messages
502
Location
East Coast
Visit site
I have just finished testing a 2 port NMEA multiplexer and data logger I have built based on an Arduino Mega 2560.

The Mega 2560 has four UART's, so providing 3-4 NMEA inputs and outputs is no problem. I only need two initially, and used a Max232 chip to interface between RS232 and the TTL level of the Arduino UARTs - this enables both input and output of RS 232 NMEA data.

The datalogger "shield" is from Adafruit, it has an SD card slot, a real-time clock, and a prototyping area I used to mount the Max232. There are a couple of adaptations to make it work with the Mega, but these are all covered in the Adafruit documentation.

I powered it with an integrated 5v switching power supply to minimise the power it draws. It seems to draw about 60 - 70 mA from the 12v supply.

I found that the standard Arduino programming system limits the serial buffer sizes, so I got a lot of buffer overflows when I first tested it with the two input streams. While there are other ways of overcoming this, I subsequently found additional code libraries [ SerialPort and SdFat ] that allow changing the sizes of the buffers, and also speed up writing to the SD card.

The code now seems to run successfully.

Initially I just wanted to log the position and echosounder data that is all on one bit of the boat's network, but then thought it would be good to capture the wind data that is on a second channel - hence the need for two channels.

The position and depth data can be sent to initiatives like TeamSurv for chart improvements, while the wind data should allow me to look at the boat's performance and make polar plots.

In the course of making the logger it was very easy to add a sensor for logging the barometric pressure and temperature, and to measure and log the supply voltage.

If anyone is interested in the Arduino code to make it work, let me know.

Adding another Max232 would be easy and would allow the other two ports available to be interfaced.

Datalogger-0.jpg
 
I have just finished testing a 2 port NMEA multiplexer and data logger I have built based on an Arduino Mega 2560.

The Mega 2560 has four UART's, so providing 3-4 NMEA inputs and outputs is no problem. I only need two initially, and used a Max232 chip to interface between RS232 and the TTL level of the Arduino UARTs - this enables both input and output of RS 232 NMEA data.

The datalogger "shield" is from Adafruit, it has an SD card slot, a real-time clock, and a prototyping area I used to mount the Max232. There are a couple of adaptations to make it work with the Mega, but these are all covered in the Adafruit documentation.

I powered it with an integrated 5v switching power supply to minimise the power it draws. It seems to draw about 60 - 70 mA from the 12v supply.

I found that the standard Arduino programming system limits the serial buffer sizes, so I got a lot of buffer overflows when I first tested it with the two input streams. While there are other ways of overcoming this, I subsequently found additional code libraries [ SerialPort and SdFat ] that allow changing the sizes of the buffers, and also speed up writing to the SD card.

The code now seems to run successfully.

Initially I just wanted to log the position and echosounder data that is all on one bit of the boat's network, but then thought it would be good to capture the wind data that is on a second channel - hence the need for two channels.

The position and depth data can be sent to initiatives like TeamSurv for chart improvements, while the wind data should allow me to look at the boat's performance and make polar plots.

In the course of making the logger it was very easy to add a sensor for logging the barometric pressure and temperature, and to measure and log the supply voltage.

If anyone is interested in the Arduino code to make it work, let me know.

Adding another Max232 would be easy and would allow the other two ports available to be interfaced.

View attachment 30355
Wow! how much does something like this cost?
Stu
 
Hi

I was looking at using the Mega 2560 for a 0183 multiplexer, take the feeds from the IS15 and furuno GPS-31 into a Raspberry PI (have just received the PI and will order the 2560 later this week). At the moment the IS15 is not linked to the GPS which is my initial starting point so I can see the nav data on the IS15 then will look at a chart plotter etc.. using the multiplexer.

Out of interest where did you get the 2560 from as the prices seam to vary quite a bit ?

Cheers

Stu
 
The main components are:

Arduino Mega 2560 12.00 eBay
Adafruit data logger 16.00 oomlout + postage
BMP-085 Barometer 8.00 eBay
Power supply 7.00 RS + postage
Case 4.50 eBay
MAX232 chip 2.00 eBay

Then you need some resistors, capacitors, wire, plugs and sockets, veroboard, LED, header pins, switch and SD card to complete it. So its a bit more than just the total of the major components.

The case isn't ideal, but it seems really difficult to find ones of the right size with the sort of IP rating I would have preferred. This one is going to live in a dry-ish locker below decks so should be ok. You need to be able to get the SD card out fairly easily, so that limits the case configurations.
 
This gave me the idea ...

http://www.42.co.nz/freeboard/

Cheers

Stu

The freeboard stuff looks quite cool - I like the idea of feeding the data into a raspberry pi. The power challenge would be the display. I would like to add a status display to my box - the simplest thing would be a 4 lines x 20 character text display running straight off the mega's I2C interface.

The mega prices on eBay seem to be lower than when I bought mine - I bought from a UK stockist for about £17, now direct from China seems to be about £12. I ended up buying some things direct from China for a gas detector project, and that worked out ok.
 
Well that looks really cool. I would love to have the time to get back in to some electronics/embedded control. There seems to be so much new stuff to play with since I gave it all up 12 years ago. Did it take long to put together/debug etc.
 
Well that looks really cool. I would love to have the time to get back in to some electronics/embedded control. There seems to be so much new stuff to play with since I gave it all up 12 years ago. Did it take long to put together/debug etc.

It sounds like you are ahead of me already. This was my first go at this sort of stuff, and I've done it when time has been available. I started looking into it late last year, bought most of the bits around Christmas, and had tested them bit by bit and put them together in Jan. I didn't test the final system until last week as I have only just got the batteries back onto the boat. There was a bit of last minute de-bugging over the last week to sort out the buffer overflow issues.

I was really impressed with the ease of use of the programming system, and the level of information and support in the Arduino world.
 
Used to teach A level electronics and automation/control but changed schools and now teach to ensure the examination success of the students, mostly furniture based projects. But I do have an Arduino system on my desk waiting for some attention and this will elevate its status for having a play with.
 
If anyone is interested in the Arduino code to make it work, let me know.

Must say, I’m also impressed, and interested.

I have a slightly different requirement, as I already run a mini-pc with Neal Arundale’s excellent nmea router and com0com to get three nmea feeds onto the screen.

That works fine, but should it break?

So I’m considering a backup. Separate nmea multiplexer into an RS232 IP server, and onwards via a wifi access point to a tablet or backup laptop PC.

Presently I’m using the on-board mini-pc as the RS232 to TCP conversion and that works fine. All the navigation info is available on the Android tablet, but the mini-pc is the weak link.

I’d be very interested in some more info particularly on just using Arduino Mega 2560, with four ports enabled, and possibly outputting it via something like the RS232 TTL to Ethernet TCP/IP RJ45 Converter Module (Ebay 181114128041) but not sure yet if that module would interface with the 2560.

Will your code allow for an AIS input which will be at the faster baud rate?

In any case I’d be very interested in learning more about your achievement. Last time I used a soldering iron on something similar it was a Z80A which I eventually got to play space invaders!

Regards
 
Well, as this was my first adventure into the world of micro-processors I may not be able to give you a lot of guidance. But I have noticed a lot of intriguing bits that come up when one does a search with arduino in it.

I don't think there would be a problem dealing with AIS data at 38400, having found how to change the port buffer sizes they can be changed to suit. The code would need to be modified to handle the additional ports and to recognise the different sentences. At present the code only uses about 10% of the memory on the Mega 2560, so there's scope for additional code and buffer space. As the Mega seems to be used for systems to autonomously pilot flying drones, with high rate flight data and GPS to process, you can obviously do a lot with it. The next step up in processing is the Arduino Due, which uses a bigger, faster ARM chip that runs at 3.3v.

There are ethernet "shields" available that plug onto the Arduino boards, and I think there are numerous forms of wireless and Bluetooth shields also. So I don't think there is a problem in principle with sending data out over TCP/IP, or even wirelessly, from the Arduino without intervening boxes. The Arduino can send serial directly at TTL levels, and I used a MAX 232 to get to RS232.

I haven't started looking into the ethernet or wireless, so that's about as much as I can tell you.

I'm thinking about adding a magnetic compass to my system. That will have enough complications to keep me occupied for a while.

Sounds like an interesting configuration you are looking at. I would expect that replacing the PC with a micro-processor based system would reduce power consumption - but obviously you lose the other capabilities of the PC.

The code was too big to post in replies on the forum, so PM me if you would like it and I can email it.
 
I am also interested. Are you still making the code available? I am looking to having OpenCPN on a Raspberry or miniPC and having GPS and other NMEA data fed to a tablet via wifi. Have been playing around with Arduino and Raspberry for the last year. Am thinking of using github or dropbox to post code.
 
I am also interested. Are you still making the code available? I am looking to having OpenCPN on a Raspberry or miniPC and having GPS and other NMEA data fed to a tablet via wifi. Have been playing around with Arduino and Raspberry for the last year. Am thinking of using github or dropbox to post code.

Hi! I'd love to use your code. Could you send it to me?

regards,

Dirk
 
Hi there,
I am working on a similar project (electronic compass based on Arduino Uno and HMC5983 IC) and it would be great if I could have a look at your code in order to implement the NMEA 0183 stuff. Can you please send it to me offline?

Cheers

Ignacio
 
The thread is more than a couple of years old so maybe not.
however if you want GPS & AIS nmea data over wifi then openplotter can do that on a raspberry pi, providing much more besides..

http://www.sailoog.com/en/blog/download-openplotter-rpi-v060-beta3

Thanks for replying to the enquirer on my behalf!

However, the system is still running and if people are interested I'm happy to send it to them. Please send me a PM with your email address, as the file is too big to post on this forum.
 
The main components are:

Arduino Mega 2560 12.00 eBay
Adafruit data logger 16.00 oomlout + postage
BMP-085 Barometer 8.00 eBay
Power supply 7.00 RS + postage
Case 4.50 eBay
MAX232 chip 2.00 eBay

Then you need some resistors, capacitors, wire, plugs and sockets, veroboard, LED, header pins, switch and SD card to complete it. So its a bit more than just the total of the major components.

The case isn't ideal, but it seems really difficult to find ones of the right size with the sort of IP rating I would have preferred. This one is going to live in a dry-ish locker below decks so should be ok. You need to be able to get the SD card out fairly easily, so that limits the case configurations.


You could reduce the bill of materials by changing to a Max233
 
Top