Posts: 1
Joined: Thu Sep 14, 2017 8:32 pm

CAN bus communication to and from a Pi

Thu Sep 14, 2017 8:36 pm

Hello, i am attempting to turn a Pi, model yet to be chosen, into a simple PLC using the can bus protocol.

Wondering if any pi supports can communication?

also, i am planing on using c++ as the programing language simply for execution speed. Wondering if anyone knows of any libraries that interpret can?


Posts: 11
Joined: Tue Jul 07, 2015 1:55 pm

Re: CAN bus communication to and from a Pi

Fri Sep 15, 2017 1:20 pm

The usual way is to use a can controller (eg. MCP2515) connected by the SPI interface to the PI.
Example :

Can bus is supported in the Linux kernel by socketcan and appears as a network interface. ... ng/can.txt

There are also test / debugging programs for socketcan here :

There are also USB can interfaces available but when I last looked but they were much more expensive and intended to be used with Windows PC's.
I hope this helps get you started.


User avatar
Posts: 6393
Joined: Sun Jul 22, 2012 4:14 pm

Re: CAN bus communication to and from a Pi

Fri Sep 15, 2017 1:32 pm

SK Pang does a CANBUS HAT. ... -1475.html
I've used one to communicate with PIC18F devices.

Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PICO,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Advanced users”