Arduino Projects

Oxygen Sensor used in Automobiles KE25 and its use with Arduino

Oxygen sensor:

The oxygen sensor is located on the exhaust system in automobiles the size and shape of the oxygen sensor looks like a spark plug based upon its arrangement. Most of the automobiles which are designed after 1990 include upstream and downstream two sensors. The oxygen sensor used in automobiles one before the catalytic converter (upstream pre-cat sensor used for regulating the fuel supply) and one after the catalytic converter (downstream/post cat sensor monitors the efficiency of the catalytic sensor) but the maximum number of these sensors in the car mainly depends on the engine model but most of the vehicles have four sensors.

Oxygen Sensor

Amazon Purchase Links:

KE25 Oxygen Sensor:

Heated Oxygen Sensor:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:


Other Tools and Components:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Function of Oxygen sensor:

High pressure and temperature exhaust gases leave the engine cylinder during the exhaust stroke travel through the exhaust manifold and come in contact with the oxygen sensor place before the catalytic sensor. The oxygen sensor senses the amount of oxygen in the vehicle’s exhaust. The oxygen sensor reading is used by the engine control unit to regulate the amount of air and fuel sent to the engine. The oxygen sensor mainly serves two purposes it helps maintain the perfect air-fuel ratio thereby preventing the engine from running lean rich. It also reduces the exhaust emission, one end of the oxygen sensor detects the amount of oxygen while the other end connects to the wiring that relays the sensor reading to the non-heated oxygen sensors and heated ECU. The oxygen sensor needs an optimal temperature of 650 degrees Fahrenheit to function effectively. The non-heated sensor which was used in older automobiles was heated by exhaust gases.

The sensing element at the front of the sensor consists of a zirconium dioxide sensing element enclosed within steel shall. Platinium electrodes are connected with the sensing element and wire leads down the line. Exhaust gases consisting of oxygen molecules contacts the sensing element after flowing through the slots/holes on the steel shell. Outside air is made to flow through the contacting cables. The air is then heated to enable the ions to produce voltage. The difference in the concentration of oxygen molecules in the exhaust gas and the ambient air drives the oxygen ions from higher concentration to lower concentration. Due to the movement of oxygen ions from one plutonium layer to the other, a potential difference is generated. The voltage surges up to about 0.9 by the rich mixture. on the contrary lean mixture drops the voltage down to 0.1V. These voltage signals are feed to the engine control. The ECU compares it with pre-stored standard data to decide whether the mixture is rich or lean.  During subsequent stroke to manipulate the air/fuel ratio these calculations will be used.

The disadvantage of the sensor is that it could take a minute or longer to reach the temperature required for operation. A non-heated sensor overcomes this problem through a heating element a resistor that heats the sensor to the required temperature for operation.

Oxygen Sensor working principle:

The working principle of the sensor is to check the oxygen amount between the atmosphere and within the exhaust system of the vehicle. The difference in the oxygen level a reaction will take place due to which voltage will be produced. The voltage produce will depend on the oxygen difference. For good ignition of the fuel, the oxygen is added. The communication of this sensor can be done with help of a voltage signal. The computer of the car will decide the oxygen status in the exhaust. The computer regulates the mixture of the fuel or oxygen delivered to the car engine. The arrangement of the sensor before and after the catalytic converter permits to maintain the hygiene of the exhaust and check the converter efficiency.

Connection of Oxygen sensor:

One wire of the oxygen sensor will be a signal wire that is the wire that sends the voltage signal from your sensor to the car computer and the sensor receive the ground by being screwed into the exhaust manifold and the exhaust manifold gets his ground by being attached to car engine. The car engine is grounded by the cable attached the chesses and the chesses is grounded by the negative terminal of the battery. If the ground circuit fails about seven components will stop working.

Oxygen Sensor

The oxygen sensor has two wires the ground wire is directly connected with the PCM. Now the sensing element in these sensors does not reach operating temperature until it reaches about 600 degrees Fahrenheit and they can take a while if a car computer does not have a signal from the oxygen sensor. It will not run efficiently and it will negatively affect the MPG. So car manufacture in order to heat these up faster decides to add a little heating circuit into these sensors. These sensors with the heating circuits came either with three wires or four wires. The three wires oxygen sensors receives a constant voltage from car fuse box or junction box and it is switched on and off by the ground wire which is connected with the PCM. The sensor has a signal wire but it does not have a ground wire for the sensing element. It is grounded again through the exhaust manifold.

Now in the four wire oxygen sensor as one would expect the sensing element has its own signal and ground wires and the heating element has it’s a ground wire which is switch on and off by the car PCM and again its own water supply.

Narrow band Oxygen Sensor:

Narrow band oxygen sensor inform the ECU whether the engine is running lean or rise with the reference to the stoichiometric air fuel ratio.

Wideband oxygen sensor:

Wideband oxygen sensor are commonly referred to as air fuel sensors the ECU how rich or lean the engine is running in comparison with the stoichiometric ratio. Wider band oxygen sensors are commonly used in newer automobiles.

Symptoms of bad oxygen sensor:

When the oxygen starts to fail it exhibits a few symptoms. Some of them are as follows:

  • Check engine light comes on
  • Bad gas millage and rotten egg smell
  • Rough engine oil and misfires check

The check engine light will illuminate if we have bad or failing oxygen. As soon as the light comes on contact a professional automotive technician for a check engine light inspection. This light comes on for many different reasons so it is important to have it looked at by a professional who can correctly diagnose the exact cause if you have higher mileage vehicle there is a good chance it has a bad oxygen sensor in need of replacement.

