A couple of years ago, I built an add-on board for a Rasperry Pi computer for receiving
NMEA 0183 and
NMEA 2000 data to the Raspberry Pi. It is in the form of a HAT board, i.e. a board that uses the 40 pin connector on the Pi and is the same size as the Pi, except shorter to leave room for the ethernet and USB connections on the Pi.
It has been working fine, but I have never gotten around to sharing the design. Right now I am stuck in
Mexico, so finally got around to picking up the
project again. I am redesigning the PCB and could use some input. The idea is to release the PCB information and microcontroller code to let anybody build it. Being stuck in
Mexico has the downside that I cannot really order new
parts, so this is not going to be done any time soon. But this may still be a good time to get some designs done.
The specification is that it can receive
NMEA 0183 from eight independent channels, four at 38,400 bps and four at 4,800 bps. The 38,400 bps channels can individually be configured to 4,800 bps if needed. My prototype board actually has two
NMEA 2000 channels, but I am planning on cutting that down to one. Few people have two independent
NMEA 2000 networks. The reason I made two of these channels was that I have another
network on the
boat for tank levels and
battery information that I think is CAN bus based, but I have never gotton around to hooking that up.
The
price of the components add up to around 25-35 USD and a programmer for the PIC microcontroller will also be needed (35-40 USD). I will not be putting a lot of these boards together, so the idea is that people order
parts, including the PCBs and start soldering. All component are through hole versions, so it is not difficult. People can get together in a group and build them together, saving on costs. The place I usually buy PCBs in
China sell 10 PCBs for 10 USD (plus shipping), so there are advantages to making several units at once.
My first question is very general: Would you find something like this useful?
My next questions are more technical and are mostly for any
electrical engineer types that may be reading this.
The eight
NMEA 0813 input channels are optically isolated using HCPL2531 optocouplers with a diode for reverse voltage protection and a 2.2 kOhm resistor to limit the
current. For 5 V talkers, this keeps the
current below 2 mA which is the limit for a receiver according to the specification. For higher voltage talkers, the current will exceed this specification. A talker should be able to deliver 15 mA according to the standard and this has never given me any problems. Is it something that you would worry about?
The next question concerns the NMEA 2000 receiver. This is not optically isolated from the Raspberry Pi. It seems fairly normal to not isolate NMEA 2000 units, but most often they are powered from the NMEA 2000
network so it is not a problem. In the case of the Raspberry Pi, I prefer to
power it using a 12 V to 5 V converter connected to the main
battery. This converter has the same ground on the input and output, which means that the ground of the Raspberry Pi is the same as on the NMEA 2000 network. To avoid ground loops, I am not connecting these two grounds since they may be a little bit different in practice due to voltage drops in supply wires on the
boat. I use the MCP2562 chip for the physical layer of the NMEA 2000 receiver and only connect the signal wires of the NMEA 2000 cable. The MCP2562 can accomodate ground differences up to 12 V in either direction and still function correctly. Differences of more than 50 V are needed to cause damage. Is this requirement of common ground on the Raspberry Pi and the NMEA 2000 network something you would worry about?
It is of course possible to solve these two
electrical issues, but at the cost of a more expensive and more complicated board. I would not build a
commercial product like this, but I do not worry about these issues on my own boat.
The final question is in regards to protecting the Raspberry Pi I/O pins. I use UART and SPI to communicate with the board. In my prototype, these communcation channels are connected directly to the PIC 16F1705 that handles the NMEA 0183 and to the MCP2515 that handles NMEA 2000. No problem, but it struct me that if I configure an I/O pin on the Pi to be an output and it is connected to an output from the ICs on the board, I may fry the Raspberry Pi. I figure that connecting a 2.2 kOhm resistor in series with each I/O of th Pi should solve this problem by limiting the current to around 2 mA. I don't think that this will hinder the communication. One could argue that this may not be necessary for the input pins on the MCP2515 since there should never really be a problem. If the PIC is programmed right, the same could be argued for the inputs on that. What do you think? My current thinking is to put a resistor on all the communication pins that I use, but it does take up some space on the PCB.