I'm currently exploring different ways by which I can communicate with a truck's internal CAN bus system and would like some advice on the most appropriate solution for me.

I have overviewed the CAN and J1939 protocols used in trucks. I would like to take CAN (J1939) messages from the truck and decode them into human readable data.

I'm thinking of connecting a Linux-based board to the system with a CAN transceiver and a CAN controller then make an application with Python and SocketCAN to decode the data. Can this work be done with a microcontroller only? Without having to use an OS-based system.

I know about the ELM327 for example. What is the difference between the frames that I would get from it and those that I would get directly from a CAN controller (MCP2515 for example) through SocketCAN?

Would programming a PIC microcontroller with the Microchip J1939 library be of any use to me here?

  • \$\begingroup\$ There are always trade offs in latency, protocol bugs development time and choice of implementation. Start from understanding the best designs, and make specs, for each layer, not from what you are comfortable with. \$\endgroup\$ Feb 27, 2018 at 16:38
  • \$\begingroup\$ The motor vehicle stack may be relevant , see as an example : mechanics.stackexchange.com/q/12555/10976 \$\endgroup\$
    – Solar Mike
    Feb 27, 2018 at 18:31
  • \$\begingroup\$ An alternative is to just buy a pre-made CAN-to-USB adapter and the interface it from the PC with the manufacturer's own API. This is the easiest way, in my opinion. \$\endgroup\$
    – Lundin
    Mar 1, 2018 at 11:47

1 Answer 1


ELM327 is a factory-programmed PIC microcontroller that supports popular OBD2 protocols. It can also handle raw CAN but I would not count on it being a good CAN analyzer/sniffer or handle large amounts of data.

If your end goal is Linux and SocketCAN - I think it would be best if you just connected a MCP2515 HAT to a Raspberry Pi. You could then use the excellent Wireshark for analysis or write your own scripts. It is a popular and well supported configuration. Just google for countless tutorials.

If you go for a PIC MCU you will have to redevelop much of the drivers before you get into the SocketCAN subsystem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.