# Averaging two 0-5V analog signals

#### cambridge

Joined Feb 21, 2008
3
Hi all,
I am trying to figure out the best way to combine two analog 0-5V signals to output the average of the two combined signals at the same voltage level of 0-5V.

This is a project for a car, specifically a twin turbocharged Mustang.

The factory Ford computer uses a mass air meter that measures incoming engine airflow via a hotwire style meter. Basic operation of the meter is as follows:

The air inlet tube for the engine has a heated wire running across the center of the intake tube. As air flows across the wire it cools the wire, this forces the computer to supply more voltage to maintain the set temperature of the heated wire. The changes in voltage are monitored by the computer which in turn changes fuel injector pulse width, engine timing, etc. for proper engine operation.

As supplied from the factory this engine uses one mass air meter for measuring the incoming air. I am running twin turbos with two engine inlets, consequently, I need to be able to measure the airflow in two tubes simultaneously.

The problem is that the Ford computer needs to see a 0-5V analog signal from one meter.

How do I combine the two signals to generate the average of the two signals at the previously set 0-5V?

I am not sure where to start. My electronics knowledge is very basic but I am not afraid to read and study. Can someone help point me in the right direction?

#### SgtWookie

Joined Jul 17, 2007
22,210
You basically use a summing/averaging network - a pair of resistors - as input to an op amp.

However, you may actually wish to select the input to be the one with the highest reading (ie: most airflow) rather than averaging the two; as if the airflow is unbalanced, you may wind up with an excessively lean mixture in one cylinder bank. This can happen quite easily if, for example, one turbine develops a faulty bearing - the other bank will then be fuel-starved, leading to detonation and destroyed pistons/bearings.

It would be a good idea to ensure that both sides are putting out the same signal level for a given airflow.

[eta]
Actually, what you might wish to do is not only take the highest reading (resulting in the most rich mixture) but also give a visual indication to the driver that there is an imbalance in airflow. An "idiot light" coupled with a visual indication, such as a needle deflecting right/left of center balance would be very helpful in diagnosing which side was causing the problem. This could be easily implemented using a Wheatstone bridge.

#### mrmeval

Joined Jun 30, 2006
833
To get the more advanced display you might consider a microcontroller like the atmega168. It can do it very well.

#### cambridge

Joined Feb 21, 2008
3
Thanks for the help everyone!

I have completed a drawing using the 2 resistors feeding an op amp (741). Hopefully I am in the ballpark!

I do have a few questions maybe you guys can help with.

Reading the page describing the operation of summing circuits and Millman's formula, I see that a summing circuit is made up from the previously described two resisters. For this particular application what is the benefit to making the circuit active as opposed to using the two resistors passively?

After checking Millman's formula I see that any value resistor would result in the same output providing the two resistors are of the same value. I drew the schematic using 1K resistors. Would I be better off using 100 ohm resistors or 10K resistors? If so, why?

Should I be feeding the op amp with the 5 volt supply or use the 12 volt (actually closer to 14 volts) supply that the cars battery provides? Looking at the data sheet for the 741 op amp it says voltage inputs can be as high as 15 volts.

Should I be concerned with any noise that may be generated by the added circuit? Do I need to add filter caps anywhere? With the impedance of the op amp being so high I would think that it's susceptibility to outside interference would be low. Am I thinking correct here? If so that would be a first!

Any other input on this circuit is greatly appreciated!

The idea of processing and using the highest reading from the two individual meters is interesting. I would like to pursue that circuit once I believe I have a handle on this very basic circuit.

As you can see from my questions my knowledge is very limited but this stuff is pretty cool.

Thanks again everyone!

#### Attachments

• 4.7 KB Views: 76

#### SgtWookie

Joined Jul 17, 2007
22,210
I have completed a drawing using the 2 resistors feeding an op amp (741). Hopefully I am in the ballpark!
A 741 op amp is quite ancient technology, and has many faults. A far better choice would be something like Linear Technology's LT1007. It can run on a single supply vs a bipolar supply, is rail-to-rail for input and output, has JFET inputs, and does not suffer from phase inversion as the 741s do.

I do have a few questions maybe you guys can help with.

