<div dir="ltr"><img src="https://api2.activeinboxhq.com/1.0/anon/rr/3cfa1c481eaefb97aafad7ab1f4ae783" width="1" height="1" style="display:none !important">Hi,<div><br></div><div>Can I ask someone to help me get started with pulling data off the OBD-2 on the I3.</div><div><br></div><div>I have info on what works via an LM327 and I know the pids, but it would help me for some pointers as to how to do it on the OVMS.</div><div><br></div><div>You know - the goal to get the first one working.</div><div><br></div><div>Here's an example definition - the SOC of the main battery.  This is extracted from decompiling a definition file for ediasbas/ediasblib:</div><div><br></div><div>(The "_EN" text is translated using Google cloud translate so the German is the original)</div><div><br></div><div>The "job" is defined like so:</div><div><br></div><div> <font face="monospace">        {<br>            "SERVICE" : "22",<br>            "ID" : "0xDDBC",<br>            "DIV" : "-",<br>            "INFO" : "aktueller Anzeige Soc",<br>            "RES_TABELLE" : "RES_0xDDBC_D",<br>            "ARG_TABELLE" : "-",<br>            "EINHEIT" : "-",<br>            "DATENTYP" : "-",<br>            "ARG" : "ANZEIGE_SOC",<br>            "LABEL" : "-",<br>            "ADD" : "-",<br>            "MUL" : "-",<br>            "INFO_EN" : "current advertisement Soc",<br>            "L/H" : "-",<br>            "RESULTNAME" : "-",<br>            "NAME" : "-",<br>            "SG_ADR" : "-"<br>         },<br></font></div><div><br></div><div>The "results" are defined like so:</div><div><br></div><div><font face="monospace">      "RES_0XDDBC_D" : [<br>         {<br>            "DIV" : "10.0",<br>            "INFO_EN" : "current advertisement Soc",<br>            "DATENTYP" : "unsigned int",<br>            "EINHEIT" : "%",<br>            "INFO" : "aktueller Anzeige Soc",<br>            "MASKE" : "-",<br>            "RESULTNAME" : "STAT_ANZEIGE_SOC_WERT",<br>            "L/H" : "high",<br>            "MUL" : "1.0",<br>            "ADD" : "0.0",<br>            "NAME" : "-"<br>         },<br>         {<br>            "NAME" : "-",<br>            "ADD" : "0.0",<br>            "MUL" : "1.0",<br>            "L/H" : "high",<br>            "RESULTNAME" : "STAT_MAXIMALE_ANZEIGE_SOC_WERT",<br>            "INFO" : "obere Grenze des Anzeige Soc",<br>            "MASKE" : "-",<br>            "INFO_EN" : "upper limit of the display Soc",<br>            "EINHEIT" : "%",<br>            "DATENTYP" : "unsigned int",<br>            "DIV" : "10.0"<br>         },<br>         {<br>            "RESULTNAME" : "STAT_MINIMALE_ANZEIGE_SOC_WERT",<br>            "L/H" : "high",<br>            "MUL" : "1.0",<br>            "NAME" : "-",<br>            "ADD" : "0.0",<br>            "DIV" : "10.0",<br>            "INFO_EN" : "lower limit of the display Soc",<br>            "EINHEIT" : "%",<br>            "DATENTYP" : "unsigned int",<br>            "INFO" : "untere Grenze des Anzeige Soc",<br>            "MASKE" : "-"<br>         }<br>      ],<br></font></div><div><br></div><div>I read it that three unsigned ints (16 bits each) are returned.</div><div>Each is divided by 10 to return a "%".</div><div><br></div><div><br></div><div>I traced an app that can retrieves this parameter using an LM327 based OBD2 interface.</div><div><br></div><div>That app initialises the LM327 like so:</div><div><br></div><div><font face="monospace">2020-11-15 10:34:28.831 --> ATD                     Return all settings to default<br>2020-11-15 10:34:28.849 --> ATE0                     Disable command echo<br>2020-11-15 10:34:28.861 --> ATH1                       Show CAN message headers<br>2020-11-15 10:34:28.875 --> ATAL                   Allow long messages<br>2020-11-15 10:34:28.887 --> ATPBE101                    Set programmable param 0x2c to 0xE1, 0x2d to 0x01<br>                                                    - 2c=0xE1:<br>          - 11 bit IDs<br>          - variable data-length code<br>          - 11 or 29 bit received IDs<br>          - use data format ISO 15765-4 (CAN)<br>       - 2d=0x01<br>          - Use rate divisor of 1<br>2020-11-15 10:34:28.901 --> ATSPB                      Use protocol USER1 CAN (as set above I think)<br>2020-11-15 10:34:28.949 --> ATBI                      Bypass initialisation - apparently a bad idea... ?<br>2020-11-15 10:34:28.964 --> ATSH6F1                      Set header bytes to 0x6F1 ( 0x06F1 ? )<br>2020-11-15 10:34:28.978 --> ATAT0                    Disable adaptive timing - wait up to ATSF time<br>2020-11-15 10:34:28.992 --> ATSTFF                   Maximum wait</font><br></div><div><font face="monospace"><br></font></div><div><br></div><div><font face="arial, sans-serif">Then, when it fetches this PID it does the following:</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">2020-11-15 10:34:35.101 --> ATCRA607⏎                       // Listen for 0x607<br>2020-11-15 10:34:35.114 <-- OK⏎⏎><br>2020-11-15 10:34:35.115 --> ATCEA07⏎                        // "extended address" 0x07 [matches 607?]<br>2020-11-15 10:34:35.127 <-- OK⏎⏎><br>2020-11-15 10:34:35.129 --> ATFCSH6F1⏎                      // Flow control header<br>2020-11-15 10:34:35.141 <-- OK⏎⏎><br>2020-11-15 10:34:35.143 --> ATFCSD07300800⏎                 // Flow control data<br>2020-11-15 10:34:35.156 <-- OK⏎⏎><br>2020-11-15 10:34:35.157 --> ATFCSM1⏎                        // Flow control mode<br>2020-11-15 10:34:35.170 <-- OK⏎⏎><br><br>2020-11-15 10:34:36.367 --> 22␣DD␣BC⏎                       // asking for "extended" PID 0xDDBC<br>2020-11-15 10:34:36.474 <-- 607␣F1␣03␣7F␣22␣78␣⏎            // this is some unrelated packet?<br>2020-11-15 10:34:36.539 <-- 607␣F1␣10␣09␣62␣DD␣BC␣02␣4C␣⏎   // reply --> 0x24C = 588 = 58.8 SOC<br>                      607␣F1␣21␣03␣A6␣00␣69␣FF␣FF␣⏎                          // 0x03A6 = = 93.4%, 0x0069 = 10.5%<br>2020-11-15 10:34:37.598 <-- ⏎><br><br>Remember the LM327 takes the sent bytes and wraps with into a full CAN message - though I'm not sure exactly how that comes out - I presume that "extended address" goes in somewhere.<br><br>--> 22 DD BC is the PID<br><-- 2 part reply.  First has the SOC.  Second has 0x03A6 (934) and 0x0069 (105)<br><br>First int is 588 or 58.8% which is the physical SOC of the battery.<br>934 is 93.4 which is the physical SOC level which the car displays as "100%" (i3 keeps some headroom "reserved").<br>105 is 10.5 which is the physical SOC level that the car displays as 0%.<br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">I'd appreciate some help to give me a head-start to be able to retrieve this attribute on the OVMS box.</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">Thanks,</font></div><div><font face="monospace">Steve</font></div><div><font face="monospace"><br></font></div></div>