Python CAN bus monitor
This script allows you to read live data from a CAN bus or offline CAN data from a file and display it in an easy-to-read table.
It's primarily meant to be used in conjunction with an Arduino and a CAN bus shield. You'll need this Arduino sketch to make it work.
You can also use any serial device capable of reading a CAN bus. It expects data in this format:
X is the CAN frame ID (decimal),
Y is the number of bytes in the frame, and
ZZ:ZZ... are the actual bytes (in hex).
You can also read CAN frames from a text file.
This is designed to read log files generated by
candump (from can-utils) with
The log must contain one message per line. Messages must be stored in this format:
[(<timestamp>)] <interface> <frame_id>#<frame_data>
where frame id and data are in hex (upper case letters).
(1499430972.167877) can0 12E#C77FFE7FD0FFFF00
Install the dependencies (preferably in a virtualenv)
pip install -e .
Launch the script
canmonitor <serial device> <baud rate>
canmonitor -f <file name>
Press Q at any time to exit the script.
canmonitor /dev/tty.usbmodem1451 115200 canmonitor -f can_log.log