Skip to content

Instantly share code, notes, and snippets.

@MrPoofy
Last active April 17, 2024 23:18
Show Gist options
  • Save MrPoofy/8450b725ec45988c27e5e59bb99be383 to your computer and use it in GitHub Desktop.
Save MrPoofy/8450b725ec45988c27e5e59bb99be383 to your computer and use it in GitHub Desktop.
List of PIDs and calculations to retrieve Fiat 500e (2020 version) information from OBD
var command = [
"ATZ",
"ATD",
"ATE0",
"ATS0",
"ATAL",
"ATH0",
"ATSP7",
"ATCP18"
];
var command = [
"ATSHDA44F1",
"ATFCSH18DA44F1",
"ATCRA18DAF144",
"22A029",
"22A010",
"22A009",
"22A011",
"22A00A",
"22A042",
"ATSHDA40F1",
"ATFCSH18DA40F1",
"ATCRA18DAF140",
"22013C"
];
// SOH calc
// > 22A029
// 00A
// 0:62A029F9FFOO
// 1:04B00493000000
// ahrTotRead = [1][0-3]
// ahrResRead = [1][4-7]
var ahrTotRead = parseInt("04B0", 16)/10;
var ahrResRead = parseInt("0493", 16)/10;
var REAL_SOH = Math.round((ahrResRead/ahrTotRead)*1000)/10;
console.log("REAL_SOH: ", REAL_SOH);
// SOC
// > 22A010
// 009
// 0:62A0106D6D6C
// 1:6E6C6B00000000
// SOC [0][10-11]
var SOC = (parseInt("6C", 16)/255)*100;
console.log("SOC: ", SOC);
// VOLT MIN & MAX
// > 22A009
// OOF
// 0:62A009390F0E
// 1:350E3101108013
// 2:80120000000000
// voltMax [0][10-11] [1][0-1]
// voltMax [1][2-5]
var voltMax = parseInt("0E35", 16)/1000;
var voltMin = parseInt("0E31", 16)/1000;
var voltDelta = voltMax - voltMin;
console.log("voltMax: ", voltMax);
console.log("voltMin: ", voltMin);
console.log("voltDelta: ", voltDelta);
// BATERY TEMP
// > 22A009
// 00F
// 0:624009390F0E
// 1:360E3101108013
// 2:80120000000000
// baterytempRead [1][12-13]
var baterytempRead = parseInt("13", 16);
if(baterytempRead >= 128 ){
baterytempRead = baterytempRead - 256;
}
var bateryTemp = baterytempRead;
console.log("bateryTemp Celsius: ", bateryTemp);
// VOLT
// > 22A011
// 022
// 0:62A0110DA20D
// 1:A10DA0125FOCDA
// 2:0CC60B8F0CCBOC
// 3:C60CC50CC70D9F
// 4:04125F0B8F125E
// VOLT [1][2-5]
var VOLT = parseInt("0DA0", 16)/10
console.log("VOLT: ", VOLT);
// AMPERE
// > 22A00A
// 62A00A80108039
// AMPERE [6-9]
var AMPERE = ((parseInt("8010", 16)-32768)/20);
console.log("AMPERE: ", AMPERE);
// OBD VOLT
// > 22A042
// 62A0423723
// obdVolt [6-9]
var obdVolt = parseInt("3723", 16)/1000;
console.log("obdVolt: ", obdVolt);
// AMBIENT TEMP
// > 22013C
// 62013C70
// ambientTemp [6-7]
var ambientTemp = (parseInt("70", 16)/2)-40;
console.log("ambientTemp Celsius: ", ambientTemp);
KW = Math.round((VOLT*AMPERE)/100)/10;
console.log("KW: ", KW);
@SamuelBrucksch
Copy link

Nice, thanks for the comparison, i'll use your values then to calculate a proper offset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment