Tech: Understanding OBDII Engine Systems and Fuel Mixture Control
4x4Wire TrailTalk Forums Galleries 4x4Wire Site Index
4x4Wire Toyota Tech Short Cuts
[ Main Page | Toyota FAQ | Projects | Reviews | Tech | 4Runner | Maintenance | Minute Mods | Hot Toy | Insider | 4x4 Trails | Forums ]

By: Dan Eddleman - March 2004

Check Engine Light

When the Check Engine Light comes on due to the fuel mixture related error codes P0171 and P0172, or your 3rd generation Toyota with either the 3.4L V-6 or 2.7L 4 cylinder engine is just not running like it should, the oxygen sensor and the Mass Air Flow Sensor (MAF) are common suspect items. They do work closely together in performing their function, but without additional information on exactly how they do their job, it can be confusing to determine which might be at fault. Either sensor is too expensive to do a trial and error replacement to determine which might be causing a problem. This article will examine the role these sensors play, along with the Main Engine Control Unit to maintain proper fuel/air mixture control.

OBD-II Engine Control Unit Overview

To understand the role these sensors play, we must first take a look at the Main Engine Control Unit (or ECU as it is commonly called) and how it uses the information generated by these sensors. While much of what will follow may be applicable in principle to older computer controlled fuel injection systems, this article is written with specific details applicable to the On Board Diagnostic Generation II (or OBDII) systems used in the 3.4L V-6 or 2.7L 4 cylinder equipped 3rd generation Toyota Tacoma and 4Runner.

These systems are "closed loop" or "feedback" control systems, constantly monitoring and correcting for changing conditions in a continuous chain of events while your engine is running. For purposes of discussion we will consider the starting point of the chain of events as being the measuring of pre-combustion conditions that the ECU needs to know in order to make its best guess calculation of how much fuel to inject into a particular cylinder. The post combustion measurements then follow to determine how close the ECU calculations were on the amount of injected fuel and finally, the necessary corrections are computed for the next combustion cycle.

While this article focuses on the role of the MAF and oxygen sensor, the table below summarizes the other key inputs to the ECU that are used to determine the proper fuel mixture.

Key Engine Control Unit Input Signals
Engine Load Computed from Air Flow Rate into the engine and Intake Manifold air pressure
Engine Speed Reported by the Crankshaft Position Sensor
Coolant Temperature Reported by the engine coolant sensor, a thermistor that varies its resistance according to the engine coolant temperature
Throttle Position Throttle position sensor creates a voltage signal that varies in proportion to the throttle valve opening angle
Intake Air Temperature Measured by another thermistor located in the Mass Air Flow Sensor unit
Battery Voltage Battery voltage affects the speed at which the fuel injectors open and must be taken into account in computing the fuel injector pulse length, or injector open time
Oxygen Sensor The oxygen density in the exhaust emissions is detected and generates a control signal back to the ECU indicating the burned air/fuel ratio.

Engine Control Unit Input Data

Closed loop systems can present a bit of the "which came first, the chicken or the egg" debate in troubleshooting. If it were not for the built in diagnostics and system monitoring, diagnosing the source of error could be very difficult to determine. The question on any given sensor is, is it correctly seeing an error introduced by some other failing component in the system, or is the sensor itself generating out of tolerance data. The use of an OBDII diagnostic scan tool is essential to get access to the diagnostic information stored in the ECU and help put you on the correct path in diagnosing the cause of the problem.

This photo taken from an OBD-II diagnostic scanner shows many of the input parameters summarized above that the ECU uses to base its best estimate of how long to hold the injectors open to provide the correct air/fuel ratio.

