This tutorial shows you how to connect Raspberry Pi to CAN bus. and PCB gerber files are included.

Hardware Components

Y116MHzCrystal OscHC49US

Use 0805 and SO Packages for PCB and PTH and DIP for DIY Perforated boards

Wiring Diagram

Raspberry Pi Configuration

Update and Upgrade Raspberry Pi

sudo apt-get update
sudo apt-get upgrade

once that is done proceed to edit the /boot/config.txt in the terminal enter the following command

sudo nano /boot/config.txt

Uncomment the following line


Add the following lines


After editing save by pressing Ctrl+X followed by Enter. In the same terminal enter the following commands to install CAN bus utilities.

sudo apt-get install can-utils

After the above command executes successfully we have to add the below line to startup file /etc/rc.local before exit 0. This line will initialize the CAN bus interface with the given speed. In our case speed is 500Kb/s so it is 500000 bits per second

sudo ip link set can0 up type can bitrate 500000

reboot your raspberry pi using the following command

sudo reboot

once the raspberry pi is rebooted run the following command in the terminal to check if the CAN bus is initialized successfully.

dmesg | grep spi0

once the above command is executed you should be able to see the following response

this indicates the successful initialization of the CAN bus in Raspberry Pi. otherwise please check your wiring .


  • You can Download the PCB Gerber Here

Thanks for reading 🙂