Gravity: Electrochemical Oxygen / O2 Sensor (0-100%Vol) I2C Wiki - DFRobot

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

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

Preparation

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:

For software calibration method, please refer to the usage example below

Read sensor data

Sample code

/*!
  * @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

/*!
  * @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);
}

/*!
  * @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.

More Documents