Let's look at one of the more common problems that results in the ECU reporting a fuel mixture problem. Then we will walk through the system in detail to see the effect. The example we will use is a dirty Mass Air Flow sensor (MAF). The hot wire MAF used in 3rd generation Toyotas, measures air flow volume, indirectly by measuring the current flow that must be passed through a small heated wire exposed to the incoming air flow. As more air comes in, the wire which is heated to around 200 degrees Centigrade, is cooled by the passing air (and resistance lowered). As a result, the computer sends even more current through the wire to keep it heated such that the wire's resistance is kept equal to a reference resistance value. By knowing the amount of current required to keep the hot wire equal to the reference resistance value, the ECU indirectly knows the volume of incoming air. There is also a thermistor in the MAF sensor so the ECU knows the temperature of the incoming air and takes that into account.

As fine dust particles and other contaminates are "cooked" by the hot wire and accumulate on its surface, the wire slowly becomes increasingly "thermally insulated" to the passing air, and begins to under measure the incoming engine air flow at certain engine speeds. That is, more air is being drawn into the engine than is being reported to the ECU. With the MAF sensor under reporting the volume of incoming air, the ECU "base injection duration" of injector open time will be on the low side, resulting in a lean mixture.

This process of the wire becoming coated with contaminates is known to the industry and many hot wire MAF sensors now incorporate a "burn off" cycle activated every time the ignition switch is cut off. Sufficient current is passed through the hot wire to briefly raise it to 1000 degrees Centigrade to burn off any contaminants. I have not seen any information in Toyota documentation indicating that this feature is incorporated on the 3rd generation engines under discussion, so this might be the reason this problem occurs. Newer technology MAF sensors use a heated "thin film" versus "hot wire" that is reported to be more resistant to contamination problems.

Shown below are the P0171 error code, and the P0172 error code for reference, and the suggested cause of the problem. Take note that the "RICH" or "LEAN" in the text description is referring to the TRIM value being used, where as the error title is referring to the actual fuel mixture. That is, if the actual fuel mixture is on the LEAN side, the TRIM value will move to the RICH side, trying to correct for the lean running condition, and vice versa. To confuse this even more, the Toyota FSM has an error on PO172 error code name. It says "System too Lean" where as it should be "System too Rich".

OBDII Error Summary related to Fuel Mixture
Code Detected Condition Trouble Area
P0171 System too Lean (Bank 1) - When air fuel ratio feedback is stable after engine warm up, fuel trim is considerably in error on the RICH side (2 trip detection logic)
  • Air Induction System Leak
  • Injector Blockage
  • Mass Air Flow Meter
  • Engine Coolant Temperature Sensor
  • Fuel Pressure
  • Gas Leakage from the Exhaust System
  • Open or Short in the Oxygen Sensor or associated wiring
  • Oxygen Sensor Defective
  • Engine Control Unit
P0172 System too Rich (Bank 1) - When air fuel ratio feedback is stable after engine warm up, fuel trim is considerably in error on the LEAN side (2 trip detection logic)
  • Injector Leak, Blockage
  • Mass Air Flow Meter
  • Engine Coolant Temperature Sensor
  • Ignition System
  • Fuel Pressure
  • Gas Leakage from the Exhaust System
  • Open or Short in the Oxygen Sensor or associated wiring
  • Oxygen Sensor Defective
  • Engine Control Unit

The oxygen sensor in the exhaust system is the key "feedback" sensor for correcting and maintaining the proper fuel mixture. Think of it as the "quality control" on the mixture calculations done by the ECU up to this point. It measures the post-combustion gases to determine what the actual air/fuel mixture was. In this case, the burned gases will have more oxygen than it should, as compared to the ideal 14.7 air/fuel ratio or "Stoichiometric" ratio. Accordingly the oxygen sensor will indicate a lean mixture to signal the ECU to increase the fuel trim percentage (to hold the injectors open for a longer period of time) to get the mixture back to optimum.

2 Trip Detection Logic

You probably saw the "2 trip detection logic" in the above error code explanation and will see many more below. What is this? Well OBDII regulations require the vehicle's system to light up the Check Engine Light or Malfunction Indicator Lamp (MIL) when the computer detects a malfunction in the emission control system or components in the power train that could affect vehicle emissions. In addition, when a malfunction is detected, the applicable Diagnostic Trouble Codes (DTCs) are recorded in the ECU memory.

