Go Down

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

scottdube

Timo,

I built the Teensy with an MPC2562 CAN BUS today, I get it to communicate with the NMEA Reader using the static temp values. I hooked up a DS18B20 and get a different readout but not accurate.  I can't tell what pin you intended the data to go to.  I used what I believe is A0 or pin 14 it is 2 from the end.   I  loaded a different sketch and the output was -127 which usually means the wrong pin is being used for the data or the probe isn't working.

Thoughts on that? 

timolappalainen

You do not need second USB. That was for debug/analyze device I made for someone who wanted to send simulated data from my NMEA Simulator on one port and listen with NMEA Reader on other port.

Which code you are using for DS18B20? The sketches I have found are not usable with NMEA2000, since they does not make things asyncronously. Without async. your system may just delay 700-800 ms on which time NMEA2000 library woult be polled and you will loose possible device queries. This leads to situation that you MFD will show up your device and then not. With async. one can get delays to 10ms, which is acceptable, if your device does not do anything else. The best solution would be to use 1-wire with DS2482-100 and improved i2c library.

A0 is pin 14 as you can see on Teensy Pinout. DS18B20 is rather accurate and reliable.

popeye_70

Yes you can. Take care that you provide "Not available" data to all fields you do not send on each PGN.
Thank you, Timo.

To test putting the "not available" data in one field i tried with a simpler PGN (the 130313 one) chosing field#5, and i think i found a mistake in the N2kMessages.h file...


I think

SetN2kPGN130313(N2kMsg, SID, HumidityInstance, HumiditySource, Humidity);

should be:

SetN2kPGN130313(N2kMsg, SID, HumidityInstance, HumiditySource, ActualHumidity, SetHumidity);


or maybe i'm looking at wrong/old Nmea 2000 pgn description list?

timolappalainen

You were right - it is fixed now. SetHumidity is optional parameter, since it is rarely needed.

... should allways tripple check others commits.

keith-i

Hi Timo and others

Firstly, a huge thank you to Timo for developing this excellent resource and making it available to all. It is great fun being able to develop my own devices and realise there is no limit to what can be done other than my limited but growing knowledge of coding.

I have successfully implemented the temperature monitor and that talks to my N2k bus nicely. However, I am having a little trouble getting a thermocouple to work (using a Max31855). At this stage I am just running trials with a Teensy 3.2 on my PC without a can tranceiver connected. After a few seconds of seeing pgn's appear on the serial monitor in the IDE it then just says 'send failed'. Am I doing something wrong in my code or is this some kind of buffer problem because I don't have a tranceiver connected yet?

Quote
CAN device ready
Start address claim for device 0
5600 : Pri:6 PGN:60928 Source:22 Dest:255 Len:8 Data:24,15,C3,FF,0,82,96,C0
5851 : Pri:7 PGN:126993 Source:22 Dest:255 Len:8 Data:60,EA,0,FF,FF,FF,FF,FF
8602 : Pri:5 PGN:130312 Source:22 Dest:255 Len:8 Data:1,1,3,B3,6A,FF,FF,FF
8603 : Pri:5 PGN:130311 Source:22 Dest:255 Len:8 Data:1,C3,B3,6A,FF,7F,FF,FF
11603 : Pri:5 PGN:130312 Source:22 Dest:255 Len:8 Data:1,1,3,B3,6A,FF,FF,FF
11604 : Pri:5 PGN:130311 Source:22 Dest:255 Len:8 Data:1,C3,B3,6A,FF,7F,FF,FF
14604 : Pri:5 PGN:130312 Source:22 Dest:255 Len:8 Data:1,1,3,B3,6A,FF,FF,FF
PGN 130311 send failed
14605 : Pri:5 PGN:130311 Source:22 Dest:255 Len:8 Data:1,C3,B3,6A,FF,7F,FF,FF
PGN 130312 send failed
17605 : Pri:5 PGN:130312 Source:22 Dest:255 Len:8 Data:1,1,3,B3,6A,FF,FF,FF
PGN 130311 send failed
17606 : Pri:5 PGN:130311 Source:22 Dest:255 Len:8 Data:1,C3,B3,6A,FF,7F,FF,FF
Code attached

Keith

timolappalainen

Thanks.

The send fails, if you do not have it connected to the bus. Actually it should be enough to have one terminator resistor on tranceiver, but I have not tested. You do not get error message immediately, since if buffers some messages and when buffer comes full, error starts to appear.

tmsio

Hi to all, thank you Timo for your work.
I m a beginners, but i wold you like to send some data from my ESP32 to N2k network.
I bought one NGT-1 usb gateway, to verify the data trasmitted from my ESP32.
I follow your guide, and i see temperature reading to NMEA reader via serial.
The next step is connect ESP32 to N2K network and read data from my ngt-1.
I connect GPIO4 and GPIO16 to MCP2562 pin 1 and 4 like this schema:
https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/ArduinoDUE_CAN_with_MCP2562.pdf
But i cant read data in NMEA reder via NGT-1.
Where is the error?

Thank You

Emiliano





timolappalainen

With quick look your connections seem to be OK, except I could not see is NGT-1 powered on NMEA 2000 side? You have to feed 12V to NMEA2000 bus, otherwice NGT-1 tranceivers will not get powered and it will not listen/send anything.

On NMEA Reader you can also allow NGT-1 to receive all data. Select Edit-Preferences...-"Transfer: Receive all"

tmsio

#458
Today at 08:25 am Last Edit: Today at 09:57 am by tmsio
Ouch!!!
Thank You Timo, il try to feed 12v.

:)

Edit:
All work fine!!!!
Thank You Timo

Go Up