READ OBDII Data from electic Vehicle

Hi everybody,

I'm working on a Project to connect my electic Vehicle (Hyundai Ioniq) to the clound (thingsboard.io or similar) to see my charging Status while not around my car.

For this Approach I ordered a Freematics One+ (Freematics – Freematics ONE+ Model A)
Basically this device is an ESP32 with ELM327 and an XBee Simboard. While I got my SIM working and connect to thinger.io via http to update data I'm struggling with the OBD2 itself. (yeah maybe I should have checked this first before spending hours in writing code for parsing and uploading data)

So I've got the problem that I'm not able to recieve any Data from the OBD2 Port because my EV doesn't use standard PIDs at all. Just querieng the PID i need (2105 for example) doesn't bring any data back.

To get an idea I'm using the datalogger sketch provided by freematics with the included libraries.(Freematics/firmware_v5/datalogger at master · stanleyhuangyc/Freematics · GitHub)

Any help would be greatly appreciated and I'm willing to tip you for a helping idea.

Thank you in advance - I'm really running out of ideas as my skills in arduino are kinda limited.

Unless you can find the PID’s then I think you maybe stuck.
If you can search for some data on the ECU , you might come across something .

Google found this : GitHub - JejuSoul/OBD-PIDs-for-HKMC-EVs: Setting up Torque Pro to show OBD data on Hyundai / Kia E

Because its such a new vehicle does it not use canbus? If it uses the canbus protocol, you would be better off buying something like USB-tin from amazon, and sniffing the canbus. You could do a LOT more then play about with diagnostic data then. You could control most of the cars functions :slight_smile:

Hi,

I know my PIDs - the GitHub repo from JejuSoul is what I already dig into. The Car does use Canbus, but it doesn't use the default PIDs (only cars with combution engines are forced to do so by law).

So I know the Can Protocol used and I also know the PID i need to send and the answer I should expect. But I have problems to send those extended PIDs (or getting the answer) with the supplied libaries.

Maybe anyone ever created a working sketcu to bypass my commands to the ELM327 and redirect every UART input from the ELM327 back to the Serial console for first steps?

[1719]OBDUART v1.1
MEMS...OK
ACC Bias:-0.22/0.00/-1.22
OBD...[3668]ATZ
[3711]ELM327 v1.5
[3721]ATE0
[3766]OK
[3776]ATH0
[3819]OK
[3849]ATSP6
[3902]OK
[3932]ATSH 7E4
[3977]OK
[3977]2102
[4002]NO DATA

Seems communications works but I get no data.

20USD for the first to make it happen. :wink:

Hi NatroN,

It's been a while since you last posted, but I thought I would still share what I what I know....

I am also trying to access the Ioniq's BMS data, but using a different approach; autopi, which uses a RPi zero.

What is known so far is that the CAN bus is "quiet" on the Ioniq, as though one accesses via a CAN filter or router, so you will not be able to sniff the bus as there is no random traffic "visible" on the internal CAN connector. You can get info back by making a query request and waiting for the response.
I say internal, because there is another diagnostic connector under the hood (top left side when standing in front of the car). I have not interfaced this connector yet. Haven't a clue of its pinout...

I have been able to read out BMS data by performing a OBD query at 7E4#022101 (and 7E4#022102, 7E4#022103, 7E4#022104 and 7E4#022105). this is the format of the obd commands I use in the autopi terminal... you might be able to figure out something from that. I have not studied the CAN protocol, so am not too sure what the "02" preceding the "2101" is......

Take a look at https://github.com/JejuSoul/OBD-PIDs-for-HKMC-EVs/tree/master/Ioniq%20EV for a list of PID's, what they mean and how to convert the HEX to meaningful data.

Note, that the BMS (and other controllers in the car) do no respond when the car is off.

Hope this helps.
Good luck!

I know this is a super old thread, but if anyone is interested in trying to connect to an ELM327 using an ESP32, you can do it easily with the right steps:

1.) Make sure to setup classic bluetooth with “BluetoothSerial.h”
2.) When calling .begin(), make sure to include the second argument (bool true)
3.) Call .connect(“OBDII”) to connect to your ELM327
4.) Ensure you only send a carriage return (no newline!) when sending commands/queries to the ELM327

Here is a simple example program:

#include "BluetoothSerial.h"


BluetoothSerial SerialBT;


#define DEBUG_PORT Serial
#define ELM_PORT   SerialBT


void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
  
  DEBUG_PORT.begin(115200);
  ELM_PORT.begin("ESP32test", true);

  DEBUG_PORT.println("Attempting to connect to ELM327...");
  
  if (!ELM_PORT.connect("OBDII"))
  {
    DEBUG_PORT.println("Couldn't connect to OBD scanner");
    while(1);
  }

  DEBUG_PORT.println("Connected to ELM327");
  DEBUG_PORT.println("Ensure your serial monitor line ending is set to 'Carriage Return'");
  DEBUG_PORT.println("Type and send commands/queries to your ELM327 through the serial monitor");
  DEBUG_PORT.println();
}


void loop()
{
  if(DEBUG_PORT.available())
  {
    char c = DEBUG_PORT.read();

    DEBUG_PORT.write(c);
    ELM_PORT.write(c);
  }

  if(ELM_PORT.available())
  {
    char c = ELM_PORT.read();

    if(c == '>')
      DEBUG_PORT.println();
    
    DEBUG_PORT.write(c);
  }
}

If anyone is interested, ELMduino now supports ESP32 boards for easy connection and vehicle data queries!

hi, I’ve acquired ELM32 + OLED (Wemos lolin) specially for this task, and I’m not a programmer

first thought about using micropython first (with python obd), by playin & modifying some examples, but but haven’t found much around BT there

Then just came across this message.

I’m interested just in catching one PID and raising alert when needed (when DPF in my car starts to burn out)
That might be either sound (buzzer), screen information or LED
Do you think it’s easy achievable by few lines of code or requires a lot of modification

the sequence would be :

  • connect to ELM reader via BT
  • monitor certain PID value → raise alert

OBD header : 7E0
PID : 2220F2

OBD PIDs are generally split into two parts, Service and Message ID. Each part is a byte wide and can fully be represented with 4 hex characters. The PID you listed is 2220F2, which doesn't follow the standard. Where did you find this PID? Can you link a source?

These are taken from Opel (Vauxhaul in UK) forum and checked to work with Torque PRO

If these are easy to get I might as well display other values (from that page)
or cycle through then on 128x64 display

Ok, so it looks like you're trying to access a vehicle specific PID, which follows a different PID formatting standard. At some point I can do some testing to see if this is even possible with an ELM327. If so, I'll update the library. In the mean time, please submit an issue on ELMduino's GitHub page.

Power_Broker:
At some point I can do some testing to see if this is even possible with an ELM327.

What do you mean ?
I can confirm I tested it working on 2 different bluetooth ELM327 readers (supporting different ELM versions)
it worked even on cheapest ELM327 supporting not full set of ELM327 versions 1.0 & 1.2 & 1.3

Oh, true, forgot you mentioned that - I still need to do some testing to figure out just how to update the library. I still would like for you to submit a GitHub ticket if you can

Power_Broker:
Oh, true, forgot you mentioned that - I still need to do some testing to figure out just how to update the library. I still would like for you to submit a GitHub ticket if you can

Hi, I've just posted a reply to github ticket with data requsted
thanks!