Page 1 of 1

Configure new pid

Posted: Fri Apr 23, 2021 7:23 am
by luisgonzalez
hi i bought an obd2 freematics one +

I am trying to set a new pid, the vehicle odometer


first I make the pid declaration in OBD.h in the library

#define PID_ODOMETER 0xA6

then I normalize the data in the file FreematicsOBD.cpp of the library

case PID_ODOMETER:
result = getSmallValue(data);
break;

and finally I include the new variable in the list of pid that you want to obtain, in the telelogger.ino file

PID_POLLING_INFO obdData[]= {
{PID_SPEED, 1},
{PID_RPM, 1},
{PID_THROTTLE, 1},
{PID_ENGINE_LOAD, 1},
{PID_FUEL_PRESSURE, 2},
{PID_TIMING_ADVANCE, 2},
{PID_COOLANT_TEMP, 3},
{PID_INTAKE_TEMP, 3},
{PID_ODOMETER, 4},
};

With the standard configuration of the telelogger I get this data frame through the udp protocol

A0HNZGJY#0:63186,10D:0,24:1376,20:0.00;-0.01;0.01,11:220421,10:16543960,A:4.758076,B:-74.061684,C:2723.800049,D:2.100000,E:36,F:7,12:145*B


Something else that usually happens to me is that if I indicate other pids already configured at the beginning, I do not receive the information of the new ones or of those that it brings by standard example

PID_POLLING_INFO obdData[]= {
{PID_DISTANCE, 2},
{PID_FUEL_LEVEL, 1},
{PID_SPEED, 1},
{PID_RPM, 1},
{PID_THROTTLE, 1},
{PID_ENGINE_LOAD, 1},
{PID_FUEL_PRESSURE, 2},
{PID_TIMING_ADVANCE, 2},
{PID_COOLANT_TEMP, 3},
{PID_INTAKE_TEMP, 3},
{PID_ODOMETER, 4},
};

data that comes to me

A0HNZGJY#0:41204,10D:0,24:1371,20:-0.01;0.00;-0.03,82:62,11:220421,10:16541770,A:4.757527,B:-74.061600,C:2817.800049,D:3.100000,E:12,F:10,12:4*14

what am I doing wrong?

or what do I need in the configuration?

There is some restriction on the amount of information that I can send through the UDP protocol or the device has a limit of the pid that I can send


Thank you very much for your help.