Go Down

Topic: NMEA 2000 Shield (Read 148709 times) previous topic - next topic

seamaster

#225
Jul 06, 2017, 05:52 am Last Edit: Jul 06, 2017, 05:57 am by seamaster
Hello all!
For those of you interested, here is the assembled RevA board
Finally I got to test the RS232 port today. It works great!
So it all works great!



For those of you interested, here are the specs:
8 x 0-30 VDC inputs
4 x 0-5 VDC or 0-3.3 VDC (with analog reference of 3.3v)
Each of the 4 ports above has 3.3vdc supply and ground - for easy connection to temperature or pressure sensors
1 x RS232 port for NMEA0183
1 x NMEA2000 port with MICRO-C male connector (or just bare wires if preferred)
external 12-18VDC power or N2K bus powered - jumper selectable.


I'm planning to make RevB based on feedback I get from the forum and few things that I feel I can improve.
Please let me know what you think should be added or substracted from the board. I prefer to keep it simple and have multiple boards for more interfaces.
This boat was tested with Timo's multi device interface with up to 5 devices.
I simulated:
Heading
Fluid levels
Rudder indicator
Compass
Battery

Please let me know if you have any other uses that I can implement the hardware for.
Cheers!

mavromatis

#226
Jul 09, 2017, 01:44 am Last Edit: Jul 09, 2017, 02:06 am by mavromatis
Hi!

I just added Mercury VesselView to my boat and as part of the process I had to move the engine trim sensor from analog to digital so the ECU could use it to enable ECO MODE.   As such, my analog gauge became non-functional.  

So, I designed a PCB that uses a Teensy and MCP2551 among some other circuitry that can read the NMEA 2000 data and then control the gauge using PWM but I thought it was a better opportunity to convert the analog gauge into a color multifunction display.

I've got everything ready to go -- now I just need to plug into the NMEA 2000 bus to see if the Teensy can handle getting the Engine Trim data...

I'm using the NMEA2000 DataDisplay example, do you think what I'm trying to do (read Engine Trim) will work?  Meaning, will get the updates of position in a "real-time" update?

I will be going to the boat this week to finally plug in the board to the network to start testing -- for the last few weeks it was about the programing the color display, mechanical work, PCB design and 3d designing printing the case pieces.  

Here are photos of the progress so far --












Video showing transitions (by tapping the chrome bezel):
https://www.youtube.com/watch?v=PfXNt46S_9c

timolappalainen

Hi,

In principle it should work.
- I expect you have DC-DC converter on your board and you remembered to cut link between VUSB and Vin on Teensy.

- Also hopefully ECU or some system will send trim data to NMEA2000

- DataDisplay is a bit old and does not seem have automatic library selection for board. DataDisplay2 seem to already have handling for EngineRapid (PGN 127488). On that you will need only comment unnecessary handlers on handler list NMEA2000Handlers. Or maybe you already rewrite datadisplay to match your needs?

Your gauge looks very nice and could be used to display different data. With single scroll button besides gauge one select data from NMEA2000 bus - not just trim.

And if you want to see your new gauge on NMEA2000 device list, you have to add device definition commands to setup as e.g. in TemperatureMonitor example. You should then use Class code 120 (Display) and Function code 130 (Display). In principle in NMEA 2000 listen only devices are not allowed. On reason is that each device, which is taking power from bus, should inform it so that total power can be calculated. Just on your own boat this does not matter, if you just remember to keep used power low enough. There are also other things to concern, if you start to change you device more "NMEA2000 certified".

mavromatis

#228
Jul 09, 2017, 05:56 pm Last Edit: Jul 09, 2017, 06:53 pm by mavromatis
- I expect you have DC-DC converter on your board and you remembered to cut link between VUSB and Vin on Teensy.
Yes, I have a 12v > 5v DC-DC converter onboard and cut the link.

- Also hopefully ECU or some system will send trim data to NMEA2000
The VesselView Link takes the ECU data and puts it on the NMEA2000 network -- this is all functioning already  on my Lowrance MFD.

- DataDisplay is a bit old and does not seem have automatic library selection for board. DataDisplay2 seem to already have handling for EngineRapid (PGN 127488). On that you will need only comment unnecessary handlers on handler list NMEA2000Handlers. Or maybe you already rewrite datadisplay to match your needs?
Got it -- I meant to say DataDisplay2 example.   I see these handlers in the demo -- are they all good?

Code: [Select]

// Do not forward bus messages at all
  NMEA2000.SetForwardType(tNMEA2000::fwdt_Text);
  NMEA2000.SetForwardStream(OutputStream);
  // Set false below, if you do not want to see messages parsed to HEX withing library
  NMEA2000.EnableForward(false);
  NMEA2000.SetMsgHandler(HandleNMEA2000Msg);
  NMEA2000.SetN2kCANMsgBufSize(2);
  NMEA2000.Open();
  OutputStream->print("Running...");


