PiCan2 Raspberry Setup/Configuration

A video version of this guide can be found here

Hardware Requirements

Software Requirements

Installing Raspbian

The first step to getting started is to install Raspbian on the sd card, I wont go over this as the raspbian site has the best guide already


Once booted up, click the raspberry icon, then click preferences > Raspberry Pi Configuration

In here click interfaces, then enable ssh, and vnc viewer if you want to remote desktop to the pi. Whilst connected get the IP address of the pi, open a terminal and type


ifconfig car hacking

You then get this output, here you can see that the ip address for my pi is

Installing and configuring PiCan2

Physically installing the PiCan2 is as easy as dropping the HAT on top of the gpio pins and then screwing onto the stand offs.

Power on the pi and then once booted up, ssh into the pi.

Using the ip address that you got from the step above you need to ssh into the pi (if you are using a keyboard/mouse/display with the pi then skip these steps, open a terminal and go straight to configuring the PiCan2)

Mac/linux ssh

open a terminal window and type:

ssh pi@<ip>

you will then get a key request, type yes to add it to your list of hosts, the password by default is “raspberry”


Windows is slightly different (as an aside if you’re part of the unfortunate windows club, install linux subsystem for windows, its not needed for this but makes life much easier, and you can the follow the linux guides) for windows you need a nifty program called “putty”. Once installed open putty and type the ip address into the hostname box then click open. You will then get a message asking to add it to the host, click yes. Once you see the command prompt, when it says “log in as” type “pi” press enter, next is the password, by default it is “raspberry”, type this in and then press enter (you wont see anything when you type )

Configure the PiCan2

Install CAN software

The first step is to install the can utils, the first command to run is:
sudo apt update
This updated your apt sources so you get the latest packages whenever you install, once complete run:
sudo apt-get -y install can-utils libsocketcan2 libsocketcan-dev
This then installs all the required can packages. Now the required packages are installed you have to enabled the board and chip in the os itself, to do this type:
sudo nano /boot/config.txt
you will then have the nano text editor open, here use the arrow keys to scroll down until you see the following row:
delete the # symbol from the start of this row then go to the very bottom of the text file and add:

#CAN bus controllers

Everything is now installed, so type:
sudo reboot
Once it has rebooted reconnect and then run the following command:
sudo /sbin/ip link set can0 up type can bitrate 125000
This brings the canbus interface up, and seats the bitrate to 125k. 125k is for the medium speed bus, so generally the modules inside the car, window, door, audio modules etc. If you want to sniff the engine messages, use the high speed bus which is 500k, so in the command replace 125000 with 500000.

Communicate With The Bus

Connecting to the bus

With the hat all set up, you now need to connect physically to the bus, this involved wiring the can_h and can_l terminals on the HAT to the correct pins on the obd connector, generally there are atleast 2 buses on the connector, these are for, medium speed, high speed. Normally for the highspeed bus, can_h is pin 6 and can_l is 14. HOWEVER get hold of the wiring diagrams for your car and double check, certain manufacturers use different protocols on different pins, this is even more true when it comes to medium speed canbus, this doesnt need to follow any standard so they can be on any of the spare pins they choose. Below is a typical example of the obd wiring, showing some other protocols that can exist.

obd pinout

Getting our first data

With everything connected (and double checked) we can try and receive our first messages, open a terminal, or ssh in, and type
sudo /sbin/ip link set can0 up type can bitrate 125000
Replacing the bitrate with what you require, turn the ignition on and then type:
candump can0
You should now see a flood of canbus messages, if you dont, run ifconfig, verify there is an entry for can0 there, verify you have wired into the correct pins on both obd connector and the PiCan.

Wrap up

If the above has worked, you are now online with the can bus, and can begin to figure out what messages you want and can then go from there. Examples of what can be done from here can be found on my youtube channel which shows once you have done the canbus hacking part how you can implement UIs to interact with the car. Theres alot more tools we can now use which I will cover in seperate post, and eventually will go into how to build out the ui and tie it all together.


ModernDayMods is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com, buying the linked products gives me a small percentage :) .