Bad gas millage and rotten egg smell:

If the oxygen sensor is not working properly fuel combustion systems and the fuel delivery will be thrown off.  A bad oxygen sensor can cause a vehicle to spray more fuel than necessary. If a bad gas sensor disrupts the air to fuel ratio mixture or too much fuel is injected into the vehicle gas millage will be reduced.  A rotten egg smell and black smoke exhaust will be produce due to the excess fuel in the engine. If yourself filling up your gas tank more often, keep a record of how many gallons you fill up and how often. Rotten egg smell is sign of bad oxygen or bad catalytic converter.

Rough engine idle and misfires:

A bad sensor can disrupts these engine sensors functions causing a rough or irregular engine idle and other engine related issues.

Poor gas mileage:

A bad oxygen sensor can affect the sensor mileage. Use the mileage feature and see how much miles you are getting on a full tank of gas. Calculate the mileage each time you fill your gas.

When to replace the oxygen sensor:

If your vehicles were manufactured within the past 15 years the oxygen sensor should be replaced every 60000 to 90000 miles. This sensor wears out and will need replacement over time. Replacement of failing oxygen sensor or bad will keep your engine running smoothly and properly. It will reduce the toxic emissions. The oxygen sensor helps your vehicle run efficient and reduce emission number

How to test Oxygen sensor:         

The oxygen sensor can be test with the help of multimeter. Oxygen sensor is used to measure the number of oxygen molecules that coming from the exhaust and engine then measures the difference between the oxygen molecules in the exhaust and the oxygen molecules that are normally in the atmosphere. There are tiny holes in the oxygen sensor where it takes in the air that is in the atmosphere next by using the sensing element that is in your oxygen sensor it turns that difference into a voltage. Now the range of voltage you are going to get out of the of your oxygen sensor is going to be 0 to 1 volts. But in practice it is actually going out to be 0.1V to 0.9V. Now the greater difference between the oxygen molecules coming out of the engine compared to the oxygen molecule in the atmosphere. The larger the voltage is going to be and this larger voltage is going to translate into a rich condition into your PCM. Now the rich condition is basically you want you have too much fuel to oxygen or air that is in your exhaust and on the other hand if we get a lower voltage is going to mean a lean condition and a lean condition means we have too little fuel to too much air in your exhaust. So from this voltage this is both is that your car computer seized from your oxygen sensor. It tries to correct air fuel mixture. Now on a four cylinder engine we have two oxygen sensors.


First we will test the heating circuit in this sensor and the two wires for the heating circuits are usually the same colour. Usually either black, white or sometime gray. We will go to do resistance check of this sensor so we grabbed our multimeter put it on the resistance and choose the 200 value. In the four wire oxygen sensor two wires are for heater circuit and two wires for oxygen sensor to produce the voltage. Now the reading we are expecting to see is obviously going to be different sensor to sensor. We will connect the probes of the multimeter with the two leads which are usually white leads then we should have a resistance that will tell us if our heating element is good. So first we will check heating element for resistance connect the two white or black wires with the multimeter. If we obtain some value of the resistance then it will show that the sensor is working properly. But if we obtain infinite resistance then it means that the oxygen sensor is damage.

Voltage test for Oxygen sensor:

Oxygen sensor in our car is basically a generator that creates its own voltage. The oxygen sensor that we are using has four wires. Connect the multimeter one probe with outside of the oxygen sensor casing and other probe with the signal wire of the oxygen sensor which is usually blue wire in the oxygen sensor. Set the digital multimeter to low dc voltage if oxygen sensor is operating at peak performance. It should get close to one volt dc as we apply heat to the oxygen sensor. When the oxygen sensor will heated the value the voltage in the multimeter will start increasing. We can got maximum value of 0.84V.

Oxygen Sensor

KE25 Oxygen sensor:

KE-25 is galvanic type of oxygen sensors. This sensor has excellent chemical durability and exceptionally long life. It should be about 0 to 70 millivolt pretty small voltage. It is very hard to read this voltage by the controller so we will first amplify the voltage before give it to the Arduino.


  • KE25 5 years
  • Low cast
  • Operates in normal ambient temperature
  • Stable output signal
  • No external power supply require for operation
  • No warm up time is require

KE25 Oxygen Sensor Applications:


  • Oxygen incubators

Food industries:

  • Refrigeration
  • Green houses


  • Air conditioners
  • Oxygen detectors
  • Fire detection

We will measure the output of this sensor using multimeter. It reads about to 3.5mV which is very small signal to read this signal with the Arduino we will first amplify it. Using LM358 IC we will amplify the signal about 11 times of the original signal.

KE25 Oxygen Sensor Interfacing with Arduino:

Oxygen Sensor

The resistor arrangements will decide that how many times the signal should be amplified. Connect pin number 8 with the battery supply and pin number 4 with the ground. One terminal of the KE-25 Oxygen sensor with pin number 3 of the LM358 while other terminal of the sensor will be connected with the ground terminal. The output of the LM358 will be connected with the analogue pin A0 of the Arduino. In the circuit diagram, I forgot to connect the GND wire with the GND pin of the Arduino. You should connect the GND wire of the circuit with the Arduino, otherwise the circuit won’t work.

KE25 Oxygen Sensor Arduino Code:

void setup()
pinMode(A0, INPUT); 
void loop()
  int oxygensensor = analogRead(A0);
  // print out the value you read:
  Serial.println("ADC : ");
  float Oxygen_Sensor = oxygensensor * 0.28;


Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button