CAN Bus Sniffer
My final project for embedded systems required us to connect to and analyze the CAN bus of a Ford 500. Our requirement was to simply create an LED that would be lit only if the vehicle was in park. This ended up being quite an interesting project which I may expand into my senior engineering project next year.
Working as a pair, my partner and I used several tools to analyze the CAN (Controller Area Network) messages. It is used mostly in the automobile industry to communicate between the various micro controllers throughout the vehicle. CAN is a multiple master broadcast based serial bus. Every message is sent to everyone, and each device has to filter out only the messages that it needs.
Our specific project used a PIC microprocessor with a built in ECAN module along with a CAN transceiver to perform the level shifting and low level communication. We used a demo board to connect the transceiver with to the PIC and also to provide power and a useful interface for connecting to the vehicles CAN bus.
Parts List
- SBC28PC Demo Board and programming cable
- PIC18F2680 - Microcontroller
- MCP2551 - CAN transceiver
- Microchip MPLab ICD 2 - Programmer/Debugger
- PCAN-USB or similar CAN sniffing tool
We learned which CAN messages we wanted using the USB CAN sniffing tool. We were able to clearly see which devices provided data to us on the bus by simply changing their state (opening a door, activating a turn signal, etc) and watching for changes on the bus. We were able to determine from here which ID belonged to messages from the PRNDL on our vehicle.
It was just a small amount of firmware along with the CAN libraries provided by Microchip that was needed from here. We would simply pull a pin up when we received a park message but leave it off in all other cases. The project was a straightforward, and we learned a lot from it.
The source code for the project firmware is available on Github.
Check out my other pages tagged "projects".