Reading the page describing the operation of summing circuits and Millman's formula, I see that a summing circuit is made up from the previously described two resisters. For this particular application what is the benefit to making the circuit active as opposed to using the two resistors passively?
The input impedance of a JFET-input op amp is, for all practical purposes, infinite. This means there is practically zero load on the input signal, thus the voltage "reading" is much more accurate.

After checking Millman's formula I see that any value resistor would result in the same output providing the two resistors are of the same value. I drew the schematic using 1K resistors. Would I be better off using 100 ohm resistors or 10K resistors? If so, why?
Right now, we don't know the impedance of the supply. The lower the impedance of the supply, the lower values of resistors you can use.

The higher the value, the less loading on the system - up to a point. At some point, there is a diminishing return on increasing the values of the resistors; you'll wind up with noise.

Under the hood of a car is an inherently electrically noisy place, with spark plugs firing and alternators alternating. I suggest that 5K resistors might be a good starting place. It will take experimentation to determine what will be the best values to use.

Should I be feeding the op amp with the 5 volt supply or use the 12 volt (actually closer to 14 volts) supply that the cars battery provides? Looking at the data sheet for the 741 op amp it says voltage inputs can be as high as 15 volts.
Never depend upon the electrical system of the car to regulate voltage. It might be as high as just under 15V, and might be as low as 10.4V (dead battery and alternator not working) along with transients that may be far in excess of normal. You need a good voltage regulator. Linear Technology has a number of low-dropout regulators that could work in your situation, giving you a steady 10V supply.

Should I be concerned with any noise that may be generated by the added circuit? Do I need to add filter caps anywhere? With the impedance of the op amp being so high I would think that it's susceptibility to outside interference would be low. Am I thinking correct here? If so that would be a first!
Absolutely right. You definitely need what's commonly called "bypass" caps across the power terminals of the op amp.

Any other input on this circuit is greatly appreciated!
Needs some work, but I'm not quite up to that this evening

Suggestion: instead of routing the inverting input to ground, it should have a resistor equal to the averaging network both to ground and as feedback. That will take care of the offset voltage. Precision in resistors is important here.

The idea of processing and using the highest reading from the two individual meters is interesting. I would like to pursue that circuit once I believe I have a handle on this very basic circuit.
Well, before you go that route - it would be most helpful to know if the intake plenum is separate across banks, or is it open to both sides. In either event, you would want to know if there is an imbalance in airflow. It becomes a lot less critical if the intake plenum is shared, however.

As you can see from my questions my knowledge is very limited but this stuff is pretty cool.
Perhaps limited, but we'll expand your horizons

#### Ron H

Joined Apr 14, 2005
7,014
I was drawing this up as SgtWookie was posting, so I wasn't aware of his suggestions. I agree with all of them except this one:
Suggestion: instead of routing the inverting input to ground, it should have a resistor equal to the averaging network both to ground and as feedback. That will take care of the offset voltage. Precision in resistors is important here.
This will give you a gain of 2, which you don't want.

The circuit below uses a jellybean dual op amp, half of which is unused. It has the ability to handle zero volts on both input and output, which is a requirement for your circuit. The 741 won't do that. The LM358 (and the 741) need some headroom on the positive rail, so I've used the +12V, but with some heavy filtering (220 ohms, 100uF). This should handle glitches on the +12V supply, and in any case the LM358 can handle up to 32V. The LM358 power supply rejection is good, so regulation isn't really a big issue. If you're really concerned about glitches on the supply, you could add a 10V zener across the 100uF capacitor.

#### Attachments

• 7 KB Views: 71

#### Audioguru

Joined Dec 20, 2007
11,249
I think you need to add the outputs of the MAPs, not average them. Then the opamp needs to have a gain of 2.
Or else the computer will think there is half as much air as there really is and make the mixture much too lean. Then the engine will blow up if it has turbo boost. Or the mixture might be too lean for the engine to run.

Actually the computer will receive a conflicting report from the oxegen sensor that the mixture is much too lean and will cutoff the turbo boost and limp home.

#### Ron H

Joined Apr 14, 2005
7,014
I think you need to add the outputs of the MAPs, not average them. Then the opamp needs to have a gain of 2.
Or else the computer will think there is half as much air as there really is and make the mixture much too lean. Then the engine will blow up if it has turbo boost. Or the mixture might be too lean for the engine to run.

