## Polling canbus for MK60 brake pressure, and odb2 for IAT

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

MrBlahh
Posts: 45
Joined: Tue Sep 27, 2016 11:13 pm

### Polling canbus for MK60 brake pressure, and odb2 for IAT

I am trying to get IAT on my car so I can monitor the methanol injection IAT is on the obd2 channel but I've not found it int he canbus (2005 mini cooper S R53)

what's the best route to poll both at the same time? I'm already using both ports on the front of the racecapture one for bluetooth and one for wifi

I've also found how to pull brake pressure from the k-line bus, I've not looked into this yet I'm not sure if the canbus I'm tapping into is the same as the one the abs (MK60) is on

basically function call 21 06 and the pressure data is 21 02

the geniuses on m3forum posted this

The brake line pressures is present on the K-Bus by requesting the function call 21 06, and the brake line pressure offsets in 21 02. The formats are:

Status sensors (21 06):
Positive pressure:
B8 29 F1 02 21 06 45
B8 F1 29 0F 61 06 00 00 C3 DC 14 8F 14 A4 00 00 00 00 11 06

BrakeLinePressureFront = hex2dec('148F')/100 = 52.63 [bar]
BrakeLinePressureRear = hex2dec('14A4')/100 = 52.84 [bar]

BrakeLinePressureFront = hex2dec('1D31')/100 = 74.73 [bar]
BrakeLinePressureRear = hex2dec('1D1C')/100 = 74.52 [bar]

Neg. pressure by twos complement:
B8 29 F1 02 21 06 45
B8 F1 29 0F 61 06 00 00 C3 DC F7ED F783 00 00 00 00 11 06

BrakeLinePressureFront = (hex2dec('F7ED')-65536)/100 = -20.67 [bar]
BrakeLinePressureRear = (hex2dec('F783')-65536)/100 = -21.73 [bar]
BrakeLinePressureFront = (hex2dec('FFA5')-65536)/100 = -0.91 [bar]

Status sensor offset (21 02):
B8 29 F1 02 21 02 41
B8 F1 29 0C 61 02 FA89 FF18 1E81 FE5D 0000 A7

B8 F1 29 0C 61 02 xxxx yyyy 1E81 FE5D 0000 A7
xxxx = hex value in telegram of Offset Front
yyyy = hex value in telegram of Offset Rear
BrakeLinePressureFrontOffset = 0.000625*x + 2.3315e-15
BrakeLinePressureRearOffset = 0.000625*y + 2.3315e-15
where x is twos complement of xxxx (or yyyy) if neg value in xxxx (or yyyy) (msb set), otherwise pos value of xxxx (or yyyy).
Example: 0xFA89 => neg value since msb=1. Twos complement of 0xFA89 = -1399 => -0.87438 [bar].