How to define a « custom PID » ?

I would like to monitor non-standard PID. Is a tuto exist to explain how to do that ?
OBDII is a OBDLink MX+ Bluetooth.

Comments

  • I'll write a tutorial. Hopefully it's ready in a day or two.
  • The custom OBD-II channels are defined under 'RaceChrono > Settings > Vehicle profile'. You can create multiple vehicle profiles, make sure you're editing the one you want.

    OBD-II SETTINGS:

    - Initialisation commands: These are the optional ELM327 commands send over to the OBD-II reader. Each command needs to be separated with '\n'. Leave empty if unsure.

    - Default protocol: If the 'Automatic' setting is not working for you, please select your protocol from the list.

    - Default OBD-II header: This is only needed when using custom OBD-II channels, that use their own OBD-II header. A 11-bit CAN-Bus default of 0x7DF will be used when left empty. Other bus types will need different default headers, such as VPW (0x 68 6A F1). Notice that prefix of '0x' is required for entering hexadecimal numbers.

    - Fast channels: Selects which high speed OBD-II channels are polled during the recording sessions. Each of the channels share a limited bandwidth, so select only ones that you need and cannot be set as 'Slow channel'.

    - Slow channels: Like 'Fast channels', but these channels are polled only periodically and therefore will take minimal amount of the shared bandwidth. Great for values that do not change often, such as most temperatures, odometer value, fuel tank level etc.

    - Test connection: Initialises a test connection to allow editing custom OBD-II channels which real and live data.

    OBD-II CHANNELS:

    - Show standard channels: Shows/hides the standard OBD-II channels. These channels are part of the OBD-II standard.

    - Add channel: Adds your own OBD-II channel, and opens the channel editor for it.

    CHANNEL EDITOR:

    - Channel and Channel postfix: These fields defines how the channel shows up in your sessions. Each channel has its fixed name and units. If a channel you need is missing, you can use the generic ones, like 'Temperature' or 'Pressure', and use the postfix of your liking, such as 'Pressure 12' or 'Temperature FR'.

    - OBD-II header: Some proprietary OBD-II PIDs require also a non-standard OBD-II header that can be defined here. Notice that prefix of '0x' is required for entering hexadecimal numbers.

    - PID: This is the PID number that used when requesting this OBD-II channel. For example '0x 01 0C' is the standard OBD-II PID for Engine RPM, and '0x 2C 10 04 58' is the proprietary PID for BMW e91's oil temperature. Notice that prefix of '0x' is required for entering hexadecimal numbers.

    - Source data: This field is used for testing your equations. When a 'Test connection' has been established (see previous chapter), this field will contain the real OBD-II response from your vehicle. When not using the test connection, you can enter a response value manually. Notice that prefix of '0x' is required for entering hexadecimal numbers.

    - Equation: The equation defines where the channel data is located in the OBD-II response message, and how it is translated to actual channel values. The equations are explained here: https://racechrono.com/support/equations

    - Solution: This will print out the full solution of the equation, when all the required fields are defined.
  • Let me know if you have questions, so I can refine the tutorial!
  • I'm trying to add custom PIDs for my BMW M2 and got some very interesting info from here https://www.facebook.com/groups/1288770887817789/permalink/3499562616738594/

    QUOTE:
    -----------------------------------------------------------------------------------------
    Steering: ID 770, offset 3, length 2, signed, formula *10/1+37130 this gives me ALMOST a correct per degree reading. It's accurate for around 180* but once you get to 360* of actual turning, it's not quite right. For on track purposes, this isn't a big deal as we really shouldn't be beyond 180*
    Throttle: ID 217, offset 3, length 1, unsigned, little endian, formula *17/2.55-107 this gave me a reading of 0-100 through the range of depression of the throttle pedal. It appears to be directly measuring the commanded throttle input, not what the throttle acutaror on the throttle body is receiving from the computers since that seems to be torque on demand.
    RPM: ID 165, offset 6, length 1, unsigned, little endian, *70/1+0 as best as I can tell this is accurate. I don't have another gauge to easily read a digital output of the RPM's but seems to be accurate compared to what it shows on the tach.
    Brake pedal: ID 239, offset 3, length 1, unsigned, little endian, *-2.2/1+275 this may be measuring the pedal distance of the brake pedal, I can't really 100% varify that it's measuring the pressure directly, but the formula gives me a 0-100 from no pressure to putting everything I have into the brake pedal, so should be good for comparing data for my purposes.
    -----------------------------------------------------------------------------------------


    For steering angle my take on the equation is bytesToInt(raw,3,2)*10+37130 which I think should be correct



    One problem though, I think ID 770 is decimal because I logged 0x0302 with some other hardware and it looked that it could be it. But if I try to add PID 770 or 0x0302 I just get "Please enter a valid PID value" on both?






  • I think that is direct CANbus, not PID, and not yet supported by RC.
  • edited September 17
    If you turn on "Unrestricted Custom pids" under expert settings I can enter 0x302. Not sure it's available on the OBD2 connector though. I sort of doubt it.
  • The ID 770 (dec) went through but not the three other lower IDs
  • aolaol
    edited September 17
    @MagnusThome Looks like that description is for CAN-Bus. You can do that as well with RaceChrono, if you have OBDLink reader or a DIY one. This tutorial is about custom OBD-II, but configuring CAN-Bus is actually very similar.

    But technically OBD-II is a standardised protocol that is built on top of CAN-Bus protocol (Or K-line, or VPW or ...). The CAN-Bus functionality in RaceChrono monitors payload on raw CAN-Bus messages send by ECUs of the vehicle in constant rate.
  • edited September 17
    Yes, and it's for looking for broadcasted CAN messages not requested OBD2 messages. I wasn't sure if these could be requested too though. I'm a bit rusty on what can be requested and what you ONLY can get by waiting for broadcasted messages. And the number of different CAN buses that can be reached by requests over the OBD2-connector. Not all 100% clear for me.

    I'm putting together the brilliant https://github.com/aollin/racechrono-ble-diy-device/ as we speak to get this up and running :-) Looking at where to splice into the bus, I have the one in the instrument cluster connected to an ESP32 but I think that's the wrong CAN bus. Will check, k-can, pt-can and whatnot...
  • aolaol
    edited September 17
    @MagnusThome OBD-II PIDs and CAN-Bus PIDs are unrelated. Same name for different ID. On OBD-II the PID is used for polling (request/response), and on CAN-Bus it's used for filtering the broadcasted messages. Good luck with the CAN-Bus hacking!
  • Yup. OBD2 is using just one PID for request and one for reply. Everything else is inside the data packet.
  • edited September 17
    Between the different CAN-buses on BMW (pt-can, k-can, d-can (=the OBD2 connector), k-can2, pt-can2) there are bridges/routers A.K.A. gateway so traffic can be passed over between the buses. This part is very blurry for me. Are there some pids that are broadcasted between the buses. Well obviously for the d-can but also probably more, rpm for example needs to be available on multiple buses. So are there routning lists sort of? And secondly, among all the pids that are used, are there a number of CAN pids that work like the OBD2 request pid, are there other data (pids) that one can send a request for, for example over the brdiges/routers.

    This above is not asking a question. Just rambling on about stuff I don't have full grip over :-) Here's a good read on the gateway "FEM" in a BMW https://bimmerscan.com/bmw-front-electronic-module-fem/
Sign In or Register to comment.