Thursday, May 5, 2016

Designing a better diesel tuning box - part 2 - simplified design

There are many variables needed to get a reliable product, so while taking a break from the ISO automotive requirements I thought of playing with a barebones design - just an Arduino, an HC-05 module and perhaps a few passives.

Concept - this is similar to what the boxes on the market do - read the value on ADC, output the modified value with PWM. I'm using an Arduino Nano for this, took about half a day including the 'preview' spreadsheet.

Nano pinout:

  • Vcc to sensor supply (5V), from ECU
  • GND to sensor ground
  • A0 the output from the sensor
  • Pin 9 goes to ECU (former sensor data)
  • TX goes to RX of HC05
  • RX goes to TX of HC05
Notes:
A0 should probably be pulled up to Vcc through a 1k resistor, I haven't tested this yet. Perhaps the Arduino weak pull-up would work.
Pin 9 (PWM output) should go through a resistor and capacitor connected to ground, 1k with 0.3u looks good in my tests.




The first two pictures show the Android phone connected to the HC05 for sending commands and receiving telemetry. The third one is the Arduino terminal on the computer running at the same time. While HC05 is serial data can be sent to the computer but not from the computer.

The user settings can be stored in the internal EEPROM.

After proving that the concept works and is fairly reliable (in a non-automotive environment) I took the time to make an Excel sheet (actually, OpenOffice) to chart the input versus output and compose the serial configuration string.


Regarding serial, the arduino sends each second a status with raw input and raw output. This incidentally also blinks the white LED (on pin 13) so you should see a bright flash if everything is running fine.

A tighter loop - every 10ms - reads the analog input and adjusts the PWM output. By default the output is sent unmodified (i.e. module is inactive), to get it to enable you need to send 'e' via the terminal. Conversely, send 'd' to disable it. While enabled, the LED will light up with a low duty cycle.

Terminal commands:
  • e - enable offset ('boost' car)
  • d - disable offset (do nothing)
  • rm - reads the minimum value from which the module starts working
  • rM - reads the maximum range
  • rc - outputs the entire configuration (version, min, max, curve points)
  • sm - sets the minimum range. Example: input sm300 - press enter
  • sM - sets the maximum range. Example: sM800
  • sC - sets a point on the curve. E.g. sC5117 sets point five to value 117. This means that during that specific range the output will be offset above by 17%
  • sX - sets the entire configuration in a single string. Can be generated by the spreadsheet
  • S - saves the config to EEPROM
  • L - loads the config from EEPROM, overwriting the current one
I won't provide a detailed explanation on how this works, just play with the green numbers in the spreadsheet to see how the output (blue) changes and whats the 'gain' (red) compared to original.

There is no error checking, no failed user input protection, no electrical protection, no watchdog protection and absolutely no warranty.

Other things: the PWM output is running at 60kHz, I think since the original sensor has a 2ms response time this could go unfiltered to the ECU. I assume they are filtering it there. The bootloader adds a startup time, ~5s, that could cause the ECU to trigger an error if it expects something during that time. I don't think it does.

To get you started, the minimum signal (while powered) should be 0.5V, the absolute maximum should be 4.5V, the car idle voltage should be around 1.2-1.5V. In my example above, the idle voltage is increased (to lower fuel consumption while idle) while during the other active ranges the voltage is decreased (adding power).

Power consumption is 25-50mA.

Edit: initial live tests

I got the engine light on (blinking coil) but the engine did start. The values I was expecting were a bit different than the real ones. Got an ADC value of 243 (1.18V) for engine idle (~780 rpm) and 256 (1.25V) for 1000 rpm.
It seems that the bootloader startup delay might be interfering with the ECU expectations (see above) or a pull-up resistor is required somewhere. Will have to do some measurements to determine the exact cause.

No comments:

Post a Comment