Reading from CAN bus with OBDLinx MX and RaceChrono
#12
The bus speed is included in the protocol. 6 and 7 are both 500kbaud. Interestingly, when I connect using the OBDLink MX app it claims it's using protocol 7, so 29-bit, but it definitely needs 6 (11-bit) in Racechrono, or when I try it manually in a terminal app. Not sure why that is, but at least it works!
#14
Updates:
Speed
Speed
PID: 448
Equation: bytestouint(raw,0,2)/65535.0*200*0.44704
imstimpy's description was close, but not quite right. The four two-byte pairs do each represent the speed, but they roll over at 200mph, 100mph, 50mph, and 25mph. (Or possibly 320kph, 160kph, 80kph, 40kph, which is almost the same thing - the scaling factor is slightly above 1.6. I think mph is more likely since it's round numbers though, and it's closer to the speed given by the speedometer.)
Edit: that's closer, but not quite right either. Per the post below, each couple of bytes is a speed at a different wheel, but they're each 15 bits instead of 16, so each one gets offset if you just take the bytes. The equation above does work fine for the LF wheel speed though. It converts to m/s, which RC will covert back to mph or km/h based on your units.
Lateral acceleration
I'm still not sure the scaling of this one, but I found the data traces extremely noisy in testing, so I don't expect it'll be useful.
Coolant temperature
PID: 300
Equation: A-40 (°C) or A*1.8-40 (°F)
So the first byte in PID 300 represents the temperature in °C, offset by 40°. That means when the register is 0, the temperature reading is -40, which was likely chosen because that's the crossover point of the F and C scales, so it makes conversions simple.
Intake temperature
PID: 300
Equation: B-40 (°C) or B*1.8-40 (°F)
Same as the coolant temp.
Speed
Speed
PID: 448
Equation: bytestouint(raw,0,2)/65535.0*200*0.44704
imstimpy's description was close, but not quite right. The four two-byte pairs do each represent the speed, but they roll over at 200mph, 100mph, 50mph, and 25mph. (Or possibly 320kph, 160kph, 80kph, 40kph, which is almost the same thing - the scaling factor is slightly above 1.6. I think mph is more likely since it's round numbers though, and it's closer to the speed given by the speedometer.)
Edit: that's closer, but not quite right either. Per the post below, each couple of bytes is a speed at a different wheel, but they're each 15 bits instead of 16, so each one gets offset if you just take the bytes. The equation above does work fine for the LF wheel speed though. It converts to m/s, which RC will covert back to mph or km/h based on your units.
Lateral acceleration
I'm still not sure the scaling of this one, but I found the data traces extremely noisy in testing, so I don't expect it'll be useful.
Coolant temperature
PID: 300
Equation: A-40 (°C) or A*1.8-40 (°F)
So the first byte in PID 300 represents the temperature in °C, offset by 40°. That means when the register is 0, the temperature reading is -40, which was likely chosen because that's the crossover point of the F and C scales, so it makes conversions simple.
Intake temperature
PID: 300
Equation: B-40 (°C) or B*1.8-40 (°F)
Same as the coolant temp.
The following users liked this post:
Nate Tempest (07-03-2022)
#16
Ahhh lol, that makes more sense. So it just looks like each 2-byte pair is getting increasingly precise because it's bit-shifted by 1. So my equation works because the least significant bit gets rounded off and doesn't make any difference, but it's just giving the LF speed. I'll have to see if I can se up multiple speed traces in RC, as it would definitely be interesting to compare wheel speeds at times.
#17
And it looks like you can track individual wheel speeds in RC, so these should be the equations unless I've made a mistake (haven't had a chance to test yet)
Wheel speeds
PID: 448
Equations:
LF: bitstouint(raw,0,15)/32767.0*200*0.44704
RF: bitstouint(raw,15,15)/32767.0*200*0.44704
LR: bitstouint(raw,30,15)/32767.0*200*0.44704
RR: bitstouint(raw,45,15)/32767.0*200*0.44704
To enter them, you pick Wheel Speed (kph) or (mph) (depending on your units setting) for channel, and then tap "Show More", and choose the specific wheel under Channel postfix.
Wheel speeds
PID: 448
Equations:
LF: bitstouint(raw,0,15)/32767.0*200*0.44704
RF: bitstouint(raw,15,15)/32767.0*200*0.44704
LR: bitstouint(raw,30,15)/32767.0*200*0.44704
RR: bitstouint(raw,45,15)/32767.0*200*0.44704
To enter them, you pick Wheel Speed (kph) or (mph) (depending on your units setting) for channel, and then tap "Show More", and choose the specific wheel under Channel postfix.
#19
Just confirmed the above works. And it's pretty cool looking at the different wheel speeds! You can watch one side going faster than the other on corners, see where you're starting to spin the rears, and, most interestingly, see whether the front or rears are starting to lock (antilock) first under braking.