How to read your car’s CO2 footprint

daily and fully automated

an ESP32 – software exists, just download it
this nice standard ELM327 compatible OBD II adaptor fits also into your car. It connects via Bluetooth low energy to….

picked up by your home automation system, in my case Openhab2 and MQTT broker running on a raspberry
here in a housing, including optional display, in my car. It publishes the information via Wifi / MQTT protocol

A bit more into detail – „how to“ in a few minutes

Step1: get an OBD II adaptor, ELM327 compatible

as there are so many bad clones on sales, I preferred to directly purchase it from VeePeak. Device: OBDCheck BLE (without the „+“) works well. If you intend to purchase a different one: The app – writer of „Car Scanner“ gives a nice overview which are working well

Step2: download the ESP32 software

Stored it in github for you. Use the 3 files from directory: „ESP32-SW“. Big thanks to PowerBroker2 for writing almost all of the OBD sofware on ESP32 called ELMDUINO

Step3: program it into an ESP32 –

Hope you are familiar with the Arduino workspace? if not, start here. It is fairly easy to work with. Have all 3 files from the github (directory: ESP32-SW) into one directory. The directory name must be equal to the .ino file name. The comments on top of the .ino file inform you about the settings to take. Hint: compiler might tell you „too big, sorry“. Just change in „tools“ -> „Partition“ to „No OTA, 2MB app, 2MB SPIFFS“

optional: connect a little display. Here is the one I used. Attention: the 0.96″ and the 1.3″ look very similar, but need different SW drivers.

Step4: pick the mileage and fuel consumption information from your home automation system via MQTT

The Google Chrome browser has a very nice extension, called „MQTTLens„. it can write (=“publish“) and read/observe (=“subscribe“) to MQTT topics, in our case, „auto1/km“ and „auto1/tankinhalt“ Those MQTT-topics are exchanged via a so called broker. I am using the MOSQUITTO broker, running on my Raspberry, same machine on which my home-automation Openhab2 runs. Why MQTT? IMHO, it is THE IOT protocol, easy to understand and to use and supported by all home automation systems

Update: a new SW interface Mercedes – Openhab is available now. Means: data transfer from your Mercedes into Openhab without any hardware needed. find it in Github. This API seems to work for cars made since 2016

“ Side effects“ – what else is this useful for?

  • now that you have an OBDII adaptor: Download one of the many OBD apps for IOS or Android. Example: Car Scanner works nicely on my iPhone
  • fuel level tells you if you should plan 10 more minutes next morning to see the gas station.
  • temperature inside your car reminds you to consider 5 more minutes for scratching off the ice in winter, or open the doors for a bit in summer before starting
  • curious on your imagination what to do with mileage and fuel consumption

Community: How can you contribute

  • producers of OBD scanners: add MQTT protocols to your OBD wifi scanner. This would make the ESP32 redundant
  • enhance your smartphone apps to store fuel level and mileage – in order to forward it via MQTT once in reach of your home wifi. This would be very useful for all drivers parking their car outside their wifi range
  • dreaming that car manufacturers will publish the information DIRECTLY on an MQTT server – means: no need for a scanner / ESP32. I know I am an optimist…