advice needed on re-mapping an automotive analog sensor

Hi everyone.

I am a total newbie in the Arduino field so I'm hoping to get some pointers from you experts.

Long story short, one of the sensors[airflow meter] of my car is about to die completely. An oem replacement is 250 euros[bosch] but i found a similar fit sensor [pierburg] for 100euros with different output curve. [both sensors use a 0-5V analog signal to talk to the ECU]

What I'm looking for is a way to modify the output of the ECU by piggybacking the output of the sensor, something like [sensor]------[arduino controller]------[ECU]. For example, let's say the OEM sensor has an output of 2.3 volts at a given quantity of air but the new sensor will only output 2 volts for same quantity which will mess the ECU up.

So, is it possible to build a circuit or use a existing board which will allow me to reprogram different load points like 0-255 or 0-1023 or something similar? Any good articles to start with cause I kept reading stuff for the last 2 days but it seems to be too much to digest all of a sudden.

Thanks for reading and hoping for some start ideas [meanwhile will keep reading]

Hi simontemplar,

First, welcome to Arduino!

From a software perspective, what you describe is pretty easy to do. I'm not much of an auto enthusiast, so I can't speak to how to connect to the sensors.

You'll need to know the transfer functions for each sensor. Do you have their curves?

Pat.

If both sensors have good linear response over their measurement range then a simple software mapping command wcam correct for the 'offset' between them. A more difficult problem is outputting a analog voltage with the resolution requirement for the ECU. Simply outputting a PWM analogWrite value and then passing it through a low pass filter and buffer amp might work but you might find engine control not good with the limited 8 bit resolution of the PWM output signal. You may find a need for an external 10 DAC to get the resolution requirement suitable for your ECU. Even the basic 10 bit resolution of the arduino analogRead function may be a limitation for your existing ECU?

Lefty

Given the lack of a D to A converter on the Arduino, what you are trying to do is probably easier using an op amp and a few resistors, if both sensors have similar response curves.

is it possible to build a circuit or use a existing board which will allow me to reprogram different load points like 0-255 or 0-1023 or something similar?

Yes.

One way is to use an adc to read the voltage and then use a dac (pwm + filter, r2r, or a dedicated dac) to output another voltage.

Another way is to use an adc + parallel eeprom + dac.

The issue is likely a) reliability; b) dynamic response; and c) failure mode.

The first two are fairly easy to solve and the last one very difficult to solve.

You say it's about to die- presumably you have a reliable means of knowing that. Therefore by extension, you know when a sensor is "not about to die" and could perhaps get one from a scrapyard and satisfy yourself that it's in good shape 8).

I'd be inclined to buy the OEM part regardless of cost.... With the best will in the world, reverse engineering one might lead to some circumstances under which it will not give the same value as the real one, with possibly dire consequences such as a failure under conditions where you need huge acceleration to get of a tricky situation.

Thanks all for replying

patduino: Hi simontemplar,

First, welcome to Arduino!

From a software perspective, what you describe is pretty easy to do. I'm not much of an auto enthusiast, so I can't speak to how to connect to the sensors.

You'll need to know the transfer functions for each sensor. Do you have their curves?

Pat.

Not having the curves yet will have to do some logging with a multimeter. Don't understand the "transfer functions" part unfortunately.

retrolefty: If both sensors have good linear response over their measurement range then a simple software mapping command wcam correct for the 'offset' between them. A more difficult problem is outputting a analog voltage with the resolution requirement for the ECU. Simply outputting a PWM analogWrite value and then passing it through a low pass filter and buffer amp might work but you might find engine control not good with the limited 8 bit resolution of the PWM output signal. You may find a need for an external 10 DAC to get the resolution requirement suitable for your ECU. Even the basic 10 bit resolution of the arduino analogRead function may be a limitation for your existing ECU?

Lefty

