Project tutorial
ED BMSdiag

ED BMSdiag © MIT

CAN bus hack for reading the battery diagnostics form an electric car.

  • 37 respects

Components and supplies

Ph a000066 iso (1) ztbmubhmho
Arduino UNO
10039 01
SparkFun CAN-BUS Shield
Pec36sfcn sml
Male-Header 36 Position 1 Row- Long (0.1")
for SparkFun CAN-Bus shield
SparkFun OBD-II to DSUB-9 cable
intended for international "makers"
OBD-II to DSUB-9 cable
intended for german (or european) "makers"
CANdiy-Shield v2 CAN-Bus Shield
IO voltage selectable between 3.3V and 5V, so you can use this shield with 3.3V boards!
Arduino Box for Arduino
out of stock @Arduino store, but you still find it at some distributors ;-)

Apps and online services

About this project


I am driving an electric car - a smart for two electric drive. The health of the traction battery is essential and is maintained by a battery management system (BMS). It will monitor all 93 cells during charge / discharge and cares about an equally voltage level balance. Normally only service tools can read information from this ECU.

The car is equipped with a GSM modem for accessing status data like state of charge (SOC), the available range and other simple information. For a certain time the modem was in extended mode gathering diagnostic information about the car. Curious about the content I tried to sniff into the CAN bus to know what was transmitted.

Inspired by similar projects for other electric cars - like the Nissan Leaf - I recorded the complete CAN bus traffic while driving or while charging the car. First sniffed streams really included those diagnostic data - but how to decode it?

You will find details about the CAN bus sniffing and reverse engineering in a separate article here.

What is Needed

Get the required hardware. On modern cars the physical layer is done via CAN bus. At least two CAN bus shields are available - see component list. You have to connect to the cars diagnostic port - the OBD-connector, so buy a cable or make your own. NOTE: there are two standards for OBD to DSUB-9 cables - pick the right one! See pictures below:

When you make your own cable, it is a good idea to use an old twisted pair networking cable. Use one of those paired wires for CAN-H and CAN-L. This will improve signal integrity. Also DO NOT exceed 1 m in length, to minimize signal reflections.

Get Started

Step 1

Prepare the hardware and find a nice case for the boards.

Step 2

Download the project from my github repository. See details there for installation. Compile the code and flash it to the Arduino.

Step 3

Connect to the car and power it up. Start the diagnostics session and get useful info about your battery pack...

Step 4

Use a spreadsheet program and find out correlating data. For example compare the SOC (State of Charge, from the dashboard) with the real SOC from the BMS. Or plot the cell-voltages and see that some cells are limiting the pack while charging, because they reach the cut-off limit at first...

Step 5

Improve the code if you want - do your own hacking. The Spakfun shield has a SD-card reader, so you could build your own CAN bus logger.

Or you build a nice frontend / app displaying the data...

I hope this tool will be helpful - Have fun!



OBD2-DB9 cable
for Sparkfun CAN-Bus shield
Obd2 db9 cable
OBD2-RJ45 cable
for CANdiy-shield
Obd2 rj45 cable


Similar projects you might like

Biometric Car Entry - True Keyless Car

Project showcase by Rajeev Velikkal

  • 44 respects

Engineering a Black Ice Detection System For Roadways

Project tutorial by 3 developers

  • 11 respects

Arduino 4WD RC Car

Project tutorial by Andriy Baranov

  • 74 respects


Project tutorial by zhaoshentech

  • 113 respects


Project showcase by Bill Lovegrove

  • 72 respects
Add projectSign up / Login