Your gauge looks very nice and could be used to display different data. With single scroll button besides gauge one select data from NMEA2000 bus - not just trim.
That's the plan -- right now I have two screens ready (Trim and Fuel).  I will add more screens I can cycle through to make it a quick-look MFD.

And if you want to see your new gauge on NMEA2000 device list, you have to add device definition commands to setup as e.g. in TemperatureMonitor example. You should then use Class code 120 (Display) and Function code 130 (Display). In principle in NMEA 2000 listen only devices are not allowed. On reason is that each device, which is taking power from bus, should inform it so that total power can be calculated. Just on your own boat this does not matter, if you just remember to keep used power low enough. There are also other things to concern, if you start to change you device more "NMEA2000 certified".
Good idea!  I'll add that code so the device shows up -- the power usage is pretty low overall.  The Teensy & Display plus the MCP2551 is all that is being used.   Initial measurement looked like about 90mA being pulled from the 12v input side.

Thanks again timolappalainen!

timolappalainen

Got it -- I meant to say DataDisplay2 example.   I see these handlers in the demo -- are they all good?
I have tested them against Actisense NMEA Reader, so they should be all right.

mavromatis

I have tested them against Actisense NMEA Reader, so they should be all right.
At the boat, connected to the network -- I see the data coming in!

However, I'm not getting the device showing up in the "Device List" on my Lowrance HDS7 when I scan the network for devices...

I'm doing the following in code:

Code: [Select]

// Set Product information
  NMEA2000.SetProductInformation("00000001", // Manufacturer's Model serial code
                                 100, // Manufacturer's product code
                                 "Myro Gauge MFD",  // Manufacturer's Model ID
                                 "1.0.0.0 (2017-7-10)",  // Manufacturer's Software version code
                                 "1.0.0.0 (2017-7-10)" // Manufacturer's Model version
                                 );
  // Set device information
  NMEA2000.SetDeviceInformation(000001, // Unique number. Use e.g. Serial number.
                                130, // Device function=Display. See codes on http://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf
                                120, // Device class=Display. See codes on  http://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf
                                2041 // Just choosen free from code list on http://www.nmea.org/Assets/20121020%20nmea%202000%20registration%20list.pdf                               
                               );
  // Do not forward bus messages at all
  NMEA2000.SetForwardType(tNMEA2000::fwdt_Text);
  NMEA2000.SetForwardStream(OutputStream);
  // Set false below, if you do not want to see messages parsed to HEX withing library
  NMEA2000.EnableForward(false);
  NMEA2000.SetMsgHandler(HandleNMEA2000Msg);
  NMEA2000.SetN2kCANMsgBufSize(2);
  NMEA2000.Open();
  OutputStream->print("Running...");

timolappalainen

You are missing type definition as default is just listen. So add
  NMEA2000.SetMode(tNMEA2000::N2km_ListenAndNode,29);

Also since Teensy has enough memory you do not need to sqeeze it with
NMEA2000.SetN2kCANMsgBufSize(2);

seamaster

@mavromatis
great project. Interested to know what display you used for that?

mavromatis

#233
Jul 11, 2017, 01:23 am Last Edit: Jul 11, 2017, 01:29 am by mavromatis
You are missing type definition as default is just listen. So add
  NMEA2000.SetMode(tNMEA2000::N2km_ListenAndNode,29);

Also since Teensy has enough memory you do not need to sqeeze it with
NMEA2000.SetN2kCANMsgBufSize(2);
Thank you!


@mavromatis
great project. Interested to know what display you used for that?
I was going to go down the route and use an STM32 with a 1.5" round display (from China) but ended up finding this screen from 4d systems (http://www.4dsystems.com.au/product/uLCD_220RD/) that actually fit perfectly into the 2" analog gauge frame.

Lunchrat

Hey guys,

Sorry to interrupt- I've got a quick question. I'm trying to read and record (not write) N2K with a tablet or phone. I didn't read all 16 pages of this thread so can anyone point me in the direction of a library (or existing sketch) I can use to read the N2K data on the network?

I saw the mention of that reverse engineered catalog of PGNs but I don't know if someone already compiled it into some easy to use Arduino thing.

Thanks for the help

seamaster

In the library examples, there is an example file called ActisenseListner.ino. This  file listens for the trafic on the N2K network. Here is actually where you should start:
https://github.com/ttlappalainen/NMEA2000/tree/master/Documents

and here:
https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/NMEA2000_library_reference.pdf

it is relatively simple if I figured it out..
good luck

mavromatis

#236
Jul 12, 2017, 05:49 pm Last Edit: Jul 12, 2017, 09:08 pm by mavromatis
I've logged down some of the output from the bus and I see some anomaly's I think it's normal as the numbers are Pa (Pascal), right? -- engine wasn't running but the VesselView Link (ECU > N2K bridge powered) -- the VesselView interface showed the correct data. See how the oil pressure and fuel pressure show some interesting values... then go to "not available" in the next update.

