anko
Well-known member
To extract some info from your OBDII port (for example the battery health expressed in Ah), please do the following:
Step 1: Buy an OBDII WiFi dongle and hook it up to your car (I believe you have one already, gwatpe)
Step 2: Connect your laptop to the WiFi network created by the dongle
Step 3: Open a telnet session from your laptop to the dongle. On a MAC for instance you type the following command in a terminal session (all OBDII dongles I worked with had this IP address and port number):
Step 4: Type the stuff in underlined font (<enter> is the enter key). Stuff in italic font are responses you would expect:
So far, you have:
- initialised the OBDII adapter (remember talking to modems? :mrgreen: )
- selected canbus protocol # 6 (ISO 15765-4 CAN 11 bit ID, 500 kbaud)
- enabled display of headers in responses
- enabled flow control for communication with device with address number 761 (which happens to be the "Hey, I want to talk to you" address for BMU ECU)
- defined the flow control string (300000)
- and mode (1)
- and told the dongle that the next non-AT command is targeted to device with address number 761
Now enter the mode (12) and pid (01):
Now you have the stuff you need, as 762 is the "Hey, I am talking back at you" address of the BMU ECU.
Find what you have where I had 01 54. Convert this from hexadecimal to decimal (see below) and divide by 10. This will give you the max charge capacity, or battery health in Ah.
I will start sharing other parameters that you can access, when time allows. In order to share in a more compact form, lets first agree on a way of referring to particular parts of the response. Take the relevant part of the response from the above example:
Not all characters are actual data, some are control characters. We do not care to much of them. I will reprint the response, replacing the control characters with XX and sequentially number the actual data bytes:
I can then specify the Health parameter from the example above as:
Request address = 761
Response address = 762
Mode + PID = 2101
Relevant Data Items = 27, 28
Formula = Total / 10
The actual charge in Ah could be specified as:
Request address = 761
Response address = 762
Mode + PID = 2101
Relevant Data Items = 29, 30
Formula = Total / 10
SOC in % would be:
Request address = 761
Response address = 762
Mode + PID = 2101
Relevant Data Items = 0
Formula = Total / 2 - 5
Or a bit shorter:
Parameter;Units;Request Adress;Response Address;Mode+PID;Relevant Data Byte(s);Formula
SOC;%;761;762;2101;0;Total / 2 - 5
Batt Health (how much charge can the battery contain);Ah;761;762;2101;27+28;Total / 10
Current Charge (how much charge does the battery current contain);Ah;761;762;2101;29+30;Total / 10
Charge Current (how much is going into or out of the battery);A;761;762;2101;14+15;Total - 1
Battery Total Voltage;V;761;762;2101;8+9;Total / 10
Example from OBC (On board Charger) ECU:
Number of charges at 100V;Count;765;766;2101;00+01;Total
Number of charges at 200V;Count;765;766;2101;02+03;Total
Example from Front Motor ECU:
RPM;Count;753;754;2102;2+3;Total - 20000
Example from Rear Motor ECU:
RPM;Count;755;756;2102;2+3;Total - 20000
Would that work?
Step 1: Buy an OBDII WiFi dongle and hook it up to your car (I believe you have one already, gwatpe)
Step 2: Connect your laptop to the WiFi network created by the dongle
Step 3: Open a telnet session from your laptop to the dongle. On a MAC for instance you type the following command in a terminal session (all OBDII dongles I worked with had this IP address and port number):
It may take a while, before the connection is established, but finally your screen should show:telnet 192.168.0.10 35000
Trying 192.168.0.10...
Connected to 192.168.0.10.
Escape character is '^]'.
Step 4: Type the stuff in underlined font (<enter> is the enter key). Stuff in italic font are responses you would expect:
ATZ<enter>
ATZ
ELM327 v2.1
>ATSP6<enter>
ATSP6
OK
>ATH1<enter>
ATH1
OK
>ATFCSH761<enter>
ATSH761
OK
>ATFCSD300000<enter>
ATFCSD300000
OK
>ATFCSM1<enter>
ATFCSM1
OK
>ATSH761<enter>
ATSH761
OK
>
So far, you have:
- initialised the OBDII adapter (remember talking to modems? :mrgreen: )
- selected canbus protocol # 6 (ISO 15765-4 CAN 11 bit ID, 500 kbaud)
- enabled display of headers in responses
- enabled flow control for communication with device with address number 761 (which happens to be the "Hey, I want to talk to you" address for BMU ECU)
- defined the flow control string (300000)
- and mode (1)
- and told the dongle that the next non-AT command is targeted to device with address number 761
Now enter the mode (12) and pid (01):
2101<enter>
2101
762 10 37 61 01 82 83 0F 8B
762 21 24 0F 88 03 0C 6E 52
762 22 03 4D 1C 01 99 00 00
762 23 00 00 00 01 00 01 30
762 24 0F 0F 01 54 00 CC 9C
762 25 FE 00 03 0F 88 86 8B
762 26 64 00 00 00 00 00 00
762 27 00 00 0F 8A 00 02 00
Now you have the stuff you need, as 762 is the "Hey, I am talking back at you" address of the BMU ECU.
Find what you have where I had 01 54. Convert this from hexadecimal to decimal (see below) and divide by 10. This will give you the max charge capacity, or battery health in Ah.
I will start sharing other parameters that you can access, when time allows. In order to share in a more compact form, lets first agree on a way of referring to particular parts of the response. Take the relevant part of the response from the above example:
762 10 37 61 01 82 83 0F 8B
762 21 24 0F 88 03 0C 6E 52
762 22 03 4D 1C 01 99 00 00
762 23 00 00 00 01 00 01 30
762 24 0F 0F 01 54 00 CC 9C
762 25 FE 00 03 0F 88 86 8B
762 26 64 00 00 00 00 00 00
762 27 00 00 0F 8A 00 02 00
Not all characters are actual data, some are control characters. We do not care to much of them. I will reprint the response, replacing the control characters with XX and sequentially number the actual data bytes:
XXX XX XX XX XX 00 01 02 03
XXX XX 04 05 06 07 08 09 10
XXX XX 11 12 13 14 15 16 17
XXX XX 18 19 20 21 22 23 24
XXX XX 25 26 27 28 29 30 31
XXX XX 32 33 34 35 36 37 38
and so on, depending on the length of the response, which can differ per ECU / PID and MODE.
I can then specify the Health parameter from the example above as:
Request address = 761
Response address = 762
Mode + PID = 2101
Relevant Data Items = 27, 28
Formula = Total / 10
The actual charge in Ah could be specified as:
Request address = 761
Response address = 762
Mode + PID = 2101
Relevant Data Items = 29, 30
Formula = Total / 10
SOC in % would be:
Request address = 761
Response address = 762
Mode + PID = 2101
Relevant Data Items = 0
Formula = Total / 2 - 5
Or a bit shorter:
Parameter;Units;Request Adress;Response Address;Mode+PID;Relevant Data Byte(s);Formula
SOC;%;761;762;2101;0;Total / 2 - 5
Batt Health (how much charge can the battery contain);Ah;761;762;2101;27+28;Total / 10
Current Charge (how much charge does the battery current contain);Ah;761;762;2101;29+30;Total / 10
Charge Current (how much is going into or out of the battery);A;761;762;2101;14+15;Total - 1
Battery Total Voltage;V;761;762;2101;8+9;Total / 10
Example from OBC (On board Charger) ECU:
Number of charges at 100V;Count;765;766;2101;00+01;Total
Number of charges at 200V;Count;765;766;2101;02+03;Total
Example from Front Motor ECU:
RPM;Count;753;754;2102;2+3;Total - 20000
Example from Rear Motor ECU:
RPM;Count;755;756;2102;2+3;Total - 20000
Would that work?
Converting from hex to decimal for dummies guide
Replace each character in the hexadecimal string with a value, as follows
0=0, 1=1, 2=2, .... 9=9, A=10, B=11, C=12, D=13, E=14, F=15
Reading right to left, multiply the first value with 1, the second with 16, the third with 256 and the fourth with 4096. Than add everything you have together.
Arbitrary first example: BF8A =
B = 11 * 4096 = 45056
F = 15 * 256 = 3840
8 = 8 * 16 = 128
A = 10 * 1 = 10
Total = 49034
Second example: 0154 = 0 * 4096 + 1 * 256 + 5 * 16 + 4 * 1 = 340. Divided by then it gives 34.0, my lays battery health.