If the malfunction does not reoccur in 3 consecutive trips (a "trip" being defined as an "ignition on" to "ignition off" engine run cycle), then the MIL will go off, but the DTCs remain recorded in memory.

A DTC following the "2 trip detection logic" behaves differently from the above as follows. When a malfunction is first detected, the DTC is temporarily stored in the ECU memory (1st trip). If the same malfunction is detected again during the second trip, the second detection will cause the MIL to light up (2nd trip).

Long Term and Short Term Fuel Trim

As we have discussed the OBD-II system operating in closed loop (for the most part) senses any errors and automatically corrects. Actually there are periods of time (during warm up, full throttle and in the event of a failed sensor) that the system is running in open loop mode. That is, it is not using the immediate data from the oxygen sensor for fuel calculations. However, as discussed under the definitions of Long Term and Short Term fuel trim below, stored data from past oxygen sensor readings are used even during periods in open loop operation. We now need to go into more detail on the two types of "fuel trim" or fuel mixture adjustment. There are two trim types are defined in the table below.

Fuel Trim Definition
Long Term Trim Long Term Trim is a learned value over time which changes gradually in response to conditions such as fuel oxygen content, engine wear, air leaks, variation in fuel pressure, altitude and so on. Long term trim is a component of what Toyota technical literature refers to as the "Basic Injection Duration". Basic Injection Duration data is stored in a nonvolatile RAM and is not erased even when the engine is shut down. This information is used during warm up and wide open throttle conditions.
Short Term Trim Short Term Trim is instantaneous correction value determined from the oxygen sensor readings. Under normal conditions it cycles rapidly around the 0 percent correction value and is only functional during closed loop operation. Short term trim is a component of the "Corrected Injection Duration". Corrected Injection Duration is used only during closed loop operation and not during open loop conditions. When Short Term trim exceeds plus or minus 10 percent for too long, the Long Term trim begins shifting, changing the Basic Injection Duration to bring the Short term trim back within the plus or minus 10 percent range. Short term trim can vary as much as plus or minus 20 percent, but the above correction mechanism works to keep it within plus or minus 10 percent.

P0171 Freeze Frame Data

As discussed in the above definitions, long term trim helps set the correct "Basic Injection Duration", then short term fuel trim helps set the "Corrected Injection Duration". Lastly, the ECU measures the battery voltage to make one final correction needed to arrive at the "Final Injection Signal". This correction compensates for any effect battery voltage would have on the fuel injector open duration.

As long as the system stays within limits, it will perform the proper adjustments and keep your engine running as it should. However, when there is a problem in the system introducing excessive error, well that's when the Check Engine Light or Malfunction Indicator Lamp (MIL) is turned on. On 3rd generation Toyotas, that limit is when the sum of the Long Term and Short Term Trim exceed 35 percent. The photo to the left shows an example of freeze frame data at the point the P0171 error condition was turned on. In this case the total trim value was at 40.6 percent.

In Depth Look at Oxygen Sensor Operation

So far we've summarized the overall system, the roles the MAF and oxygen sensors play, and the definition and use of the long term and short term fuel trim values. Also we see both sensors listed in the possible trouble areas under the P0171 and P0172 error codes. So how do we know if the MAF or the oxygen sensor are involved in a given problem? First, the possible trouble areas listed under each error code are shown in the priority order that they should be investigated. The oxygen sensor is the next to last in the list, followed only by the Engine Control Unit itself. Is this priority to be trusted?

Well it turns out that the oxygen sensor has some very specific characteristics that the ECU is able to monitor and make a pretty precise determination if it is in working order. If the oxygen sensor is not working properly, chances are that the ECU will generate an error code for the O2 sensor itself.

