CAN bus simulator on the Rasperry Pi
Eagle
Switch branches/tags
Nothing to show
Latest commit 84a6d43 Aug 29, 2016 @alan707 alan707 committed on GitHub fixed CSV format
Permalink
Failed to load latest commit information.
datasheets Simulator v1 working Jun 2, 2016
eagle fixed CSV format Aug 29, 2016
.gitignore Simulator v1 working Jun 2, 2016
LICENSE Initial commit Jun 2, 2016
README.md Fix borken link Jun 7, 2016
simulator.png Simulator v1 working Jun 2, 2016

README.md

CAN Simulator

This is a project we used to help develop and test the Carloop open-source car adapter. We hope you'll find it useful for your projects too.

Overview

The simulator consists of:

  • An OBD port (the same you have in your car under the steering wheel) to plug a device to test
  • The simulator board to convert CAN voltages to logic levels and provide 12V on the OBD port
  • A Raspberry Pi to run the simulator program
  • The program that communicates with the simulator board and that decide what to do with the CAN messages received

CAN simulator

Background about CAN

CAN is the communication bus used between most computers in cars. It has several physical layers, including a high-speed differential voltage (CAN high and CAN low) at up to 1 Mbit/second. CAN is a multicast protocol where each message has an identifier and up to 8 data bytes. Any node listening on the bus can receive any message transmitted. In order to make sense of the messages, the receivers need to know the data format used by the transmitter of each message for the data bytes.

There are higher level protocols built on top of CAN, most importantly ISO 15765 used for OBD-II (On-Board Diagsnotics II) mandated on all cars since 2008 and used on many cars before. See this tutorial by Sparkfun for more information about the OBD-II protocol

This CAN simulator can be used to transmit and receive messages simulating OBD-II communications and regular vehicle messages.

Simulator board

The heart of the simulator board is the MCP2515 standalone CAN controller that understands the CAN protocol and talks to the Raspberry Pi over the SPI bus.

The board also has a TJA1049 CAN transceiver to translate logic voltage levels to the differential voltage levels used for high speed CAN.

Since the OBD port is supposed to provide 12 volts, a simple 5V to 12V step up regulator from Pololu is included.

The OBD connector is part of an off-the-shelf 9-pin OBD ribbon extension cable available on Amazon.

Assembly instructions

Simulator program

The program running the simulation is in a separate repository. Currently it only sends fixed messages. It could be extended for more sophisticated communication or to replay logged CAN bus traces.

License

Copyright 2016 Julien Vanier. Distributed under the MIT license. See LICENSE for details.