Electron / Photon CAN Bus Question - NMEA 2000

Hi,

I’m a maker working on a project that requires my microcontroller to interface with a CAN bus and send the data to the cloud. I have a variety of MCUs and dev boards in my possession, but using the Electron would be ideal due to the in-built cellular comms and CAN pins. I’m not sure if this will work though because I’m dealing with a variation of the NMEA 2000 network, which is built on top of a traditional CAN Bus for industrial purposes.

According to the documentation, I know that I’ll have to add a transceiver before connecting the CAN bus to the Electron. In the code, it looks like extended frames are supported, which is necessary for J1939 / NMEA 2000. I’ve also seen arduino libraries for NMEA2000, but I am unsure as to how well they’d port into the Particle ecosystem.

Has anyone successfully interfaced with NMEA 2000 / J1939 systems with their Photons / Electrons?

Thanks!

Yes, CANbus has been done, so extending it to NMEA2000 should be realistically achievable.

Take a look at Carloop:
www.carloop.io
Some of the creators of Carloop work at Particle in their day job, so that is a very reliable example.

The Carloop hardware design (including a transceiver) and the firmware library are all available on GitHub.

The Carloop is designed as an automotive-style diagnostic device, so it does not need termination of the CANbus. In your case, you will have to determine what termination you may need on the CANbus.

The Carloop library makes it easy to implement CANbus messaging, and the forums at community.carloop.io have discussion of what it takes to use the extended frames (29-bit if I recall correctly). You can build the protocol you need to use on top of the CAN messages.

2 Likes

With the interface working, canboat might be helpful.

I just realized one more important factor. J1939 is the specification used for heavy equipment. This runs on 24 volts!

Carloop is designed for general automotive and runs on 12 volts!
It has the appropriate Type A OBD connector for 12V.
WARNING: You cannot plug Carloop into 24V … you will smoke it.
Many equipment manufacturers do not follow the specification, they are supposed to (but do not) use a Type B OBD connector for 24V applications to prevent accidental mismatch.
More on connectors here:

If you copy the Carloop design, you will need to replace the power regulation, all the circuit protection and the OBD connector with an appropriate 24V design. While not trivial, it should not be too difficult to do, but you should be aware that you need to do it.

1 Like

Thanks @cyclin_al & @WoobaGooba for the info! It seems like we might be able to integrate the Electron into our industrial system using RS232 instead of CAN, which will be a simpler solution for our first revision.

A small correction/clarification to cyclin_al’s post for any future readers: J1939 is independent of system supply voltage - the CAN voltage levels are the same regardless of whether the system is 12V or 24V. Sure, the carloop might not survive if somehow powered from 24V - but the CAN signals should not normally see more than 5V on either line. The J1939 spec does not call for an OBD port at all - but there are some fairly standard “diagnostic” connectors used (such as Deutsch) - a search for “j1939 diagnostic connector pinout” gives some ideas of what is out there.

1 Like