Hondata KPro4: Difference between revisions

(updated with latest.)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The following script adapts the Hondata KPro4 CAN to RaceCapture/Pro
=Introduction=
The following script adapts the Hondata CAN to RaceCapture/Pro. KPro4 and S300 CAN are supported.


[[Image:Hondata_KPro4.jpg]]
[[Image:Hondata_KPro4.jpg]]


<pre>
=Supported Channels=
--This example adopted to Hondata KPro4 CAN output
This integration supports the following channels:


--how frequently we poll for CAN messages, 30Hz is the max
* RPM
tickRate = 30
* EcuVolts
--the CAN baud rate
* IAT
CAN_baud = 250000
* EngineTemp
--CAN channel to listen on. 0=first CAN channel, 1=second
* TPS
CAN_chan = 0
* MAP
--1 for Big Endian (MSB) mode; 0 for Little Endian mode (LSB)
* InjectorPW
be_mode = 1
* Ignition
* Knock
* CamTiming


function toF(value)
==Wiring==
return value * 1.8 + 32
Connecting to the Hondata system requires two wires:
end


function toAFR(value)
* '''CAN1 High''' from RaceCapture  to '''CAN high''' of the Hondata system.
  return value * 14.7
* '''CAN1 Low''' from RaceCapture to '''CAN low''' of the Hondata system.  
end


CAN_map = {
For RaceCapture wiring, see the [[CAN_Bus_Integration|CAN integration guide]] for wiring details.
[1632] = function(data)
  map_chan(rpmId, data, 0, 2, 1, 0)
  map_chan(speedId, data, 2, 2, 0.621371, 0)
  map_chan(vltId, data, 5, 1, 0.1, 0)
end,
[1633] = function(data)
  map_chan(iatId, data, 0, 2, 1, 0, toF)
  map_chan(ectId, data, 2, 2, 1, 0, toF)
end,  
[1634] = function(data)
  map_chan(tpsId, data, 0, 2, 1, 0)
  map_chan(mapId, data, 2, 2, 0.1, 0)
end,
[1635] = function(data)
  map_chan(injId, data, 0, 2, 0.001, 0)
  map_chan(ignId, data, 2, 2, 1, 0)
end,
[1636] = function(data)
  map_chan(afrId, data, 0, 2, 0.00003051757, 0, toAFR)
end,
[1637] = function(data)
  map_chan(knkId, data, 0, 2, 1, 0)
end,
[1638] = function(data)
  map_chan(camId, data, 2, 2, 1, -20)
end,
[1639] = function(data)
  map_chan(anv1Id, data, 0, 2, 4096, 0)
  map_chan(anv2Id, data, 2, 2, 4096, 0)
  map_chan(anv3Id, data, 0, 4, 4096, 0)
  map_chan(anv4Id, data, 0, 6, 4096, 0)
end,
[1640] = function(data)
  map_chan(anv5Id, data, 0, 2, 4096, 0)
  map_chan(anv6Id, data, 2, 2, 4096, 0)
  map_chan(anv7Id, data, 0, 4, 4096, 0)
  map_chan(anv8Id, data, 0, 6, 4096, 0)
end
}


'''Note:''' Ensure RaceCapture and the Hondata system are grounded to a common location to prevent CAN bus data errors.


