Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Engineering & Systems > Marine Electronics
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 12-05-2020, 17:33   #16
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by Richv View Post
I have over half a century of experience as an electronic technician, electrical engineer, and software engineer, and I'd certainly be willing to work with you on this project. I have to wonder why you went for a Hat when you could just use RS-422 to USB and CAN to USB adapters plugged into the Rπ USB ports? That would allow you to graft on as many NMEA 0183 devices and NMEA 2000 networks as you needed.
Thanks for your input. I currently get serial input from five devices and also CAN bus input. This would require a total of six adapters and a USB hub. I find it much cleaner to just have a HAT board to handle it all.
BjarneK is offline   Reply With Quote
Old 12-05-2020, 17:37   #17
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by desdestiny View Post
BjarneK
Count me in and please keep up the good work.
I have wbeen wanting to dabble in Pi for some time and have just purchased a package, however have not started.
I am a little daunted by the steep learning curve.
Can you provide me a link to the company in China from where you source your PCB?
Thanks for your interest. I get my PCBs from Seeed Studio: https://www.seeedstudio.com/fusion_pcb.html

The have always provided good products cheap. I have only tried one other place a long time ago, so can not compare with other companies.
BjarneK is offline   Reply With Quote
Old 12-05-2020, 17:42   #18
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by BjarneK View Post
Thanks for your input. I currently get serial input from five devices and also CAN bus input. This would require a total of six adapters and a USB hub. I find it much cleaner to just have a HAT board to handle it all.
Can the PIC cope with collision avoidance? Not familiar with PICs, do they have multiple uarts? Or how do you get the 5 serial inputs in there?

I've just got serial sending working on my set up which goes through a 2 channel max232 type chip as a level shifter down to 3.3v.

Ta
conachair is offline   Reply With Quote
Old 12-05-2020, 17:50   #19
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by jacktheflyer View Post
My current project has similar elements to yours and i am working with Arduino to do a monitoring and logging routine. Halfway there with most of it but the NMEA2000 has me stumped. Would love to get involved with this.
Cool. I am not a big NMEA 2000 expert, but I have gotten it to work. So far, I am only listening to the traffic, not sending anything. I haven't quite figured out what is required to get other devices to send information. On my network they seem to be doing it automatically but I don't know if that is always the case.

I use the MCP2515/2562 combination of chips to handle this. The MCP2562 handles the physical layer and the MCP2515 collects the messages and does initial data processing (like destuffing). I then communicate with the MCP2515 using the SPI protocol to get the messages to the Raspberry Pi.

On the Raspberry Pi, I then assemble the messages (they are sent in smaller pieces on the NMEA 2000 bus) and translate them to something useful.

Check out the datasheets for the two chips and let me know if you have any questions.
BjarneK is offline   Reply With Quote
Old 12-05-2020, 17:55   #20
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by conachair View Post
Can the PIC cope with collision avoidance? Not familiar with PICs, do they have multiple uarts? Or how do you get the 5 serial inputs in there?

I've just got serial sending working on my set up which goes through a 2 channel max232 type chip as a level shifter down to 3.3v.

Ta
I wrote custom code for the PIC16F1705 to handle all the inputs. The code reads the serial information from all eight inputs (handled as general I/O) simultaneously and buffers the messages. They are then sent to the Raspberry PI using the built in UART on the PIC. The collision avoidance is handled by my code. The transfer to the Raspberry Pi is done at 115.200 bps which means that the eight input channels has to be very busy indeed for any messages to get lost. The PIC only has one built in bidirectional UART channel.
BjarneK is offline   Reply With Quote
Old 12-05-2020, 17:59   #21
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by BjarneK View Post
I wrote custom code for the PIC16F1705 to handle all the inputs. The code reads the serial information from all eight inputs (handled as general I/O) simultaneously and buffers the messages. They are then sent to the Raspberry PI using the built in UART on the PIC. The collision avoidance is handled by my code. The transfer to the Raspberry Pi is done at 115.200 bps which means that the eight input channels has to be very busy indeed for any messages to get lost. The PIC only has one built in bidirectional UART channel.
Clever
Is the code on github?
conachair is offline   Reply With Quote
Old 12-05-2020, 18:12   #22
Registered User
 
Dsanduril's Avatar

Join Date: Aug 2011
Location: Petersburg, AK
Boat: Outremer 50S
Posts: 4,229
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Using the I/O I assume means that all NMEA streams share a common ground/reference/negative? On most boats they probably do at the other end anyway.
Dsanduril is offline   Reply With Quote
Old 12-05-2020, 18:43   #23
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by Dsanduril View Post
Using the I/O I assume means that all NMEA streams share a common ground/reference/negative? On most boats they probably do at the other end anyway.
The NMEA 0183 inputs are all individually optically isolated using HCPL2531 optocouplers.
BjarneK is offline   Reply With Quote
Old 12-05-2020, 18:47   #24
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by conachair View Post
Clever
Is the code on github?
Thanks. I am not on GitHub, but I have a feeling I should be. That would probably be the easiest way to share the code. I will look into it.
BjarneK is offline   Reply With Quote
Old 13-05-2020, 08:20   #25
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