Normal O2 Sensor Signal Amplitude and Frequency

A properly operating oxygen sensor should see the fuel mixture swinging (a small amount of actual mixture change) around the ideal 14.7 air/fuel mixture ratio. The swinging mixture in turn causes the sensor to generate a "sine wave like" signal with a frequency typically about 1.8 cycles/second) as shown in the photo on the left. The computer watches the oxygen sensor voltage swings and also the oxygen sensor heater current, and if not within specification, sets the appropriate code.

Below is a listing of the error codes associated with the oxygen sensor. It should be noted that the error code naming convention is part of the standards and applies to all OBD-II vehicles. Some V-8 engines run two catalytic converters, hence the bank 1 and bank 2 naming convention. Sensor 1 is the oxygen sensor upstream of the catalytic converter and Sensor 2 is down stream of the catalytic converter. Since the Toyotas under discussion use only one catalytic converter, you will only see "bank 1" in the error codes.

Oxygen Sensor Error Code Summary
Code Detected Condition Trouble Area
P0130 Oxygen Sensor Circuit Malfunction(Bank 1 Sensor 1)
Voltage output of heated oxygen sensor remains at 0.4V or more, or 0.55V or less, during idling after engine is warmed up (2 trip detection logic)
  • Open or short in heated oxygen sensor circuit
  • Heated oxygen sensor
  • Air induction system
  • Fuel pressure
  • Injector
  • Engine Control Unit
P0133 Oxygen Sensor Circuit Slow Response(Bank 1 Sensor 1)
Response time for heated oxygen sensor's voltage output to change from rich to lean, or from lean to rich, is 1 second or more during idling after engine is warmed up. (2 trip detection logic)
  • Open or short in heated oxygen sensor circuit
  • Heated oxygen sensor
  • Air induction system
  • Fuel pressure
  • Injector
  • Engine Control Unit
P0135 Oxygen Sensor Heater Circuit Malfunction(Bank 1 Sensor 1)
When oxygen sensor heater operates, heater current exceeds 2.35amps (2 trip detection logic)
  • Open or short in heated oxygen sensor circuit
  • Heated oxygen sensor
  • Engine Control Unit
P0141 Oxygen Sensor Heater Circuit Malfunction(Bank 1 Sensor 2)
When oxygen sensor heater operates, heater current exceeds 2.35amps (2 trip detection logic)
  • Open or short in heated oxygen sensor circuit
  • Heated oxygen sensor
  • Engine Control Unit

Normal Amplitude O2 Sensor Signal, centered on Ideal Fuel Mixture Weak O2 Signal Normal Amplitude Signal indicating Lean Mixture Condition Normal Amplitude Signal indicating Rich Mixture Condition

The most accurate way to know if the O2 sensor is getting lazy (sluggish response) or signal amplitude shrinking is to look at the sensor signal using an oscilloscope. But this of course requires having an oscilloscope and getting access to the wiring to the ECU which would be time consuming and requires some care, particularly with respect to avoiding an unintended static discharge which could damage the ECU.

The oscilloscope photos shown above are recreated signals, made to exactly match the diagrams shown in the FSM. The actual O2 sensor signals will not match exactly the overall shape of the pure sine wave as shown, but the sensor output should be close in frequency, and match or exceed the voltage amplitude values shown.

Although not as accurate due to sampling rates, a faster and adequate means to observe the O2 sensor signal is via an OBDII scanner. OBDII scanners have the ability to select and deselect signals and values available for monitoring. To obtain the most accurate representation of the O2 sensor analog signal, select only that signal for viewing on your OBDII scanner. This allows all available bandwidth on the OBDII interface to be used for displaying the signal and will result in a much more accurate display of the O2 sensor signal. The last photo below on the right shows how the oxygen sensor signal display on the OBDII scanner is degraded when too many values are selected for display. The end result is too few sampling points along the curves of the sensor signal which results in a much more jagged and inaccurate display of the actual signal.

