Examples #169
Replies: 6 comments 1 reply
-
Yeah, I haven't been able to spend much time on documentation. (And there hasn't been much demand since this is mainly used for Signal K). simpleCan allows simple programs to read from a socketcan device. I don't know much about Arduino or MCP2515, so if you give me some more info about the data you're reading or more specific questions, I can help you along. |
Beta Was this translation helpful? Give feedback.
-
Hi Scott, thanks for commenting, Sorry I only mentioned arduino to indicate my level of experience - not a complete moron in general but moronic in the ways of Node. My goal is to read J1939 information, send back commands through J1939 (engine start/stop, monitor NMEA2000 and send alerts over NMEA2000. Display and control via an HTML / websocket interface. I'm at the stage where I can read NMEA2000 through socketcan, and I was hoping to use canboatjs for three functions:
Does simpleCan handle the bus addressing? How do you actually implement it? I tried: doofer.start() console.log('test') TypeError: Cannot read properties of undefined (reading 'canDevice') |
Beta Was this translation helpful? Give feedback.
-
simpleCan does handle all the handshaking, etc. And there's a way to declare custom pgns. (we can get into that once we get this working) This is a small example of using simpleCan. I don't have a way to test this right now, so hopefully it will work!
|
Beta Was this translation helpful? Give feedback.
-
Wow, thanks for taking the time to leave such a detailed reply! I tried it out, but it didn't work til I modified simpleCan.js from line 28 - might be a bug? looks like this:
I changed it to: (note **this.**messageCb( .... )
After which I modified the messageCb function to test the data output with COG:
So that part is now working well, although it is not appearing on my Garmin chartplotter as a NMEA2000 device. I fired a bunch of console.log() lines into the candevice.js file and it appears to be sending the isorequest and address claim and device information, but it's just not popping up on the garmin. It's also not sending anything over the CANbus when the chartplotter is plugged into the network, I'm pretty sure. I'm also pretty keen to have a go at the custom PGN's! |
Beta Was this translation helpful? Give feedback.
-
Definitely a bug! PRs welcome! I would not use And example of using custom PGNs: https://github.com/canboat/canboatjs/blob/master/test/customPgns.js |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help Scott Did I do the PR correctly? I have never done one before. I think I got most of the stuff going, the only thing I can't really check is the handshaking, which doesn't appear to be working but I don't have the equipment or knowledge to analyze exactly what is happening in that regard. For the benefit of whoever comes after me, this should be a working example which shows checking parsing incoming canbus data, utilising custom pgns and sending an example pgn on the canbus.
|
Beta Was this translation helpful? Give feedback.
-
Hi all
Thanks heaps for the hard work here.
I'm brand new to Node.js but have some experience with Arduino. I'm having a bit of a hard time wrapping my brain around what's required. Is there any examples anywhere which go over the various facets? Is there some documentation somewhere which describes what each module does? for example - what is the purpose of simpleCan?
I'm currently trying to read NMEA2000 & J1939 data through a pair of MCP2515 and output that information as html.
I would be quite happy to help with the documentation if help is needed
Beta Was this translation helpful? Give feedback.
All reactions