I just made my first Git commit ever. Here is the manual:
https://github.com/bjarnek44/electro...doc/manual.pdf
Note that the manual is for my prototype version and the board will change by the time this is ready for release. The changes will include only having one NMEA 2000 channel and a slightly different configuration approach for the NMEA 0183 multiplexer. The functions of the multiplexer should remain unchanged.

The microcontroller code for the NMEA 0183 multiplexer is here:
https://github.com/bjarnek44/electro...nmea_multi.asm
It is not for the faint of heart, but it seems to work well. It is the most dense code I have ever written for a microcontroller in terms of it doing something in almost every cycle. The comments in the start of the file describes how it works.

And before the lectures start: I know that the code should be split in several files. I just figured I would get it out there since someone asked instead of spending a long time making it perfect.
BjarneK is offline   Reply With Quote
Old 13-05-2020, 10:11   #26
Registered User
 
Dsanduril's Avatar

Join Date: Aug 2011
Location: Petersburg, AK
Boat: Outremer 50S
Posts: 4,229
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi



Thank you for sharing! I wish I did half as well at documenting the various things I cobble together. Very much appreciated.
Dsanduril is offline   Reply With Quote
Old 13-05-2020, 13:56   #27
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Great documentation
Way beyond me but well done.
The board looks like the sort of thing jlcpcb could do for a few dollars each with a lot of the components already soldered on surface mount. Mine came out about 40ukp for 5 with all the sensors so prob less than ebay getting the sensors separately, if you have an address to send the boards to.....

Similar project here you might find interesting -
https://forums.ybw.com/index.php?thr.../#post-7171393
conachair is offline   Reply With Quote
Old 22-05-2020, 14:05   #28
Registered User
 
OS2Dude's Avatar

Join Date: Nov 2014
Location: Atlanta, GA
Boat: Catalina 30
Posts: 667
Images: 5
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

I have no need for the NMEA0183 stuff, but would be very interested in your parts/PCB data for the NMEA2000 interface to the PI. I've looked, but the only canbus hat I can find is very expensive.
OS2Dude is offline   Reply With Quote
Old 22-05-2020, 15:03   #29
Registered User
 
BjarneK's Avatar

Join Date: Dec 2010
Location: Århus, Denmark
Boat: Boreal 47
Posts: 155
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Quote:
Originally Posted by OS2Dude View Post
I have no need for the NMEA0183 stuff, but would be very interested in your parts/PCB data for the NMEA2000 interface to the PI. I've looked, but the only canbus hat I can find is very expensive.
Funny that you write today. I just got to the point where I am satisfied with the NMEA 0183 part of the multiplexer and I just started looking at the details of NMEA 2000. I have used the first version of my board for quite a while for GPS and AIS information on the NMEA 2000 bus. The software needs to be a little more slick before it is for everybody.

It looks like there is a can bus hat here that is not too expensive: https://www.seeedstudio.com/2-Channe...Pi-p-4072.html

I have not tried it, so don't know how good it is. Of course, it can be done cheaper. It is really only two ICs that are needed. As mentioned, I use MCP 2515 and MCP 2562 which should be around two and one dollars respectively. The circuits are simple enough that you can set it up on a veroboard, but a PCB is of course nice. I get them with my own design for 5 USD from the same place as the device above. But then there is of course the shipping...

What is your setup? Which devices on your network? Do you want a solution that just works out of the box or are you willing to do some experimentation?
BjarneK is offline   Reply With Quote
Old 13-12-2020, 22:34   #30
Registered User
 
akopac's Avatar

Join Date: Oct 2014
Location: South Pacific -> World Cruising Long Term
Boat: Morgan, West Indies 38 Ketch
Posts: 564
Re: NMEA 0183 and 2000 multiplexer for Raspberry Pi

Count me in too. I could build too maybe. I’ll probably be down in MX in spring
Andy
S/V Soy Libre
akopac is offline   Reply With Quote
Reply

Tags
nmea, nmea 0183


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a NMEA 2000 Chart Plotter to a NMEA 0183 Network SailingPNW Marine Electronics 28 26-04-2021 07:00
NMEA 2000 to NMEA 0183 Davidhoy Marine Electronics 26 13-12-2019 18:39
[SOLD] Shipmodul Miniplex-42BT NMEA-0183 multiplexer with Bluetooth s/v Jedi General Classifieds (no boats) 6 27-09-2016 19:42
For Sale: Raymarine NMEA-0183 Multiplexer NahanniV Classifieds Archive 11 27-03-2013 14:22
For Sale: NMEA-0183 Raymarine Multiplexer new $60 Ram Classifieds Archive 0 16-12-2009 08:59

Advertise Here


All times are GMT -7. The time now is 01:48.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.