Actually the computer will receive a conflicting report from the oxegen sensor that the mixture is much too lean and will cutoff the turbo boost and limp home.
Each sensor has a 0-5V range. Obviously, the ECU shuld still see that range. The average will yield that range. The sum will overdrive the ECU.
Whether or not the average is actually advisable, I have no idea. SgtWookie may be on the right track with his suggestions.

#### rollertoaster

Joined Feb 23, 2008
4
I think you need to add the outputs of the MAPs, not average them. Then the opamp needs to have a gain of 2.
Or else the computer will think there is half as much air as there really is and make the mixture much too lean. Then the engine will blow up if it has turbo boost. Or the mixture might be too lean for the engine to run.

Actually the computer will receive a conflicting report from the oxegen sensor that the mixture is much too lean and will cutoff the turbo boost and limp home.
Abolutely correct... if you average the signal the ecu will only see 1/2 of the actual airflow into the engine.

I wouldn't go this route with a twin turbo setup. You're better off retrofitting a MAP setup. If you keep the Maf setup you'll run into idle and decel problems if you don't recirculate your blow off valve. If you don't use a BOV you will damage your turbos from compressor surge. You'll need much larger injectors too, because you'll be running a much richer mixture(11.5-12.5:1 under boost). But then the car won't run right at idle. You could use a rising rate fuel pressure regulator but I would discourage it (they suck!!). I just turbo charged my Honda element about a month ago, thank god Honda uses map sensors instead of maf. Even still I had to use an AEM piggyback computer to control the much larger injectors and allow the car to stay in closed loop during boost without leaning out due to O2 control.

What year car is it? Obd 0, obd1, obd2? I manage to turbo my obd2 car with no check engine light and all emissions controls intact.

#### Ron H

Joined Apr 14, 2005
7,014
Abolutely correct... if you average the signal the ecu will only see 1/2 of the actual airflow into the engine.
I see your point, but will an ECU set up to handle a 0-5V MAF signal be able to handle a 0-10V signal?

#### rollertoaster

Joined Feb 23, 2008
4
I see your point, but will an ECU set up to handle a 0-5V MAF signal be able to handle a 0-10V signal?
no, it won't. just as my honda factory map sensor didn't know that to do when it saw boost. I am using a piggyback computer with an internal map sensor and it works great. The car drives just like stock until you put the pedal down He is going to come up with a different fuel management system, i think.

#### cambridge

Joined Feb 21, 2008
3
Thanks again everybody for the input!

I have not yet had the chance to look at the data sheet for the LM358 but will have a look and try to have a better understanding of the circuit before I hit you guys up with more questions.

I wanted to clear a few things up in regards to the turbo system itself and engine management as I was not very clear in my first post.

I actually want the average output reading only half of the actual airflow. Here's why.

Let's say for this example that 1 volt represents 100 CFM of airflow. If I were using a single throttle body the stock air flow meter would peg (reach the end of it's dynamic range) at 500 CFM of airflow. Let's say my turbo is capable of flowing 1000 CFM at it's maximum output. It is easy to see that I will need to get a larger meter that is capable of reading past 1000 CFM. The computer will now need to be calibrated to the larger meter, this is done through the X-fer function with a modification to the lookup tables to accommodate the new curve.

Now using twin flow meters in the previously discussed configuration extends my dynamic range by default just by adding the second meter. The lookup tables will need to modified as in the example above but this does not pose an issue. I have a tuner that allows me access to the tables in the factory computer. Cost is an issue as well. Stock Mustang throttle bodies and meters are dirt cheap and a dime a dozen.

I agree with you rollercoaster regarding speed density (MAP equipped) compared to mass air equipped engine management systems. The problem is cost. An aftermarket FAST, Accel, AEM, etc. will easily exceed 2000.00. That is before I do all my fuel upgrades with larger injectors, fuel pumps, and lines.

For SgtWookie, the plenum's do have a crossover so the plenums are connected. The circuit you described just sounded kind of fun to develop and actually would work well from a technical standpoint if the meters are properly calibrated.

Ron is right regarding the computers ability to read up to but not over 5 volts.

I really appreciate everyone's input on this, Thanks!