Example Code for Arduino-Probe Calibration

Last revision 2026/01/12

This article offers example code and comprehensive instructions for calibrating probes to accurately measure dissolved oxygen values. It explains single-point and two-point calibration methods, providing guidance on hardware and software setup. Readers will learn how to achieve precise sensor readings under stable and varying temperature conditions.

  • If this is the first time you use the probe or the probe has been used for some time, the probe needs to be calibrated for accuracy.

  • Single-point calibration: only calibrate the saturated dissolved oxygen at a fixed temperature, suitable for use when the temperature is stable.

  • Two-point calibration: calibrate the saturated dissolved oxygen at different temperatures, you can calculate the temperature compensation, used when the temperature changes.

Hardware Preparation

Wiring Diagram

When the probe is filled with NaOH solution, it needs to be calibrated. Before calibration, please connect the probe as shown in the the following diagram. Connect the probe to BNC connector on the signal converter board. Connect the board to the analog input of Arduino main-board.

Analog_Dissolved_Oxygen_Sensor_Connect_Diagram

Software Preparation

#include <Arduino.h>

#define VREF    5000//VREF(mv)
#define ADC_RES 1024//ADC Resolution

uint32_t raw;

void setup()
{
    Serial.begin(115200);
}

void loop()
{
    raw=analogRead(A1);
    Serial.println("raw:\t"+String(raw)+"\tVoltage(mv)"+String(raw*VREF/ADC_RES));
    delay(1000);
}

Single-point Calibration Step

Only calibrate the saturated dissolved oxygen at a fixed temperature, suitable for use when the temperature is stable.
There are 2 ways to get saturated dissolved oxygen voltage:

  1. Expose the wet probe to the air. A easy way.
  2. mmerse the probe in saturated dissolved oxygen water. Troublesome but precise.

Expose the wet probe to the air

  1. Prepare the probe
  2. Wet the probe in pure water and shake off excess water drops
  3. Expose the probe to the air and maintain proper air flow (do not use a fan to blow)
  4. After the output voltage is stable, record the voltage, which is the saturated dissolved oxygen voltage at the current temperature

Mmerse the probe in saturated dissolved oxygen water

  1. Probe ready
  2. Prepare a cup of purified water and use one of the following methods to make saturated oxygen water.
  • A: Use a stirrer or an eggbeater to continuously stir for 10 minutes to saturate the dissolved oxygen
  • B: Use an air pump to continuously inflate the water for 10 minutes to saturate the dissolved oxygen
  1. Stop stirring or pumping, and put the probe after the bubbles disappear
  2. After placing the probe, keep stirring slowly while avoiding any bubbles.
  3. After the output voltage stable, record the temperature and voltage

Two-point Calibration Step

1 .Prepare two cups of purified water, put one cup in the refrigerator, and one cup to warm up (Do not exceed 40°C, otherwise the probe may be damaged.)
2. Use one of the following methods to make saturated oxygen water.

  • A: Use a stirrer or an eggbeater to continuously stir for 10 minutes to saturate the dissolved oxygen.
  • B: Use an air pump to continuously inflate the water for 10 minutes to saturate the dissolved oxygen.
  1. Stop stirring or pumping, and put the probe after the bubbles disappear.
  2. After placing the probe, keep stirring slowly while avoiding any bubbles.
  3. After the output voltage stable, record the temperature and voltage.
  4. Perform the same operation on another glass of water. Measure and record the temperature and voltage.

Was this article helpful?

TOP