OBD2 on a MG ZS EV

17 April 2024


I’ve got a MG ZS electric vehicle (see the review on this site). I’m very happy with it, however it lacks some information about what the battery is doing, particularly when charging. I believe the later models have more info – mine is a Gen1. I searched around and discovered that the OBD2 PIDs are available, enabling communication with the car’s computer. I bought a Bluetooth OBD2 dongle, and set up an old Android phone with the Torque Pro app to query the car’s ECU.

All of the info was then available, but Torque Pro is only able to be used on Android phones (and I use a iPhone). That means that I would have to power up the Android phone whenever I wanted to know something. So, I decided to use a ESP32-based controller to talk to the Bluetooth dongle and show all the info I wanted on a little display attached to the car’s dashboard – it would be available all the time, not just when I had the Android phone running.

This page describes the project and has links to the program.


OBD2 Dongle: I bought a AUTOHIL AX2 unit. It worked perfectly

ESP32: I used a NodeMCU-32S.

Display: I used a small SSD1306 128×64 (approx 25mm square)

Case: I have a 3D printer, so I printed my own case.

Code Library: I used the ELMduino library

How it Works

The unit looks like this on the dash:

The controller and the display are packaged into a 3D printed case which is Velcroed onto the dash. The power for the unit comes from the car’s USB power port. The hood above the display is to keep the screen in the shade (it’s not terribly bright). The unit powers up when you unlock the car. Conveniently, the Bluetooth dongle also powers up at that time.

The data that is extracted from the ECU is:

  • Voltage
  • Current
  • Vehicle speed
  • State of Health of the battery
  • State of Charge of the battery

The program checks these items about every second, and displays:

  • Power (both used and re-generated)
  • State of Charge
  • Economy (kWh/100km, averaged over the trip)
  • State of Health

In addition, with a tap of the touch-sensitive button on the front, you get:

  • Voltage
  • Current
  • km travelled on this trip
  • Number of errors (I’ve never seen any)

The main information I wanted was the rate of charging – in Australia, some of the chargers don’t tell you what they are doing, and the car only says what SoC it is. In fact the MG model I have only tells you the SoC (in %) when you are charging – the rest of the time all I have is the guestimate for how far I can travel.

Issues with the implementation are discussed on the ELMduino github site https://github.com/PowerBroker2/ELMduino/issues/202

The program is here. I don’t guarantee that it’s the latest version.

Update History:

Original 17 Apr 2024