{"id":1761,"date":"2024-02-03T20:33:22","date_gmt":"2024-02-03T09:33:22","guid":{"rendered":"https:\/\/gonzos.net\/projects\/?page_id=1761"},"modified":"2025-07-27T22:03:22","modified_gmt":"2025-07-27T12:03:22","slug":"obd2-on-a-mg-zs-ev","status":"publish","type":"page","link":"https:\/\/gonzos.net\/projects\/obd2-on-a-mg-zs-ev\/","title":{"rendered":"OBD2 on a MG ZS EV"},"content":{"rendered":"\n<p class=\"has-text-align-right\">17 April 2024<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Background<\/h2>\n\n\n\n<p>I&#8217;ve got a MG ZS electric vehicle (see the review on this site). I&#8217;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 &#8211; mine is a Gen1.  I searched around and discovered that the OBD2 PIDs are available, enabling communication with the car&#8217;s computer. I bought a Bluetooth OBD2 dongle, and set up an old Android phone with the Torque Pro app to query the car&#8217;s ECU. <\/p>\n\n\n\n<p>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&#8217;s dashboard &#8211; it would be available all the time, not just when I had the Android phone running.<\/p>\n\n\n\n<p>This page describes the project and has links to the program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Equipment<\/h2>\n\n\n\n<p><strong>OBD2 Dongle: <\/strong>I bought a AUTOHIL AX2 unit. It worked perfectly<\/p>\n\n\n\n<p><strong>ESP32: <\/strong>I used a NodeMCU-32S.<\/p>\n\n\n\n<p><strong>Display:<\/strong> I used a small SSD1306 128&#215;64 (approx 25mm square)<\/p>\n\n\n\n<p><strong>Case:<\/strong> I have a 3D printer, so I printed my own case.<\/p>\n\n\n\n<p><strong>Code Library:<\/strong> I used the ELMduino library<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How it Works<\/h2>\n\n\n\n<p>The unit looks like this on the dash:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-1-768x1024.jpg\" alt=\"\" class=\"wp-image-1767\" style=\"width:600px\" srcset=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-1-768x1024.jpg 768w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-1-225x300.jpg 225w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-1-730x974.jpg 730w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-1.jpg 800w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>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&#8217;s USB power port. The hood above the display is to keep the screen in the shade (it&#8217;s not terribly bright). The unit powers up when you unlock the car. Conveniently, the Bluetooth dongle also powers up at that time.<\/p>\n\n\n\n<p>The data that is extracted from the ECU is:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Voltage<\/li>\n\n\n\n<li>Current<\/li>\n\n\n\n<li>Vehicle speed<\/li>\n\n\n\n<li>State of Health of the battery<\/li>\n\n\n\n<li>State of Charge of the battery<\/li>\n<\/ul>\n\n\n\n<p>The program checks these items about every second, and displays:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Power (both used and re-generated)<\/li>\n\n\n\n<li>State of Charge<\/li>\n\n\n\n<li>Economy (kWh\/100km, averaged over the trip)<\/li>\n\n\n\n<li>State of Health<\/li>\n<\/ul>\n\n\n\n<p>In addition, with a tap of the touch-sensitive button on the front, you get:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-2.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-2-768x1024.jpg\" alt=\"\" class=\"wp-image-1768\" style=\"width:600px\" srcset=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-2-768x1024.jpg 768w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-2-225x300.jpg 225w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-2-730x974.jpg 730w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2024\/02\/MG-OBD-2.jpg 800w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Voltage<\/li>\n\n\n\n<li>Current<\/li>\n\n\n\n<li>km travelled on this trip<\/li>\n\n\n\n<li>Number of errors (I&#8217;ve never seen any)<\/li>\n<\/ul>\n\n\n\n<p>The main information I wanted was the rate of charging &#8211; in Australia, some of the chargers don&#8217;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 &#8211; the rest of the time all I have is the guestimate for how far I can travel.<\/p>\n\n\n\n<p>Issues with the implementation are discussed on the ELMduino github site <a href=\"https:\/\/github.com\/PowerBroker2\/ELMduino\/issues\/202\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/PowerBroker2\/ELMduino\/issues\/20<\/a><a href=\"https:\/\/github.com\/PowerBroker2\/ELMduino\/issues\/202\">2<\/a><\/p>\n\n\n\n<p>The program is <a href=\"https:\/\/gonzos.net\/obd\/OBD2-1-4.zip\">here<\/a>. I don&#8217;t guarantee that it&#8217;s the latest version.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update History:<\/h2>\n\n\n\n<p>Original  17 Apr 2024<\/p>\n","protected":false},"excerpt":{"rendered":"<p>17 April 2024 Background I&#8217;ve got a MG ZS electric vehicle (see the review on this site). I&#8217;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 &#8211; mine is a Gen1. I searched around and discovered that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1761","page","type-page","status-publish","hentry"],"blocksy_meta":{"page_structure_type":"type-3","styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages\/1761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/comments?post=1761"}],"version-history":[{"count":1,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages\/1761\/revisions"}],"predecessor-version":[{"id":1839,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages\/1761\/revisions\/1839"}],"wp:attachment":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/media?parent=1761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}