Emtron: Difference between revisions

Line 23: Line 23:


--set up virtual channels
--set up virtual channels
rpm_id = addChannel (“RPM”, 25, 0, 0, 10000, “RPM”)
rpm_id = addChannel ("RPM", 25, 0, 0, 10000, "RPM")
coolant_id = addChannel (“Coolant”, 1, 1, -30, 200, “Celsius”)
coolant_id = addChannel ("Coolant", 1, 1, -30, 200, "Celsius")
afr_id = addChannel (“AFR”, 10, 3, 0, 5, “Lambda”)
afr_id = addChannel ("AFR", 10, 3, 0, 5, "Lambda")
tps_id = addChannel("TPS", 10, 1, 0, 100, %)
tps_id = addChannel("TPS", 10, 1, 0, 100, "%")
igntiming_id = addChannel("IgnTiming", 10, 1, -30, 50, “Degrees”)
igntiming_id = addChannel("IgnTiming", 10, 1, -30, 50, "Degrees")


function process_rpm(data)
function process_rpm(data)
Line 33: Line 33:
     setChannel(rpm_id, rpm)
     setChannel(rpm_id, rpm)
end
end
function process_coolant(data)
function process_coolant(data)
     local coolant = ((data[6] * 256 + data[5])) * 0.1 - 50
     local coolant = ((data[6] * 256 + data[5])) * 0.1 - 50
     setChannel(coolant_id, coolant)
     setChannel(coolant_id, coolant)
end
end
function process_afr(data)
function process_afr(data)
     local afr = ((data[2] * 256 + data[1])) * 0.001
     local afr = ((data[2] * 256 + data[1])) * 0.001
Line 47: Line 45:
     setChannel(tps_id, tps)
     setChannel(tps_id, tps)
end
end
function process_igntiming(data)
function process_igntiming(data)
     local igntiming = ((data[4] * 256 + data[3])) * 0.1 - 100
     local igntiming = ((data[4] * 256 + data[3])) * 0.1 - 100

Revision as of 20:56, 28 February 2015

Emtron ECU

Emtron KV8.jpg

Configuration

This script integrates the Emtron ECU with RaceCapture/Pro telemetry, using the factory standard CAN bus mapping

Baud Rate

The default baud rate for Emtron is 1mbps.

  • You can configure this on the CAN bus configuration page in the RaceCapture App.

Channels

TPS

  • CAN ID: 1251
  • Bytes: 1,2 (little endian)
  • Scaling: 1000 = 0.0% ; 2000 = 100.0%
  • Precision: 0.1

Lua Script


setTickRate(30)

--set up virtual channels
rpm_id = addChannel ("RPM", 25, 0, 0, 10000, "RPM")
coolant_id = addChannel ("Coolant", 1, 1, -30, 200, "Celsius")
afr_id = addChannel ("AFR", 10, 3, 0, 5, "Lambda")
tps_id = addChannel("TPS", 10, 1, 0, 100, "%")
igntiming_id = addChannel("IgnTiming", 10, 1, -30, 50, "Degrees")

function process_rpm(data)
    local rpm = ((data[2] * 256 + data[1]))
    setChannel(rpm_id, rpm)
end
function process_coolant(data)
    local coolant = ((data[6] * 256 + data[5])) * 0.1 - 50
    setChannel(coolant_id, coolant)
end
function process_afr(data)
    local afr = ((data[2] * 256 + data[1])) * 0.001
    setChannel(afr_id, afr)
end
function process_tps(data)
    local tps = ((data[2] * 256 + data[1])) * 0.1 - 100
    setChannel(tps_id, tps)
end
function process_igntiming(data)
    local igntiming = ((data[4] * 256 + data[3])) * 0.1 - 100
    setChannel(igntiming_id, igntiming)
end

function onTick()
    repeat --will drain CAN buffer on each tick
        id, e, data = rxCAN(0)
        if id == 1250 then process_rpm(data) end
        if id == 1250 then process_coolant(data) end
        if id == 1251 then process_tps(data) end
        if id == 1254 then process_afr(data) end
        if id == 1256 then process_igntiming(data) end

    until id == nil
end