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.
Exit the program before you turn off the PiJust 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