← Back to Advanced Projects

šŸš— OBD-II CAN Bus Car Scanner

Decode live engine data from any modern car using MCP2515 and OBD-II PIDs.

šŸ“‹ Overview

Every modern car (1996+ in the US, 2001+ in Europe) has an OBD-II port that exposes the CAN bus — a robust automotive serial protocol. The MCP2515 is a standalone CAN controller that communicates via SPI with Arduino. By sending standard OBD-II Parameter IDs (PIDs), we can request engine RPM, vehicle speed, coolant temperature, throttle position, and read fault codes.

What you'll learn: CAN bus physical layer (CAN-H, CAN-L, differential signalling), MCP2515 SPI initialization and baud rate matching (500kbps for OBD-II), OBD-II request/response PID format, decoding multi-byte responses, and displaying data on TFT or OLED.

Estimated time: 2–3 hours. Difficulty: ⭐⭐⭐⭐ Advanced.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino NanoATmega328P, 5V1Compact, easy to mount in car
MCP2515 CAN ModuleSPI, 16MHz crystal1CAN bus controller + TJA1050 transceiver
OBD-II Breakout ConnectorStandard 16-pin J19621Plugs into car dashboard port
0.96" OLED DisplayI2C SSD13061Compact dashboard display
Wires & Enclosure1 setMount near OBD port

šŸ“– Step-by-Step Tutorial

1

Wire MCP2515 to Arduino

MCP2515 VCC → 5V, GND → GND, CS → Pin 10, SI → Pin 11 (MOSI), SO → Pin 12 (MISO), SCK → Pin 13, INT → Pin 2. Note: Use 5V power, not 3.3V.
2

Connect to OBD-II Port

OBD-II Pin 6 = CAN-H, Pin 14 = CAN-L. Connect to MCP2515 CANH and CANL. OBD-II Pin 16 = 12V battery, Pin 4 = Chassis GND — use a 12V→5V regulator.
3

Install CAN Library

Install mcp_can by Cory Fowler from Library Manager. Initialize at 500kbps: CAN.begin(CAN_500KBPS).
4

Send OBD-II PID Requests

Send a CAN frame: ID=0x7DF (broadcast), DLC=8, Data=[0x02, 0x01, PID, 0x00, 0x00, 0x00, 0x00, 0x00]. The ECU responds on ID 0x7E8 with the value.
5

Decode Responses & Display

Parse the response byte(s) using the PID formula. RPM = (byte3 Ɨ 256 + byte4) / 4. Speed = byte3 km/h. Coolant temp = byte3 āˆ’ 40 °C. Display on OLED.
šŸ’”
OBD-II PID support varies by car manufacturer and model year. Mode 01 (live data) PIDs are standardized, but not every ECU supports all of them. Always check if response[4] == requestedPID before decoding the value.

šŸ’» Code / Configuration

obd2_reader.ino
INO
// OBD-II CAN Bus Scanner - Volt X
#include <SPI.h>
#include <mcp_can.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>

MCP_CAN CAN(10); // CS on Pin 10
Adafruit_SSD1306 oled(128, 64, &Wire, -1);

// OBD-II PID codes (Mode 01)
#define PID_RPM       0x0C
#define PID_SPEED     0x0D
#define PID_COOLANT   0x05
#define PID_THROTTLE  0x11

void requestPID(byte pid) {
  byte msg[8] = {0x02, 0x01, pid, 0x00, 0x00, 0x00, 0x00, 0x00};
  CAN.sendMsgBuf(0x7DF, 0, 8, msg); // 0x7DF = OBD-II broadcast ID
}

int decodePID(byte pid, byte b3, byte b4) {
  switch (pid) {
    case PID_RPM:     return ((b3 * 256) + b4) / 4;
    case PID_SPEED:   return b3;
    case PID_COOLANT: return b3 - 40;

⭐Reviews & Ratings

—0 reviews
5ā˜…
0
4ā˜…
0
3ā˜…
0
2ā˜…
0
1ā˜…
0
...

Loading reviews...