The photos below were taken just after starting the engine, letting it warm up, and then observing the O2 sensor signal at idle. As previously discussed, there are conditions where the system is running open loop such as the first photo below where the engine at 66 degrees F just after starting. Note that a stored long term trim value of -4.7% is being used even though the system is still in open loop.

The throttle position and engine load percentages shown in the first photograph need some explanation since the 29% engine load percentage, as reported by the scanner, seems a bit high for a vehicle sitting at idle. While the OBDII regulations standardized many things, apparently one of the items not standardized is the scaling used on "percentage type" values. When using a general purpose OBDII scanner, a "scaling error" may be present on percentage type parameter readings. For example, many vehicles do not indicate 100% throttle when floored nor do they go down to zero when throttle is released.

In the next photo, the engine has warmed up as indicated by the 192 degree temperature and the system has changed to closed loop operation.

In the third photo, the oxygen sensor output can be seen and is swinging by a healthy amount above and below the 0.55 volt and 0.40 volt reference values, indicating that the sensor is in good condition. By the way this is the original oxygen sensor with the vehicle having 78 thousand miles on the odometer. The last photo shows the oxygen sensor signal again, but with many parameters on the status of the on board monitor tests.

Engine started, not up to temperature, running open loop Engine at operating temperature, running closed loop O2 Sensor Output, engine idling, only signal selected for display O2 Sensor display with too many values selected on OBDII scanner.

Making the Diagnosis

In this article's example scenario of a dirty MAF sensor for purposes of discussion, and causing a PO171 error code to be stored, we would see the following data related to the PO171 error and trim values that were stored at the time of the error.

P0171 Error Code - System too lean P0171 Freeze Frame Data, fuel trim values


I hope this article has given you a good overall understanding of how the OBDII system and associated sensors work to not only maintain proper mixture control, but also to provide diagnostic and self test capabilities to help keep the system in top condition.

While a fair amount of information has been provided on how the Main Engine Control Unit uses information generated by the Mass Air Flow and oxygen sensors, along with the related problem codes and possible causes, you really need to have the FSM on hand to proceed with the diagnosis of a problem.

The FSM includes diagnostic procedures for each of the possible causes listed in the above trouble code listing, additional information on differences between California specification and non-California specification vehicles, and has far more detail than can be covered in this educational overview. Also included are precautions you should observe both for personal safety and to prevent static discharge or other possible damage to these onboard electronic systems.

Thanks and credits to Toyota for the fine job of explaining these systems in the Factory Service Manual and also for making their service technician training materials available at Kevin Sullivan's Autoshop 101, an excellent automotive educational web site. Click on the "Technical Articles" link for an extensive listing of Toyota technical literature for further education. Without these two sources of information, it would be impossible to write this overview on how these systems work.

Contacts Related Links

4x4Wire Portal: 4x4Wire | 4x4Voice | OutdoorWire | MUIRNet-News | TrailTalk Forums | Site Index | FaceBook | Google+Google+
4x4Wire Archive: 4x4 Tech | 4x4 Reviews | 4x4 News | 4x4 Trails | Destinations | 4x4 Access
Jeep | Toyota | Mitsubishi | Isuzu
More 4x4Wire: Toyota FAQ | Toyota Projects | Toyota Maintenance | Toyota 4Runner | Toyota Tech
Jeep Tech | Jeep Projects | Jeep News | Jeep Reviews | Jeep Gallery

OutdoorWire, 4x4Wire, JeepWire, TrailTalk, MUIRNet-News, and 4x4Voice are all trademarks and publications of OutdoorWire, Inc. and MUIRNet Consulting. Copyright (c) 1999-2016 OutdoorWire, Inc and MUIRNet Consulting - All Rights Reserved, no part of this publication may be reproduced in any form without express written permission
You may link freely to this site, but no further use is allowed without the express written permission of the owner of this material.
All corporate trademarks are the property of their respective owners.