NMEA2000 arduino part1
NMEA2000 is the protocol used in boat, it based on can bus, but with definition on different PGN(group nr)...etc.
The best one I found for arduino is this one:
https://github.com/ttlappalainen
He has both NMEA 0183 and nmea 2000 libraries.
To start with NMEA2000 library for arduino like boards, this library reference should be read: https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/NMEA2000_library_reference.pdf
There are few boards comes with can bus controller, but will need external can bus phy, such as Due, and esp32. For some boards, you will need external can bus controller(MCP2515) and can bus transiever(MCP2551)
So the NMEA2000 libraries need different extra lib to make it works on different board, detail info in the read me of the lib:
https://github.com/ttlappalainen/NMEA2000/blob/master/README.adoc
To start, I purchased a seeeduino can bus shield:
it has an MCP2515 CAN Bus controller with SPI interface and MCP2551 CAN transceiver.
Plan to make this work with my arduino mega256(the lib is quite big, so bigger and more powerful boards are prefered.)
So, my plan will need 3 libs:
1. NMEA2000 https://github.com/ttlappalainen/NMEA2000
2. NMEA2000_mcp library https://github.com/ttlappalainen/NMEA2000_mcp
3. mcp_can library https://github.com/ttlappalainen/CAN_BUS_Shield
The best one I found for arduino is this one:
https://github.com/ttlappalainen
He has both NMEA 0183 and nmea 2000 libraries.
To start with NMEA2000 library for arduino like boards, this library reference should be read: https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/NMEA2000_library_reference.pdf
There are few boards comes with can bus controller, but will need external can bus phy, such as Due, and esp32. For some boards, you will need external can bus controller(MCP2515) and can bus transiever(MCP2551)
So the NMEA2000 libraries need different extra lib to make it works on different board, detail info in the read me of the lib:
https://github.com/ttlappalainen/NMEA2000/blob/master/README.adoc
To start, I purchased a seeeduino can bus shield:
it has an MCP2515 CAN Bus controller with SPI interface and MCP2551 CAN transceiver.
Plan to make this work with my arduino mega256(the lib is quite big, so bigger and more powerful boards are prefered.)
So, my plan will need 3 libs:
1. NMEA2000 https://github.com/ttlappalainen/NMEA2000
2. NMEA2000_mcp library https://github.com/ttlappalainen/NMEA2000_mcp
3. mcp_can library https://github.com/ttlappalainen/CAN_BUS_Shield
I opened a new folder for sketch and lib, and started with arduino 1.8.5
then I download a PC software nmea reader which is made by actisense:
http://www.actisense.com/media/?product=nmea-reader-and-ebl-reader&type=downloads
I installed v.1.5.1.7 , no problem with my windows 8.
Follow the direction in the lib reference.pdf section 4.2: Here we will try to test the library with arduino and PC.
where my arduino mega will send out nmea string with temperature monitor comes with NMEA2000 lib, with some modification, the nmea sting will send through uart_usb to PC and can be read by nmea reader.
modi:
"
Serial.begin(115200);
NMEA2000.SetForwardStream(&Serial);
NMEA2000.SetDebugMode(tNMEA2000::dm_Actisense); //
//NMEA2000.EnableForward(false);
"
as expected, I can see the temp sent from arduino mega.
the temp is sent in K with period of 2.5 second.
to understand more, I will need to dig into the PGN of nmea2000
留言
張貼留言