These readings were made via a Teensy 3.2 with NMEA2000.SetN2kCANMsgBufSize(2); -- I will check it again with that bit code code commented out (not sure if that causes the issue).


  In Main Handler: 127489
  Engine dynamic params: 0
  oil pressure (Pa): 200.00
  oil temp (C): -0.05
  coolant temp (C): 24.00
  altenator voltage (V): 13.29
  fuel rate (l/h): 0.00
  engine hours (h): 280.97
  coolant pressure (Pa): 0.00
  fuel pressure (Pa): 296000.00
  engine load (%): 0
  engine torque (%): not available




Then next update I get, it seems to cycle over and over:


  In Main Handler: 127489
  Engine dynamic params: 0
  oil pressure (Pa): not available
  oil temp (C): not available
  coolant temp (C): not available
  altenator voltage (V): not available
  fuel rate (l/h): 0.00
  engine hours (h): not available
  coolant pressure (Pa): not available
  fuel pressure (Pa): not available
  engine load (%): not available
  engine torque (%): not available

mavromatis

Update on trying to send the product info on the network: 

When I try to enable -- NMEA2000.SetMode(tNMEA2000::N2km_ListenAndNode,29);

It seems to crash my NMEA network -- the Lowrance MFD Network device list cannot list any items and doesn't refresh and I lose my GPS (since it cannot get my POINT-1 GPS on the network) until I unplug my device. 

Anything look wonky below?  Wonder if it's software or possibly hardware on the TX side of my CAN?

Code: [Select]

 // Set Product information
  NMEA2000.SetProductInformation("00000001", // Manufacturer's Model serial code
                                 100, // Manufacturer's product code
                                 "Myro Gauge MFD",  // Manufacturer's Model ID
                                 "1.0.0.0 (2017-7-10)",  // Manufacturer's Software version code
                                 "1.0.0.0 (2017-7-10)" // Manufacturer's Model version
                                 );
  // Set device information
  NMEA2000.SetDeviceInformation(000001, // Unique number. Use e.g. Serial number.
                                130, // Device function=Display. See codes on http://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf
                                120, // Device class=Display. See codes on  http://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf
                                2041 // Just choosen free from code list on http://www.nmea.org/Assets/20121020%20nmea%202000%20registration%20list.pdf                               
                               );
  // If you also want to see all traffic on the bus use N2km_ListenAndNode instead of N2km_NodeOnly below
  //NMEA2000.SetMode(tNMEA2000::N2km_NodeOnly,22);
  //NMEA2000.SetMode(tNMEA2000::N2km_ListenAndNode,29);
  // Do not forward bus messages at all
  NMEA2000.SetForwardType(tNMEA2000::fwdt_Text);
  NMEA2000.SetForwardStream(OutputStream);
  // Set false below, if you do not want to see messages parsed to HEX withing library
  NMEA2000.EnableForward(false);
  NMEA2000.SetMsgHandler(HandleNMEA2000Msg);
  //NMEA2000.SetN2kCANMsgBufSize(2); << Don't need this for teensy
  NMEA2000.Open();
  OutputStream->print("Running...");

timolappalainen

If it would be on sw, none of my device would work. I have one board with MCP2551, which bricked and blocks the network too. Others with MCP2562 works still fine.

You get "not available", since your device reads 0xffff for all values and that will be translated as not available. Except for some reason you get 0 for fuel rate.

mavromatis

If it would be on sw, none of my device would work. I have one board with MCP2551, which bricked and blocks the network too. Others with MCP2562 works still fine.
OK -- will check to see if it's possibly HW related -- if I just listen -- comment out, everything seems to work fine... so it's something on the TX part back into the network.


You get "not available", since your device reads 0xffff for all values and that will be translated as not available. Except for some reason you get 0 for fuel rate.
Sometimes I get not available other times I get the values -- not a big deal because at least I get the values multiple times a second it seems...

Example with engine running:

In Main Handler: 127489
Engine dynamic params: 0
  oil pressure (Pa): 323900.00
  oil temp (F): 31.91
  coolant temp (F): 109.40
  alternator voltage (V): 14.43
  fuel rate (l/h): 3.90
  engine hours (h): 281.00
  coolant pressure (Pa): 9500.00
  fuel pressure (Pa): 296000.00
  engine load (%): 0
  engine torque (%): not available
...
...
... then a few moments later...
...
...
In Main Handler: 127489
Engine dynamic params: 0
  oil pressure (Pa): not available
  oil temp (F): not available
  coolant temp (F): not available
  alternator voltage (V): not available
  fuel rate (l/h): 3.00
  engine hours (h): not available
  coolant pressure (Pa): not available
  fuel pressure (Pa): not available
  engine load (%): not available
  engine torque (%): not available

Go Up