Tuesday, August 23, 2016

Designing a better diesel tuning box - part 4 - improved design results

If you are following the project you might've seen that the new source code for the firmware and (Android) client application are up:

Arduino firmware: https://github.com/ligius-/DieselTuningBox
Mobile UI: https://github.com/ligius-/DieselBoosterClient

With that out of the way, I've had about a month of testing with the new prototype and several months already with the old one. The definitive result is that there are significant fuel savings.

Outside city limits I now get better than 6L/100km, at highway speeds (130 km/h) better than 6.5/%. I believe the highway consumption can be further improved but I haven't used the car so much lately to be able to fine-tune the settings.

Previously I would get 7.6L/100km at best on country/county roads and 7.4/% on highways. So that would be a 12% mileage increase on highways and 21% on slower roads.

Inside the city is where the story changes since that's where I did most of my driving and had time to tune the parameters. I am now getting an average of 9L/100km (actually better) compared to 11L stock or 12.5L with RaceChip. So that's 18% mileage increase from stock and 28% increase from RaceChip..

Why such a difference?

The issue is a bit more complicated and I found it related to matching between sensor output impedance and ECU input impedance. That's why the improved prototype has provisions for adjusting this. On my car, with the default 'Arduino' circuit I need to set the offset correction to -50mV and gain correction to +3% in order to match the factory settings.
I doubt any of the aftermarket solutions account for this and is the reason why I get such poor city mileage with the commercial tuning unit.
The commercial units are likely ok at higher rpms since the gain correction is built-in (part of the tuning) and the offset error becomes insignificant.

The app

Building a mobile app was a great idea since it allows me to connect to the module, adjust the settings on-the-fly and save them.

I would probably redesign it now since I know now the usage pattern: adjust gain and offset once, play with the curve point gains indefinitely, save them. Currently the gain and offset are the biggest UI elements since the majority of the improvements can be achieved through those.

The 'Apply immediately' checkbox is also really useful as it allows the user to play with the values without having to hunt for the 'Apply' button. As soon as some settings are changed the application waits for a while (1-2s) and sends the new settings to the car.

It's cool showing the phone to someone and watch the consumption modify as you play with the values. A bit silly, but makes for a 'wow! never thought this would be possible' moment.

Adjusting the individual gains however is a bit tricky to do while driving (or stopped for that matter) since they are quite small and a lot of them.

I opted to add +/- buttons on the sides of each point setting instead of the classic numpad editor which is impossible to use at the wheel.

The app will also helpfully highlight the currently selected point (in blue) so you can see where the engine is at.

With the 'Apply immediately' feature it's just a matter of tapping '-' and wait 1-2s and see the effect.

Speaking of effect, the whole concept now seems a bit wrong to me - you are adjusting the END value not the START value so anything that you've adjusted affects where the next value will be. E.g. if you adjust the value for 200 (ADC = .244V) to lower it by 10% the ECU will compensate and now the new value will be 200+10%. I cannot explain this properly in words but I'm working on the EFFECT rather than the CAUSE.

Another interesting issue is that the engine does not run well at very low fuel rates, regardless of the setting. As long as the stationary consumption is above 0.7L/h the engine sounds fine, as soon is it goes below that it starts shaking. The 'solution' is to raise the consumption back by putting it in gear or starting A/C. So a 'cold engine' tuning should be different than a 'warm engine' one since consumption decreases as the engine warms up (emissions-related). At 0.4l/h the engine shakes badly.

Speaking of shaking, the automatic gear shift is not so smooth anymore since it's probably hand-tuned for specific torque values.

I haven't noticed any significant loss of power but I'm not the street racer type.


I'll probably stop working on this project for a while and deal with the other pending projects since I think the goal was achieved.

I would like to integrate real-time reading of OBD2 values: fuel rail pressure (PID 59?), engine RPM (PID 0C), oil temperature (PID 5C), fuel rate (5E) and vehicle speed (0D). This would allow better data logging and perhaps some auto-tuning, through the app.

Would be nice to have a separate control module with real buttons and knobs instead of a smartphone.

Would be nice to use the internal Arduino temperature sensor to select different curves or values depending on ambient (engine) temperature. It should be good enough for most purposes.

Would like to find out if there is any damage that can occur when setting an extremely low consumption. I'm using the engine sound (smooth, rough, shaking, ...) to tune the settings now but I don't actually know why it's behaving like that since the rail pressure is well within parameters.


  1. This is quite interesting project! What values did you find out useful for R and C in the filter circuit? Thanks.

    I'd like to try this on my car. I need to find good adapters for rail sensor, as I wouldn't want to cut the wires.

    1. See https://github.com/ligius-/DieselTuningBox there is a schematic there with R=1k and C=47u but other values should work as well. There might be an issue with the connections for K1 (S1, O1, P1) and I will have to update the schematic but generally in the normal-off position the relay should bypass the circuit and feed signal_in directly to signal_out.