That's too advanced for me to reply unfortunately. I thought will be easier to "hijack" the signal than add or substract few milivolts for a given input voltage, say 0.7V input will become 0.9V output. Analog input from sensor-----analog output to ECU. That will imply of course to log the outputs of both sensors then calculate the required offsets. Imagine that you can replace the simple 3 wire sensor with an adjustable resistor that will send an analog signal to the ECU, that's as simplified as i can put it...given the fact that I'm not a native english speaker.

dc42: Given the lack of a D to A converter on the Arduino, what you are trying to do is probably easier using an op amp and a few resistors, if both sensors have similar response curves.

that's the problem, they don't.

The transfer function is a fancy way of saying mapping the inputs to the outputs. Since the sensors are different, you'll need to create logic to recreate the original curve from the new sensor.

Depending on how sensitive the engine's operation is relative to the sensor value, and how similar the curves are, this can be easy or hard. Retrolefty's earlier concern is that you may not have enough resolution out of the Arduino so your performance may be choppy.

dhenry:

is it possible to build a circuit or use a existing board which will allow me to reprogram different load points like 0-255 or 0-1023 or something similar?

Yes.

One way is to use an adc to read the voltage and then use a dac (pwm + filter, r2r, or a dedicated dac) to output another voltage.

Another way is to use an adc + parallel eeprom + dac.

Hi, thanks for replying, that really sounds interesting. Can you expand please.

patduino: The transfer function is a fancy way of saying mapping the inputs to the outputs. Since the sensors are different, you'll need to create logic to recreate the original curve from the new sensor.

Depending on how sensitive the engine's operation is relative to the sensor value, and how similar the curves are, this can be easy or hard. Retrolefty's earlier concern is that you may not have enough resolution out of the Arduino so your performance may be choppy.

I know I might be pushing it here but if you have a bit of time to check this link http://autospeed.com.au/cms/title_The-Digital-Fuel-Adjuster-Part-1/A_2418/article.html you might understand better what I try to explain...although their device is a far more advanced version of what i need. Thanks

simontemplar:

dc42: Given the lack of a D to A converter on the Arduino, what you are trying to do is probably easier using an op amp and a few resistors, if both sensors have similar response curves.

that's the problem, they don't.

How do you know, if you haven't logged the curves yet?

By "similar" I mean the same general shape, such that the mapping between them can be represented by Vo = a*Vi + b, where Vi is the voltage output from the new sensor, Vo is the voltage you need to emulate the original sensor, and a and b are constants (positive or negative) that can be adjusted to get the best fit.

Got me here. They do have similar curves. It's the offset between them [if I may say so] that I need to compensate with + or -

I had to replace the mass air flow monitor on my Nissan truck several years back and learned a lot. I suggest that if you want reliable operation of your car, buy the OEM replacement part. There may be more going on with the air flow meter setup than you realize.

Also bear in mind that in some countries, it is illegal to tamper with any component that contributes to the emission control system on a vehicle used on public roads.

zoomkat: There may be more going on with the air flow meter setup than you realize.

My thoughts exactly, and it's a cinch that the missing piece of reverse engineering will manifest at the worst possible moment.

My mass airflow monitor had drops of dap on the place where the air flow module screwed into the throttle body, probably to detect tampering. Close inspection of the underside of the throttle body found that the barrel of the aluminum throttle body was apparently machined. I suspect that the dual platnum wire (?) flow sensor was inatalled on the throttle body, then the throtttle body was machined to calibrate the actual air flow to the output of the sensor.

I think I found my starting point here http://arduino.cc/en/Tutorial/AnalogInOutSerial now I only have to find out how to filter PWM to make it analog.

All of the solutions you're considering require you to know the relationship between the output of the OEM sensor, and the output of your proposed replacement.

You can obtain that if you have working examples of both AFMs, and a source of variable air flow (an engine, for example).

Once you know the relationship between the two AFM signals you can see what you need to do to the 'new' signal to make it look like the 'old' one. You never know, there may be an obvious relationship that can be handled without any clever electronics.