Power in Flux
Likes Likes:  0
Results 1 to 7 of 7

Thread: OBD2: How to read a PID ?

              
   
   
  1. #1
    Senior Member Hugues's Avatar
    Join Date
    Jan 2012
    Location
    Switzerland
    Posts
    1,067
    Post Thanks / Like

    OBD2: How to read a PID ?

    Hi guys,

    I'm working on a project and i need to read a PID coming from my OBD2 connection with Orion BMS and Curtis.

    On the first picture below, to get the voltage of the lowest cell, we need to send 22f032 and we receive 62F032298EE from the CAN bus. SInce the equation for that PID is ((A*256)+B)/10000, we can see that A is the first byte after F032 so 98 and B is the next one so EE. Convert these hexadecimal values to decimal, place them in the equation and you can find 3.915 volts.

    Where i'm blocked, is when i need to read the motor amps, next picture. We need to send b48601 and the equation is ((E*256)+F)/10. From the response (00B 0:F48601...), I don't see on which byte we read E and F. E seems to be hex 00, i see some 00, but F is hex 20, and i don't see any 20 in the response.

    Hope my problem is stated clearly

    22f032.jpgb48601.jpg
    Regards from Switzerland
    My 2.5 Upgrade Thread

  2. #2
    Empulse R #24 frodus's Avatar
    Join Date
    Aug 2010
    Location
    Portland, OR
    Posts
    2,372
    Post Thanks / Like

    My Social Networking

    Follow frodus On Twitter
    What software are you using?

  3. #3
    Senior Member Hugues's Avatar
    Join Date
    Jan 2012
    Location
    Switzerland
    Posts
    1,067
    Post Thanks / Like
    Quote Originally Posted by frodus View Post
    What software are you using?
    well the screen shots above are from Torque, but believe it or not i am writing my own app for Android, yes, using MIT App Inventor 2, cool program, web based.

    I looked again at the data i receive, see picture below, could the data be mapped like i show ? you will tell me that E is 21 on my screen and not 20. But when i took the screen shot on my computer, the data on screen was changing rapidly, it could be that i caught it while refreshing the screen. I'm planning to try this mapping tonight and compare with Torque.

    Capture.JPG
    Regards from Switzerland
    My 2.5 Upgrade Thread

  4. #4
    Empulse R #24 frodus's Avatar
    Join Date
    Aug 2010
    Location
    Portland, OR
    Posts
    2,372
    Post Thanks / Like

    My Social Networking

    Follow frodus On Twitter
    Have you looked around on the Torque Forum? I posted there a lot back in the day.... pretty helpful.

    It looks like you're correct.

  5. #5
    Seņor Member podolefsky's Avatar
    Join Date
    Oct 2010
    Location
    Boulder, CO
    Posts
    3,889
    Post Thanks / Like
    You got it. B48601 returns an extended frame message where the bytes go into A-F.

    Keep in mind temperatures and amps are signed, so you have to use 2's complement to get the correct positive or negative decimal value.
    - Noah Podolefsky -
    The GSX-E

  6. #6
    Senior Member Hugues's Avatar
    Join Date
    Jan 2012
    Location
    Switzerland
    Posts
    1,067
    Post Thanks / Like
    ok, i got the motor amps now, these were the 2 bytes. I did not modify the code yet to account for signed values, will add this later.

    For those interested in writing your own apps for Android phone, check out: http://ai2.appinventor.mit.edu/

    It's a free web based program to code your own apps, without actually coding, you just assemble blocks together, it's much easier than coding, ok there's surely things you cannot do this way that require real code like Android studio, but you can get your first app in no time. You just have to install the MIT app inventor companion on your phone from the Play store, then when you're finished to create your program, you click on build, it displays a 2d bar code which you scan with the app companion and the app runs right away on your phone, pretty cool. YOu can also create an apk file when you are done to actually install a standalone app on your phone or share.

    I attach a zip file of my program to read the motor amp PID, just unzip and import the file into App inventor and you will see my screen and blocks, you can modify the blocks to suit your needs. I started from a program downloaded from the gallery made by a guy in Mexico i think, you can still see some spanish words in the program. You will need to have a bluetooth adapter for your OBD2 connector.

    Thanks guys !

    Get_motor_amps_from_OBDII_to_set_volume.aia.zip
    Regards from Switzerland
    My 2.5 Upgrade Thread

  7. #7
    Seņor Member podolefsky's Avatar
    Join Date
    Oct 2010
    Location
    Boulder, CO
    Posts
    3,889
    Post Thanks / Like
    Awesome project!
    - Noah Podolefsky -
    The GSX-E

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •