A PiCAN 2 HAT provides your Raspberry Pi with full CAN-Bus capability: CAN v2.0B at 1 Mb/s and high-speed (10 MHz) SPI Interface. It uses the Microchip MCP2515 CAN controller with MCP2551 CAN transceiver.
The connection is made via DB9 or through a 3-way screw terminal. The SocketCAN driver is easy to install. To the application, it appears as can0. Programming can be done in Python or C.
This video shows some real-time OBD2 data logging done with PiCan 2 together with the Raspberry Pi. Here both the Raspberry Pi and the PiCan 2 are powered from the OBD 2 port. You can also power the Pi from USB.The
Exit the program before you turn off the Pi
Just plug in the (optional) power supply, wait for the Rpi 2 or 3 boot-up, and watch the logging of all available information (e.g. speed, RPM, temperature, ...).
This CAN message ./cansend can0 7DF#0201050000000000 sends a CAN ID (7DF) followed by coolant temperature request (data 02 01 05). To monitor the traffic on a CAN-bus network, use the command ./candump can0.
The candump command may not work on some vehicles, since a gateway separates the OBDII port from the CAN network. If this is the case, send an OBDII request first, like the coolant temperature request above.
Don’t forget to exit the application program before you turn off the Pi, so it closes the log file on the data storage card!
- CAN v2.0B at 1 Mb/s
- High-speed SPI Interface (10 MHz)
- Standard and extended data and remote frames
- CAN connection via standard 9-way sub-D connector or screw terminal
- Compatible with OBDII cable
- Solder bridge to set different configuration for DB9 connector
- 120 Ω terminator ready
- Serial LCD ready
- LED indicator
- Footprint for two mini push buttons
- Four fixing holes, comply with Pi Hat standard
- SocketCAN driver, appears as can0 to application
- Interrupt RX on GPIO25