Emtron

From Autosport Labs
Jump to navigation Jump to search

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
    coolant = (coolant * 9) / 5 + 32
    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