This summer I built a CAN Shield for the Raspberry Pi Zero. The shield is the exact size of the Raspberry Pi, and fits directly on top of the computer. CAN Bus is a common protocol in use on vehicles like HyTech Racing’s Formula Student race car. This shield is much smaller than many of the shields I have seen online, which were designed for the larger original Raspberry Pi size.

I designed the 2-layer PCB using EAGLE. Linked here are the schematic, board, and Gerber files.

Some instructions to configure the Raspberry Pi for CAN Bus are here. Edit /boot/config.txt:

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay

Install can-utils using sudo apt-get install can-utils. Then after restarting, you can bring up the interface with sudo ip link set can0 up type can bitrate 500000.

I tested the shield, and it was able to properly read CAN Bus messages sent by a Teensy. The shield also contains 2 GPIO-controllable LEDs (pins 13 and 15), as well as a GPIO-attached button (pin 3). Using the RPi.GPIO Python library, I was also able to confirm that the LEDs can be enabled in software, and button presses can be read.

One improvement that could be made is to use the smaller TSSOP package size for the Microchip MCP2515 CAN Controller chip. That might allow enough room for a standard CAN Bus DB9 connector to fit on the end.

Raspberry Pi receiving CAN messages from Teensy
Raspberry Pi receiving CAN messages from Teensy