Introduction
This full-scale oxygen / O2 sensor employs the original AO2 CiTiceL® oxygen sensor probe and features a measurement range of 0-100%Vol and I2C digital output, which can be adapted to application scenarios including oxygen / O2 generators, automobile exhaust, and air-fuel ratio detection.
The DFRobot oxygen / O2 sensor has a built-in calibration algorithm on the signal board that can quickly perform single-point or double-point calibration so as to accurately measure the oxygen / O2 concentration in the environment. Based on the principle of electrochemistry, the sensor probe comes with strong anti-interference ability, high stability and sensitivity, and up to two years service life. It is compatible with mainstream controllers such as Arduino, ESP32, Raspberry Pi, etc. Besides, the sensor is designed with an easy-to-use Gravity interface and with our sample codes, you can quickly build an oxygen / O2 detector.
Caution: Exposure to high concentrations of solvent vapors is avoided, both during storage, fitting into instruments, and operation.
Specification
- Detected physical quantity: oxygen / O2 concentration
- Measuring range: 0~100%
- Working voltage: 3.3~5.5V DC
- Operating Current: 6.5mA @ 5V ; 6.5mA @ 3.3V
- Output signal: I2C
- Working pressure range: 0.5~2.0Bar
- Operating temperature range: -20°C ~ +50°C
- Operating humidity range: 0 - 99% RH (non-condensing)
- Response time: <5S
- Life: >2 years (in air)
- Circuit board size: 32mm*27mm (1.26*1.06 inch)
- Mounting hole size: inner diameter 3.1mm(0.12 inch)/outer diameter 6mm(0.24 inch)
Board Overview
Label | Name | Function Description |
---|---|---|
1 | Left signal input terminal | Connect with oxygen / O2 sensor probe |
2 | Right signal output terminal | I2C signal output terminal, connected to the controller |
3 | DIP switch | I2C address switching |
Tutorial for Arduino
- Caution: Exposure to high concentrations of solvent vapors is avoided, both during storage, fitting into instruments, and operation.
Preparation
- Hardware
- DFRuino UNO R3 x1
- SEN0495 Gravity: Oxygen / O2 Sensor x1
- Several Dupont lines
- Software
- Arduino IDE Click to download Arduino IDE
- Download and install DFRobot_EOxygenSensor library. How to install the library?
Connection
Data Calibration
Data calibration can be performed with a single-point calibration with an oxygen / O2 concentration of 20.9%Vol, or a two-point calibration with 20.9%Vol and greater than 99.5%Vol.
The oxygen / O2 content in the air-circulating environment is about 20.9%, so the single-point calibration can be quickly completed in the air after the sealing cap of the sensor probe is unscrewed. If you want to make the data more accurate, you need to perform two-point calibration.
Button | 20.9%Vol | ≥99.5%Vol | SET |
---|---|---|---|
LED Color | Green | Green | Red |
Button function | After long press for 2s, calibrate the voltage value in air (20.9% oxygen content) | After long press for 2s, calibrate the voltage value in pure oxygen (oxygen content ≥99.5%) | 1. Short press to check calibration status 2. Long press for 2s to clear calibration data |
LED blinking logic | 1. Blink for 2s after successful calibration, 4 times per second 2. After entering the state of checking calibration data, if this point has calibration data, LED will be on for 4s; otherwise, the LED will be off. 3. After the data is cleared successfully, it will flash synchronously with the red LED for 4s, 2 times per second |
1. Blink for 2s after successful calibration, 4 times per second 2. After entering the state of checking calibration data, if this point has calibration data, LED will be on for 4s; otherwise, the LED will be off 3. After the data is cleared successfully, it will flash synchronously with the red LED for 4s, 2 times per second |
1. After a short press, enter the state of checking calibration data, the red LED flashes for 4s, 4 times per second 2. After long pressing for 2s, the calibration data will be cleared. After the data is cleared successfully, the red LED will flash for 4s, 2 times per second |
Button calibration process:
- Clear the current calibration data: press and hold the SET button until three indicators flash, release the button after the indicator flashes
- Preheating: Unscrew the sealing cap on the probe. After a long time of sealing storage, it needs to stand in the air for at least 3 minutes after unscrewing the sealing cap to preheat the sensor.
- Single-point calibration: Put the probe in the air, press and hold the 20.9%Vol button until the green indicator flashes, and the single-point calibration is completed (the voltage at the signal input terminal in the 20.9%Vol environment is about 9~13mv)
- Two-point calibration: Place the probe in a pure oxygen environment with an oxygen concentration ≥99.5%Vol, press and hold the ≥99.5%Vol button until the green indicator flashes, and the two-point calibration is completed.(The voltage of the signal input terminal in the environment of ≥99.5%Vol is about 50mv)
For software calibration method, please refer to the usage example below
Read sensor data
Sample code
- Unscrew the sealing cap on the probe. After a long time of sealing storage, it needs to stand in the air for at least 3 minutes after unscrewing the sealing cap to preheat the sensor.
- Connect the module to the Arduino according to the wiring diagram above. Of course, you can also use it with the Gravity I/O Expansion Board, which can be more convenient and faster to complete the project prototype construction.
- The default I2C address is 0x70, which corresponds to ADDRESS_0 in the code. If you need to modify the I2C address, you can first configure the hardware I2C address through the DIP switch on the module, and modify the I2C address definition ADDRESS_X in the sample code. The corresponding relationship between the DIP switch and the I2C address parameters is as follows:
- ADDRESS_0:0x70, A0=0, A1=0
- ADDRESS_1:0x71, A0=1, A1=0
- ADDRESS_2:0x72, A0=0, A1=1
- ADDRESS_3:0x73, A0=1, A1=1
- Download and install DFRobot_EOxygenSensor library. How to install the library?
- Open Arduino IDE and upload the code below to Arduino UNO.
- Open the serial monitor of Arduino IDE, adjust the baud rate to 115200, and observe the serial port print result.
/*!
* @file getOxygenConcentration.ino
* @brief Enable the power, and the information is printed on the serial port.
* @n When using IIC device, select I2C address, set the dialing switch A0, A1 (Address_0 is [0 0]), (Address_1 is [1 0]), (Address_2 is [0 1]), (Address_3 is [1 1]).
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
*/
#include "DFRobot_EOxygenSensor.h"
/**
* iic slave Address, The default is E_OXYGEN_ADDRESS_0
* E_OXYGEN_ADDRESS_0 0x70
* E_OXYGEN_ADDRESS_1 0x71
* E_OXYGEN_ADDRESS_2 0x72
* E_OXYGEN_ADDRESS_3 0x73
*/
#define OXYGEN_I2C_ADDRESS E_OXYGEN_ADDRESS_0
DFRobot_EOxygenSensor_I2C oxygen(&Wire, OXYGEN_I2C_ADDRESS);
void setup()
{
Serial.begin(115200);
while(!Serial);
while(!oxygen.begin()){
Serial.println("NO Deivces !");
delay(1000);
} Serial.println("Device connected successfully !");
}
void loop()
{
Serial.print("oxygen concetnration is ");
Serial.print(oxygen.readOxygenConcentration());
Serial.println("% VOL");
delay(1000);
}
Result
Open the serial monitor to get the final data.
Software Calibration
Sample code
- Unscrew the sealing cap on the probe. After a long time of sealing storage, it needs to stand in the air for at least 3 minutes after unscrewing the sealing cap to preheat the sensor.
- Connect the module to the Arduino according to the wiring diagram above. Of course, you can also use it with the Gravity I/O Expansion Board, which can be more convenient and faster to complete the project prototype construction.
- The default I2C address is 0x70, which corresponds to ADDRESS_0 in the code. If you need to modify the I2C address, you can first configure the hardware I2C address through the DIP switch on the module, and modify the I2C address definition ADDRESS_X in the sample code. The corresponding relationship between the DIP switch and the I2C address parameters is as follows:
- ADDRESS_0:0x70, A0=0, A1=0
- ADDRESS_1:0x71, A0=1, A1=0
- ADDRESS_2:0x72, A0=0, A1=1
- ADDRESS_3:0x73, A0=1, A1=1
- Download and install DFRobot_EOxygenSensor library. How to install the library?
- Open Arduino IDE and upload the code below to Arduino UNO.
- Open the serial monitor of Arduino IDE, adjust the baud rate to 115200, and observe the serial port print result.
/*!
* @file calibrationSensor.ino
* @brief Calibrate sensor
* @n The calibration status is printed on the serial port terminal
*/
#include "DFRobot_EOxygenSensor.h"
/**
* iic slave Address, The default is E_OXYGEN_ADDRESS_0
* E_OXYGEN_ADDRESS_0 0x70 // i2c device address
* E_OXYGEN_ADDRESS_1 0x71
* E_OXYGEN_ADDRESS_2 0x72
* E_OXYGEN_ADDRESS_3 0x73
*/
#define OXYGEN_I2C_ADDRESS E_OXYGEN_ADDRESS_0
DFRobot_EOxygenSensor_I2C oxygen(&Wire, OXYGEN_I2C_ADDRESS);
uint8_t calibrationState = 0;
void setup()
{
Serial.begin(115200);
while(!Serial);
while(!oxygen.begin()){
Serial.println("NO Deivces !");
delay(1000);
} Serial.println("Device connected successfully !");
if(oxygen.clearCalibration()) Serial.println("clear calibration success!");
if(oxygen.calibration_20_9()) Serial.println("20.9 calbration success!");
//if(oxygen.calibration_99_5()) Serial.println("99.5 calbration success!");
}
void loop()
{
calibrationState = oxygen.readCalibrationState();
if(calibrationState == 0) Serial.println("no calibration!");
if(calibrationState&0x01) Serial.println("20.9 calibration!");
if(calibrationState&0x02) Serial.println("99.5 calibration!");
Serial.print("oxygen concetnration is ");
Serial.print(oxygen.readOxygenConcentration());
Serial.println("% VOL");
delay(1000);
}
- 20.9% of the single-point calibration is completed after the code is programmed successfully.
- If you need to continue to complete the 99.5% calibration, please place the probe in a pure oxygen environment, and then program the sample code below. After the code is successfully programmed, the two-point calibration will be completed.
/*!
* @file calibrationSensor.ino
* @brief Calibrate sensor
* @n The calibration status is printed on the serial port terminal
*/
#include "DFRobot_EOxygenSensor.h"
/**
* iic slave Address, The default is E_OXYGEN_ADDRESS_0
* E_OXYGEN_ADDRESS_0 0x70 // i2c device address
* E_OXYGEN_ADDRESS_1 0x71
* E_OXYGEN_ADDRESS_2 0x72
* E_OXYGEN_ADDRESS_3 0x73
*/
#define OXYGEN_I2C_ADDRESS E_OXYGEN_ADDRESS_0
DFRobot_EOxygenSensor_I2C oxygen(&Wire, OXYGEN_I2C_ADDRESS);
uint8_t calibrationState = 0;
void setup()
{
Serial.begin(115200);
while(!Serial);
while(!oxygen.begin()){
Serial.println("NO Deivces !");
delay(1000);
} Serial.println("Device connected successfully !");
//if(oxygen.clearCalibration()) Serial.println("clear calibration success!");
//if(oxygen.calibration_20_9()) Serial.println("20.9 calbration success!");
if(oxygen.calibration_99_5()) Serial.println("99.5 calbration success!");
}
void loop()
{
calibrationState = oxygen.readCalibrationState();
if(calibrationState == 0) Serial.println("no calibration!");
if(calibrationState&0x01) Serial.println("20.9 calibration!");
if(calibrationState&0x02) Serial.println("99.5 calibration!");
Serial.print("oxygen concetnration is ");
Serial.print(oxygen.readOxygenConcentration());
Serial.println("% VOL");
delay(1000);
}
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.