Going beyond the normal in ECU mapping

Digging deeper with a programmable ECU

by Julian Edgar

Click on pics to view larger images

Aftermarket programmable engine management has been around now for many years. Fuel, ignition timing, turbo boost control, idle speed control – these are all very common areas that are mapped using programmable management. But what about other, rarer functions? Functions that you make up for yourself and then build within the logic and capability of the existing system? These are seldom – if ever – described, not just in the media but also in the manuals that come with the gear.

In this story, I want to explore in detail the development of a new function that uses the programmable logic blocks that are available. This particular example uses a MoTeC M400 ECU and an ADL3 dash. While still available new, both devices have actually been around for years – they are no longer cutting-edge technology and so are both well-proven (and also available second-hand!).

The specialised function that was developed is lean cruise – but the same ideas can be applied to any bespoke outcome that you want to achieve. Innovative control approaches to cam control, EGR, electronic throttle, intercooler water pump speed, radiator fan control – the list is endless.

That people so seldom develop custom functions in this way is probably indicative of the fact that people don’t realise that such approaches are even possible. And to be honest, before I started exploring in detail the programming of the MoTeC ECU and dash, I had no idea that you could do so much.

Unique requirement

The car in question is a turbocharged 2001 Honda Insight, and the function that was desired was a lean cruise mode.

In standard naturally aspirated form, the little Honda uses a lean cruise function that comes into operation when the engine is under low loads and is using a fairly constant throttle. In this mode, the standard car can run as lean as an air/fuel ratio of 24:1! But with the standard ECU completely gone, how to create a lean cruise mode?

The engine is being run by the MoTeC M400 ECU. The M400 is a conventional programmable ECU – so as standard, it doesn’t have a lean cruise function. But is it possible to create such a mode from scratch? The answer is ‘yes’ but to make it really work well, maths functions in the ADL3 dash are also needed.

So how was it all done? Hold on for one helluva ride!

Fuel and ignition changes

Let’s do the easy stuff first – lean cruise, as a specific mode, reduces the amount of fuel that is being injected and at the same time, advances ignition timing. (The latter is needed because leaner mixtures burn more slowly.) Both steps are relatively easily achieved in the M400 by using two specific functions.

To change the fuelling during lean cruise, a Lambda Compensation table is used. This causes the ECU to aim for leaner mixtures when this mode is activated. To change the timing during lean cruise, an ignition compensation table is used. This causes the ECU to add timing when this mode is activated.

Both use two-dimensional tables, with the changes in fuel and ignition varying with MAP pressure.

So straightforward, huh? No – because the big issue is: when should the car be in lean cruise and when should it not be?

This is hugely important because when in lean cruise, the engine develops less power and is less responsive to throttle. Set it up wrongly, and the car drives like a dog. Furthermore, at high loads, the use of lean mixtures and advanced timing could easily destroy the engine. So to maintain good driveability and safe engine operation, the lean cruise mode needs to occur only in certain, very specific driving situations.

Starting points

So what aspects need to be analysed to work out when lean cruise is appropriate?

  • Load and throttle angle

Load is measured by the ECU via a MAP sensor. In a turbocharged car like the Honda, vacuum is indicated by pressures below 100kPa and boost is indicated by pressures above 100kPa. (That is, atmospheric pressure is around 100kPa.) Therefore, the first logical step in determining when Lean Cruise should occur is to specify that lean cruise can occur only at MAP of less than 115kPa. That is, any boost greater than 15kPa prevents lean cruise occurring.

However, MAP alone is insufficient. Throttle position is also needed – after all, the driver flooring the throttle is immediately indicative of high load... desired, if not actual! Therefore, lean cruise can occur only at throttle positions less than 60 per cent. (This is a higher value than you’d normally use because the Honda uses a small engine and very tall gearing, so throttle angles are often larger than in other cars.)

But specifying throttle openings of less than 60 per cent is insufficient. What happens when the throttle is fully lifted? In that case, the ECU is programmed to reduce fuelling to zero – that is, complete injector shut off then occurs. If throttle is then re-applied, and lean cruise mode can then immediately occur, the engine would transition from no fuel (on no load) to very lean mixtures (on light load). The result? Doughy response and potentially a ‘lean jerk’ as there is insufficient fuel for the transition.

Therefore, lean cruise can occur only when throttle position is over 4 per cent for 2 seconds. (Note in this parameter the use of the time aspect [2 seconds] as well as throttle position.)

  • Gear

The Honda uses a 5-speed manual transmission and, as already mentioned, very tall gearing. Let’s consider a real world driving situation. If you’re trickling along in a long line of slow-moving traffic at 30 km/h, the car will be in second or third gear. In that situation, lean cruise would not be desired. Throttle response would be poor and so keeping up with other traffic that is varying in speed would be clumsy.

But here’s the issue: with only the above two criteria of load (less than 100kPa) and throttle position (4-60 per cent), in this ‘traffic jam’ situation, the car would go into lean cruise. So how can that be avoided? By monitoring the gear and allowing lean cruise to occur only in 4th and 5th gears.

The calculation of gear is made by the ADL3 dash. The ADL3 is linked to the ECU via a CAN bus that gives it access to all the ECU inputs and outputs. In this case, using the engine rpm and road speed inputs and an internal look-up table that specifies gear ratios, the dash can calculate the selected gear. This was initially done so that ‘selected gear’ could be displayed on the dash, but the calculated gear can also be used as a lean cruise input.

  • Engine warm-up