rpmId = addChannel("RPM", 25, 0, 0, 9000, "RPM")
If you are unsure about how to wire the Hondata ECU, or what connections to use, please contact [https://www.hondata.com/ Hondata] for support.
speed_id = addChannel ("RoadSpeed", 5, 0, 0, 200, "MPH")
vltId = addChannel("EcuVolts", 10, 1, 0, 20, "volts")
iatId = addChannel("IAT", 1, 1, 0, 100, "C")
coolantId = addChannel("Coolant", 1, 1, -30, 400, "F")
tpsId = addChannel("TPS", 10, 1, 0, 100, "%")
mapId = addChannel("MAP", 10, 1, 0, 15, "PSI")
injId = addChannel("InjectorPW", 10, 3, 0, 100, "ms")
ignId = addChannel("IgnTiming", 10, 1, -20, 20, "D")
afrId = addChannel("AFR", 10, 1, 5, 40, "AFR")
knkId = addChannel("Knock", 1, 0, 0, 15, "count")
camId = addChannel("CamTiming", 10, 1, -40, 40, "D")
anv1Id = addChannel("Anv1", 1, 2, 0, 5, "V")
anv2Id = addChannel("Anv2", 1, 2, 0, 5, "V")
anv3Id = addChannel("Anv3", 1, 2, 0, 5, "V")
anv4Id = addChannel("Anv4", 10, 2, 0, 5, "V")
anv5Id = addChannel("Anv5", 1, 2, 0, 5, "V")
anv6Id = addChannel("Anv6", 10, 2, 0, 5, "V")
anv7Id = addChannel("Anv7", 1, 2, 0, 5, "V")
anv8Id = addChannel("Anv8", 1, 2, 0, 5, "V")


function onTick()
==CAN termination==
    processCAN(CAN_chan)
The KPro4 does not have built-in CAN termination. You will need to also connect a 120 ohm resistor across the CAN High / CAN Low connections at the connections to the KPro4.
end


--===========do not edit below===========
==CAN preset==


function processCAN(chan)
Under CAN Bus, select 500Kbps for the baud rate and Termination On. 
    repeat
[[image:CANBUSBaudRate.png]]
        local id, e, data = rxCAN(chan)
        if id ~= nil then
            local map = CAN_map[id]
            if map ~= nil then
                map(data)       
            end
        end
    until id == nil
end


--Map CAN channel, little endian format
function map_chan_le(cid, data, offset, len, mult, add, filter)
    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 + add) * mult
if filter ~= nil then cv = filter(cv) end
    setChannel(cid, cv)
end


--Map CAN channel, big endian format
Under RaceCapture / CAN channels Setup, select the Hondata preset from the list of presets available.
function map_chan_be(cid, data, offset, len, mult, add, filter)
[[image:Hondata_CAN_preset.png]]
    offset = offset + 1
    local value = 0
    while len > 0 do
        value = (value * 256) + data[offset]
        offset = offset + 1
        len = len - 1
    end
local cv = (value + add) * mult
if filter ~= nil then cv = filter(cv) end
    setChannel(cid, cv)
end


map_chan = (be_mode == 1) and map_chan_be or map_chan_le
initCAN(CAN_chan, CAN_baud)
setTickRate(tickRate)


</pre>
After selecting the preset, write the settings back to RaceCapture
 
==Verifying Data==
 
Switch to the Dashboard mode, then page to the raw channels view.  You should see your Hondata channels updating in real time.

Latest revision as of 14:17, 6 January 2021

Introduction

The following script adapts the Hondata CAN to RaceCapture/Pro. KPro4 and S300 CAN are supported.

Hondata KPro4.jpg

Supported Channels

This integration supports the following channels:

  • RPM
  • EcuVolts
  • IAT
  • EngineTemp
  • TPS
  • MAP
  • InjectorPW
  • Ignition
  • Knock
  • CamTiming

Wiring

Connecting to the Hondata system requires two wires:

  • CAN1 High from RaceCapture to CAN high of the Hondata system.
  • CAN1 Low from RaceCapture to CAN low of the Hondata system.

For RaceCapture wiring, see the CAN integration guide for wiring details.

Note: Ensure RaceCapture and the Hondata system are grounded to a common location to prevent CAN bus data errors.

If you are unsure about how to wire the Hondata ECU, or what connections to use, please contact Hondata for support.

CAN termination

The KPro4 does not have built-in CAN termination. You will need to also connect a 120 ohm resistor across the CAN High / CAN Low connections at the connections to the KPro4.

CAN preset

Under CAN Bus, select 500Kbps for the baud rate and Termination On. CANBUSBaudRate.png


Under RaceCapture / CAN channels Setup, select the Hondata preset from the list of presets available. Hondata CAN preset.png


After selecting the preset, write the settings back to RaceCapture

Verifying Data

Switch to the Dashboard mode, then page to the raw channels view. You should see your Hondata channels updating in real time.