free hit
counters
Exige V6 CAN bus mapping for RaceCapturePRO - Engine & Ancillaries/Gearbox - The Lotus Forums #ForTheOwners Jump to content


Exige V6 CAN bus mapping for RaceCapturePRO


Recommended Posts

Hi, I wonder if anybody is aware about the PID's and coding of the following signals on the CAN bus:  TPS, Clutch Switch, Brake Switch, RPM, Steering Angle and Wheel Speeds. The background of my question is that I have the RaceCapturePro MK2 package which has an open  source firmware. Now I like to aquire the signals above in a higher time resulution then possible via OBD. RaceLogic have decoded the signals so it's possible. I'm grateful for any suggestion. Cheers, Rainer

Link to post
Share on other sites
  • 2 years later...

Upgrade today to remove Google ads and support TLF.
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I'm not sure if you can add CAN bus signals to HLT. They need to be decoded and calculated. To my knowledge there are no further signals available then RPM, Throttle, Brake, Clutch, Steering, Whe

For all the guys having the same challange is here the lua script for accessing and decoding the main CAN bus signals. I also try to post the configuation for the UI-based can bus integration soon.

 

SampleRate=25
setTickRate(SampleRate)
CAN_baud=500000
CAN_chan=0
initCAN(CAN_chan, CAN_baud)

g_Clutch=0

g_GpsSpeed=0

I=0


rpmId=addChannel("RPM",SampleRate,0,0,8000,"1/min")
steerId=addChannel("Steering",SampleRate,1,-360,360,"Deg.")
brakeId=addChannel("BrakeSw",SampleRate,0,0,1)
DPMId=addChannel("DPM",SampleRate,0,0,10)
clutchId=addChannel("Clutch",SampleRate,0,0,1)
TPSId=addChannel("Throttle",SampleRate,1,0,100,"%")
GpsSpeedKmId=addChannel("GpsSpeed",SampleRate,1,0,300,"km/h")
speedId=addChannel("OBDSpeed",SampleRate,1,0,300,"km/h")
speed1Id=addChannel("Speed1",SampleRate,1,0,300,"km/h")
speed2Id=addChannel("Speed2",SampleRate,1,0,300,"km/h")
speed3Id=addChannel("Speed3",SampleRate,1,0,300,"km/h")
speed4Id=addChannel("Speed4",SampleRate,1,0,300,"km/h")
powerId=addChannel("Power",SampleRate,0,0,500,"PS")
AccelTotId = addChannel("AccelTot",SampleRate,2,0,2,"g")

function brakeFilter(value)
 return bit.band(value,0x01)
end

function clutchFilter(value)
 g_Clutch = 0
 if(bit.band(value,16)>0) then g_Clutch=1 end
 if(bit.band(value,32)>0) then g_Clutch=2 end
 return(g_Clutch)
end

function processWheel(id,data,offset,modul,factor)
  local highByte=data[offset+2]%modul
  local lowByte=data[offset+1]
  local value=highByte*256+lowByte
  value=value*factor
  setChannel(id, value)
end

function processDPM(id,data)
  local value=0
  if(bit.band(data[5],128)>0) then
    value = 1
    if(bit.band(data[6],8)>0) then
      value = 2
      if(bit.band(data[5],64)>0) then
        value = 3
      end   
    end
  end
  setChannel(id, value )
end

function processSteering(data)
  local steer=0
  if data[2] > 127 then
    steer=(data[2]-255)*256+(data[1]-255)
  else
    steer=data[2]*256 +data[1]
  end
  setChannel(steerId, (steer*0.09))
end

CAN_map={
[162]=function(data)
processWheel(speed1Id,data,0,32,0.0625)
processWheel(speed2Id,data,2,16,0.25)
map_chan(speedId,data,4,1,1,0) end,
[164]=function(data)
processWheel(speed3Id,data,0,32,0.0625)
processWheel(speed4Id,data,2,16,0.25) end,
[276]=function(data)
map_chan(brakeId,data,5,1,1,0,brakeFilter)
map_chan(clutchId,data,4,1,1,0,clutchFilter)
map_chan(TPSId,data,3,1,0.3984,0)
processDPM(DPMId,data)
map_chan(rpmId,data,0,2,0.25,0) end,
[133] =function (data) processSteering(data) end
}


function onTick()
  I=I+1

  processCAN(CAN_chan)

  local GpsSpeedKm=getGpsSpeed()*1.609344;
  local rpm=getChannel(rpmId)
  local speed=getChannel(speedId)
 

  local AccTot = (getImu(0)*getImu(0)+getImu(1)*getImu(1))^0.5
  setChannel(AccelTotId,AccTot)

  if(GpsSpeedKm ~= nil) then
    setChannel(GpsSpeedKmId, GpsSpeedKm)
    g_GpsSpeed = GpsSpeedKm
    if(GpsSpeedKm > 20) then startLogging()
    elseif(GpsSpeedKm < 5) then stopLogging()
    end
  end

 
  if(rpm ~= nil and g_GpsSpeed>5) then
   local m = 1300
   local cwa = 0.4*2.034458
   local rho = 1.2
   local FAcc = m*getImu(0)*9.81
   local FAir = 0.5*rho*cwa*(g_GpsSpeed/3.6)^2
   local FRol = 9.81*m*0.01
   local PowerMot = 1.136*1.36*((FAcc+FAir+FRol)*g_GpsSpeed/3600);  
   local gain = 0.2;
   g_PowerMot = gain*PowerMot+(1-gain)*g_PowerMot;

   setChannel(powerId,g_PowerMot)
  end
end

function processCAN(chan)
  local msg=0
  repeat
    local id, e, data=rxCAN(chan, 0)
    if id ~= nil then
      local map=CAN_map[id]
      if map ~= nil then
        map(data)         
      end
    end
    msg=msg+1
  until id == nil or msg > 100
end

function map_chan(cid, data, offset, len, mult, add, filter)
  if offset+len > #data then return end
  offset=offset+1
  local value=0
  local shift=1
  while len > 0 do
    value=value+(data[offset]*shift)
    shift=shift*256
    offset=offset+1
    len=len - 1
  end
  local cv=value*mult+add
  if filter ~= nil then cv=filter(cv) end
    setChannel(cid, cv)
end

 

 

Link to post
Share on other sites
  • 3 months later...

Hi Tomprout,

what do you mean exactly? The code above is for the lua interface of race capture pro mk2. It reads and decodes the following signals from the CAN Bus:

RPM, trottle, Brake, Clutch, Steering, Wheel speeds, DPM mode (tour, sport, race, off)

In addition the engine power is estimated.

Do you use a race capture device in conjunction with harrys lap timer? 

Link to post
Share on other sites

Hi,

I use Harry's laptimer (HLT) ios/android application with an OBD reader to retrieve data information like RPM, throttle, etc.. I was wondering if you had a list of PID because HLT allows to use custom PID in addition to the existing ones and I am looking for other PIDs not present in the HLT application like oil temp, etc...

 

Link to post
Share on other sites

I'm not sure if you can add CAN bus signals to HLT. They need to be decoded and calculated.

To my knowledge there are no further signals available then RPM, Throttle, Brake, Clutch, Steering, Wheel speeds, DPM mode (tour, sport, race, off) .

The stock Exige has no oil temperature sensor.

The PIDs and calculation you can get out of the lua script above. Those are the PDIs I decoded:

PID 162 : Wheel speed 1 and 2, and Car speed

PID 164 : Wheel speed 3 and 4

PID 276 : break switch, clutch, throttle, DPM, RPM

PID 133: Steering

 

 

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...