Running lean cruise when the engine is still cold will result in poor driveability. That’s because the engine needs richer mixtures during warm-up. Even engines that will tolerate 14.7:1 (stoichiometric) during warm-up will not be happy with leaner mixtures in that time. Therefore, lean cruise can occur only at coolant temps over 80 degrees C for 5 seconds.

User Function

These parameters (fourth or fifth gears, engine over 80 degrees C, etc) are used by the ADL3 dash to activate Lean Cruise Mode via what is called a ‘User Function’.

User Functions allows a string of variables to be examined and an output energised only when all of the variables meet the required conditions.

This function is usually for simple functions (like activating the radiator fan when the coolant temp is over 80 degrees C), but as shown here, it can be used to set up much more complex functions than that.

Up to eight variables can be used in the one logic string, and multiple logic strings can be activated.

The logic, so far

Let’s take stock. So far, lean cruise mode will be entered only if the following criteria are met:

  • MAP less than 115 kPa

  • Throttle between 4 – 60 per cent

  • Coolant temp over 80 degrees for more than 5 seconds

This list might seems sufficient – but it isn’t. Remember, doughy response occurs when the engine is running very lean mixtures. That is, a quick movement of the throttle results in not much happening in terms of increased torque output from the engine. That in turn gives poor driveability. So what can we do about this?

  • Rate of throttle change

Here’s where it starts getting very interesting – and where with the MoTeC hardware, again the ADL3 dash needs to become involved. The dash, by using its internal ‘differentiate seconds’ function, can assess how fast the throttle is being moved. This value (let’s call it Accelerator Rate of Change) can then be used as an input into the lean cruise decision making.

Therefore, lean cruise can occur only if the Accelerator Rate of Change is low.

In fact, this factor is most important in transitioning out of lean cruise – there is good throttle response at all times, because the car cannot be in lean cruise if the throttle is being moved rapidly.

So it’s starting to sound good. But not quite yet.

Imagine another driving situation – this time the car is being driven for fun. And when being driven for fun, lean cruise should not occur! But how do you determine when a car is being driven for fun?

  • Driving style

By monitoring throttle rate of change, we can get a feel for how the car is being driven. But not just instantaneous rate of change, as described above, but rate of change over a period. If the throttle is often being moved fast, the car is being driven for fun – and so lean cruise isn’t wanted.

We can assess this again using the ADL3 dash, again using the ‘Accelerator Rate of Change’ value. However, this time we mathematically square the Accelerator Rate of Change value (so that it’s always positive), and apply a large filter to the value, so that it changes only slowly. As the speed of movement of the throttle (either opening or closing) slows, so this value gradually drops towards zero. We can call this value ‘Driving Style’.

(To make it easy for me to remember, I refer in my notes to Driving Style as the ‘emptying bucket rate of change of throttle’. That is, the analogy is of a bucket with a small hole in it – water is placed in the bucket each time the throttle is moved quickly, but when no water is being put in, the bucket slowly empties.)

So the next parameter is added - lean cruise can occur only if the Driving Style value is below a certain value.

Transition to lean cruise

So let’s summarise the factors that we’re using to determine whether the car is in lean cruise or not:

  • MAP less than 115 kPa

  • Throttle between 4 – 60 per cent

  • Coolant temp over 80 degrees for more than 5 seconds

  • Accelerator Rate of Change low

  • Driving Style value low

But there’s still one more factor to consider. As so far described, the transition into lean cruise occurs as a distinct step. That is, when the criteria are all met, and the car goes into lean cruise. That transition immediately reduces engine torque output for a given throttle position: the power at those revs therefore can be felt to drop.

So from the driver’s point of view, when the car goes into lean cruise, something has gone wrong! That is, the driver thinks: why has power just dropped?

The way to avoid this ‘step’ transition is to slide into the mode – to implement it over a few seconds rather than abruptly. This is achieved by filtering the value that indicates to the ECU that it should go into lean cruise – thus the value is not on/off but slides in over a short period.


And the outcome? A lean cruise function that appears to think for itself.

Accelerate hard through the gears and the car’s air/fuel ratios are as you’d expect. But back off and drive gently, and within a few seconds of driving gently, the car slides into lean cruise mode. Accelerate when in lean cruise with a quick foot movement and the air/fuel ratios are immediately returned to standard.

Drive hard, and even when you drive more gently for 20 or 30 seconds before again driving hard, the management system has not gone into lean cruise during the gentle driving.... it ‘knew’ you were likely to again cane it.

In lean cruise and you back right off? When you re-apply throttle the response is as you’d expect... air/fuel ratios normal before lean cruise is again slid back into.


If you are using a programmable ECU (or ECU and dash combo, as here), there may be possibilities that you’ve never envisaged.

With programmable management systems having the capability to develop user-definable variables (as was done in this story with the ‘Driving Style’ factor), and have user-definable decision-making based on multiple variables, there is a flexibility that is truly limited only by your imagination.

And this is one area where the DIY tuner has a lot more opportunity to develop these areas than a workshop. Developing bespoke functions like the lean cruise mode covered in this story takes a lot of time – but if you’re working from home, you’re not paying anyone an hourly rate!

If you currently run a sophisticated programmable ECU in your car, think of what you can potentially do….

Did you enjoy this article?

Please consider supporting AutoSpeed with a small contribution. More Info...

Share this Article: 

Copyright © 1996-2020 Web Publications Pty Limited. All Rights Reserved