XGauge (CAN-bus) for Dummies...

Discussion in 'ScanGauge' started by Dan, Jun 27, 2008.

  1. Dan

    Dan KiloTanked in post 153451

    EDIT:
    Ok... I feel pretty stupid but I finally get it now. I've been trying for weeks to get my head around what XGauge was doing. Took WFEC and the revelation that we were flying blind without Battery Amps on the Prius to focus my efforts.

    Well here's what I found. First let qualify that this is CAN-bus only. Since I'm a Prius Pilot that's all I've been focused on. So what I've found out is that there are two types of CanBus requests. Passive (snooping the bus) and active. Passive is kinda like ease-dropping on a conversation... the data is just there. Passive is like asking a direct question and expecting a direct answer.

    Now after doing a bit of digging there is lots of data out there for the taking... Here's what I "think" we can get:

    Passive
    L/R GForce = TXD { 0x002A }
    F/B GForce = TXD { 0x002B }
    Steering degrees L/R = TXD { 0x002D }
    Brake engagement % = TXD { 0x0038 }
    Speed (decameters / hour ) = TXD { 0x00BC }
    Gas pedal position = TXD { 0x024C }
    Battery Temp = TXD { 0x03C3 }
    Ignition timining = TXD { 0x052E }
    EV button (on/off) = TXD { 0x0521 }
    Gas Fill Level = TXD { 0x05AC }

    Active
    Battery SoC = TXD { 0x07E321CE }
    Battery Temp = TXD { 0x07E321CF }
    MG 1/2 RPM = TXD { 0x07E221C3 }
    MG 1/2 RPM = TXD { 0x07E221C4 }

    Now there is some other stuff like Headlights (on/off) and stuff like that that I'm not that interested in, but this data all looked pretty cool. I haven't gotten that deep into it so don't pepper me with Q's yet, but please help my "Teach Dan XGauge" thread.

    If you look for the Passive commands and you can't find them, it's because the passive TXD is derived by taking the ID, left padding it with zeros and XOR'ing it wish 0x0008. Now all this is Attila Vass data, so I don't know if Ron has already tried and failed to get these to work, or if he just figured, no prius driver in his right mind would be interested in how many lateral G's he pulls in a turn. I'm obviously not in my right mind :D

    GForce sensor is the first one I want to try to get working!

    Now once I get the TXD working we can work on the rest... Here's my current reference set:
    11011011
     
    Last edited: Jun 30, 2008
  2. bestmapman

    bestmapman Fighting untruth and misinformation

    Great thread dan. Can we also write to the can bus. What I am thinking is, can we command engine off when in Neutral. Thus having a glide above 42 MPH.
     
  3. Dan

    Dan KiloTanked in post 153451

    Alright... First new XGauge is tested and Verified.

    EV Button ( On / Off )
    TXD: 05 21
    RXF: 01 05 22 29 00 00
    RXD: 31 01
    MTH: 00 01 00 01 00 00
    NAM: EVb

    What you'll see on your Gauge is
    EVb ON
    EVb OFF

    And the fun part... It's real-time. No polling delay since it's packet sniffing. I leave it as a homework assignment to decode the logic I used to arrive at the XGauge coding.

    11011011
     
  4. TheForce

    TheForce He who posts articles

    Looks like your doing what I had planed to do. I just got my SG yesterday. After working with the RAW can-view data and the can-decoder software I'm now familiar with the raw CAN hex data and I know how to convert it.

    I'm Not familiar with the way the xgauge does the converting yet. I think I will need an example of how you get from Vass's info to what the SG displays. I'm sure its simple.

    I'm really interested seeing the Gforce in real time.
     
  5. Dan

    Dan KiloTanked in post 153451

    Look through the refereces I listed in the OP and all the XGauge stuff is pretty well explained.

    Here's the next dump of XGauges. These are blind codes (untested) so I don't know which work:

    Battery Temp (Max)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 38 08
    MTH: 00 01 00 01 00 00
    NAM: BTc

    Battery Temp (Min)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 30 08
    MTH: 00 01 00 01 00 00
    NAM: BTc

    Left / Right GForce
    TXD: 00 2A
    RXF: 01 00 02 22 00 00
    RXD: 10 10
    MTH: 00 01 00 01 FE 00
    NAM: LRg

    Front / Back GForce
    TXD: 00 2B
    RXF: 01 00 02 23 00 00
    RXD: 10 10
    MTH: 00 01 00 01 FE 00
    NAM: FBg

    Alignment (stear left / right)
    TXD: 00 2D
    RXF: 01 00 02 25 00 00
    RXD: 10 10
    MTH: 00 01 00 01 00 00
    NAM: Slr

    Break Pedal Position
    TXD: 00 38
    RXF: 01 00 02 30 00 00
    RXD: 30 08
    MTH: 00 64 00 80 00 00
    NAM: BPs %

    11011011
     
  6. TheForce

    TheForce He who posts articles

    I just tried out the G force setting while sitting still and here is what I seen.

    LRg stays at about 3 but if I shake the car the number jumps around a bit.

    FBg stays at 1 even when I shake the car.

    I will be leaving for work in about an hour and I will report back with my trip results.
     
  7. Dan

    Dan KiloTanked in post 153451

    Yeah, it's just a flat hex value. I haven't scaled it to actuall GForce. It should go way positive on a hard left and way negative on a hard right.

    11011011
     
  8. Dan

    Dan KiloTanked in post 153451

    OK.. got another two coded up but untested....

    Speed down to the hundredth place. I always disliked the fact that the speedo doesn't have a decimal point. Well now it does. The MTH was tricky on this so I'll actually be surprised if I got it spot on with the first attempt.

    kph xx.xx
    TXD: 00 BC
    RXF: 01 00 42 B4 00 00
    RXD: 38 10
    MTH: 03 E8 04 00 00 00
    NAM: kph xx.xx

    mph xx.xx
    TXD: 00 BC
    RXF: 01 00 42 B4 00 00
    RXD: 38 10
    MTH: 08 D8 0E 93 00 00
    NAM: mph xx.xx
     
  9. TheForce

    TheForce He who posts articles

    Gforce does work. Only problem is that the SG display rate is way too fast. You might have to divide the data by something to get it to slow down or to get an actual 0.00 gforce value.
     
  10. Dan

    Dan KiloTanked in post 153451

    All these passive commands are gonna refresh wicked fast. Can't be helped... that's how many canbus packets are flooding the bus. You could do some creative binary shift operations to clip off the last 4 bits or something. That should slow the jitter.

    11011011
     
  11. Dan

    Dan KiloTanked in post 153451

    OK... have three left to do but

    Left / Right GForce
    TXD: 00 2A
    RXF: 01 00 02 22 00 00
    RXD: 10 10
    MTH: 00 01 00 01 FE 00
    NAM: LRg

    Front / Back GForce
    TXD: 00 2B
    RXF: 01 00 02 23 00 00
    RXD: 10 10
    MTH: 00 01 00 01 FE 00
    NAM: FBg

    Alignment (stear left / right)
    TXD: 00 2D
    RXF: 01 00 02 25 00 00
    RXD: 10 10
    MTH: 00 01 00 01 00 00
    NAM: Slr

    Break Pedal Position
    TXD: 00 38
    RXF: 01 00 02 30 00 00
    RXD: 30 08
    MTH: 00 64 00 80 00 00
    NAM: BPs %

    Battery AMPs (passive)
    TXD: 00 33
    RXF: 01 00 82 3B 00 00
    RXD: 14 0C
    MTH: 00 01 00 01 00 00
    NAM: bta

    kph xx.xx
    TXD: 00 BC
    RXF: 01 00 42 B4 00 00
    RXD: 38 10
    MTH: 03 E8 04 00 00 00
    NAM: kph xx.xx

    mph xx.xx
    TXD: 00 BC
    RXF: 01 00 42 B4 00 00
    RXD: 38 10
    MTH: 08 D8 0E 93 00 00
    NAM: mph xx.xx

    tps %
    TXD: 02 4C
    RXF: 01 02 82 44 00 00
    MTD: 40 08
    MTH: 00 0A 00 02 00 00
    NAM: tps

    Battery SOC (passive)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 20 10
    MTH: 00 0A 00 02 00 00
    NAM: SoC

    Battery Temp (Max)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 38 08
    MTH: 00 01 00 01 00 00
    NAM: BTc

    Battery Temp (Min)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 30 08
    MTH: 00 01 00 01 00 00
    NAM: BTc

    Battery Volt
    TXD: 03 C5
    ... todo

    IGN (passive)
    TXD: 05 2E
    ... todo

    WTc (passive)
    TXD: 05 25

    Gas Gauge
    TXD: 05 AC
    ... todo

    EV Button Status
    TXD: 05 21
    RXF: 01 05 22 29 00 00
    RXD: 31 01
    MTH: 00 01 00 01 00 00
    NAM: EVb

    More later....

    11011011
     
  12. --cc--

    --cc-- Member

    Thanks for all the hard work, Dan!
     
  13. brick

    brick Answers to "that guy."

    ARGH! I can't take it anymore, I need a SGII so that I can play with this myself.
     
  14. TheForce

    TheForce He who posts articles

    After looking at the g-force data in real time could the actual g-force readout be the number currently displayed divided by 100 or 200? Dividing by 10 on the values I seen and have captured with my can-view would result in a high number for such low actual g-force. Dividing by 100 gets us to what looks like a real number.

    According to Vass's data 0x200 is neutral. If going to a negative value of 0x000 that means there is only room for 0x200 of play in g-force. Converted to decimal that would be 512. If you divide 512 by 100 you get 5.12 or a max reading of 5.12 g-force in each direction. This number seems to be about right for measuring the g-force a car will experience. Actually if you was pulling 5g in a car that's a pretty good indication your currently in a crash.

    I'm still looking into understanding the xgauge so Dan if you want to you may want to divide the g-force data by 100 unless you think it needs to be another divisor. I think I will update my can-view decoder program to do the division of 100.
     
  15. Dan

    Dan KiloTanked in post 153451

    Cool... Thanks for the test data. I keep thinking of Prius Pilots doing donuts in a mall parking lot trying to calibrate the G-Force gauge :p

    Here's the updated gauge that just thunks a decimal where you suggested.
    GForce to Right x.xx
    TXD: 00 2A
    RXF: 01 00 42 22 00 00
    RXD: 10 10
    MTH: 00 01 00 01 FE 00
    NAM: gfr

    GForce to Back x.xx
    TXD: 00 2B
    RXF: 01 00 42 23 00 00
    RXD: 10 10
    MTH: 00 01 00 01 FE 00
    NAM: gfb

    Stearing (degrees left) xx.xx%
    TXD: 00 2D
    RXF: 01 00 42 25 00 00
    RXD: 14 0C
    MTH: 00 64 01 BC 00 00
    NAM: sdl

    Break Pedal Position xx.x %
    TXD: 00 38
    RXF: 01 00 22 30 00 00
    RXD: 30 08
    MTH: 00 64 00 80 00 00
    NAM: bps

    Battery AMPs (passive)
    TXD: 00 33
    RXF: 01 00 82 3B 00 00
    RXD: 14 0C
    MTH: 00 01 00 01 00 00
    NAM: bta

    kph xx.xx
    TXD: 00 BC
    RXF: 01 00 42 B4 00 00
    RXD: 38 10
    MTH: 03 E8 04 00 00 00
    NAM: kph

    mph xx.xx
    TXD: 00 BC
    RXF: 01 00 42 B4 00 00
    RXD: 38 10
    MTH: 08 D8 0E 93 00 00
    NAM: mph

    tps xx.x%
    TXD: 02 4C
    RXF: 01 02 82 44 00 00
    MTD: 40 08
    MTH: 00 0A 00 02 00 00
    NAM: tps

    Battery SOC (passive) xx.x %
    TXD: 03 C3
    RXF: 01 03 82 CB 00 00
    RXD: 20 10
    MTH: 00 0A 00 02 00 00
    NAM: soc

    Battery Temp degC (Max / Upper)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 38 08
    MTH: 00 01 00 01 00 00
    NAM: buc

    Battery Temp degC (Min / Lower)
    TXD: 03 C3
    RXF: 01 03 02 3B 00 00
    RXD: 30 08
    MTH: 00 01 00 01 00 00
    NAM: blc

    Battery Volt (3CD pid)
    TXD: 03 C5
    RXF: 01 03 02 CD 00 00
    RXD: 20 10
    MTH: 00 01 00 01 00 00
    NAM: btv

    IGN (passive)
    TXD: 05 2E
    RXF: 01 05 02 26 00 00
    RXD: 18 10
    MTH: 00 01 00 01 00 00
    NAM: ign

    WTc (passive) xx.x
    TXD: 05 25
    RXF: 01 05 82 2C 00 00
    RXD: 18 08
    MTH: 00 0A 00 02 00 00
    NAM: wtc

    Gas Gauge xx.x %
    TXD: 05 AC
    RXF: 01 05 82 A4 00 00
    RXD: 18 08
    MTH: 00 64 00 04 00 00
    NAM: gas

    EV Button Status (on/off)
    TXD: 05 21
    RXF: 01 05 22 29 00 00
    RXD: 31 01
    MTH: 00 01 00 01 00 00
    NAM: evb

    I'm working on beautifying this into excel right now.

    11011011
     
  16. TheForce

    TheForce He who posts articles

    Hmmmmm That gives me an idea. I wonder if I can get one of my digital scales to work vertically? Tape a 1lbs weight to it, zero it out, do some doughnuts and compare the weight seen with the g-force data. Going in circles .5lbs would be .5g. I might give that a try sometime. :D
     
  17. Dan

    Dan KiloTanked in post 153451

    Allright... I've uploaded an Excel file with all the codes I hacked together. My list is by no means exhaustive, but it's better than the dinky three they originally had.

    Column1Column2Column3Column4Column5Column6Column7
    GAUGETXDRXFRXDMTHNAMNotes
    State of Charge07E321CE 056186CE0000 3008000A00020000SOC%
    Battery Voltage00330100023B00002010000100010000BTVHV Battery Volts
    Battery Current07E321CE056186CE000038100001000AF333BTAHV Battery Amps

    GForce to Right002A010042220000101000010001FE00gfrx.xx G's scaling a guess
    GForce to Back002B010042230000101000010001FE00gfbx.xx G's scaling a guess
    Stearing002D010042250000140C006401BC0000sdlDegrees left xx.xx %
    Brake Pedal Position00380100823000003008006400800000bpsxx.x % depression
    Battery Current00330100823B0000140C000100010000btaPassive CAN request
    Kilometers per Hour00BC010042B40000381003E804000000kphxx.xx kph
    Miles per Hour00BC010042B40000381008D80E930000mphxx.xx mph
    Gas Pedal Position024C0102824400004008000A00020000gpsxx.x % depression
    State of Charge03C3010382CB00002010000A00020000socPassive CAN request
    Battery Temp (upper read)03C30103023B00003808000100010000buc°C max for the 5 ms cycle
    Battery Temp (lower read)03C30103023B00003008000100010000blc°C min for the 5 ms cycle
    Battery Voltage03C5010302CD00002010000100010000btv3CD pid reading
    Ignition degrees before TDC052E0105022600001810000100010000ignPassive CAN request
    EV Button Status05210105222900003101000100010000evbEV button ON or OFF
    Engine Coolant Temp05250105822C00001808000A00020000wtcxx.x °C
    Gas Gauge05AC010582A400001808006400040000gasxx.x % full

    11011011
     
    Last edited: Jun 29, 2008
  18. xcel

    xcel PZEV, there's nothing like it :) Staff Member

    Hi Dan:

    ___SOB, you rock with the Prius X-Gauges!

    ___Good Luck

    ___Wayne
     
  19. Dan

    Dan KiloTanked in post 153451

    Updated the Excel file with all the codes.
    Code:
    CHANGELOG:
    
    v1.0 - 06-29-08: Initial Release.
    v1.1 - 06-29-08: Added Download Link.
    v1.2 - 06-29-08: Corrected Brake Pedal Position
                     Added °F for all the °C readings
                     Added Engine temp gauge (not coolant temp)
                     Added Jitter Reduction (clipped last bit)
                     Added Jitter Reduction (clipped last 2 bits)
    The Jitter reduction has to do with how fast the gauges refresh. The digits blur, so the x2 reduction clips the last bit, so you only get refreshes (on average) half the time. The x4 reduction clips the last two bits, so you only get a refresh (on average) 25% of the time.

    11011011
     
    Last edited: Jun 29, 2008
  20. TheForce

    TheForce He who posts articles

    Awsome! I just figured out how to get the TXD and MTH. I'm having a little trouble understanding RXF and RXD.
     

Share This Page