top of page

"Better to be on the boat wishing you were diving, than underwater wishing you were on the boat."

Augusto Pavan

DIY Oxygen Analyzer for Divers 

part 1

A smart little project to measure ppOâ‚‚ like a pro — without selling a kidney

If you dive with nitrox or trimix, you already know that monitoring oxygen content is essential — not optional.
This project was born out of necessity and curiosity: building a reliable oxygen analyzer using affordable components, while still keeping the technical accuracy required for diving applications.

 

System Overview

The sensor reads the partial pressure of oxygen (ppOâ‚‚) using a galvanic cell, amplified via a 16-bit ADC, and processed by an Arduino. The result is a low-cost but accurate ppOâ‚‚ analyzer suitable for gas analysis before a dive, or as a base for more advanced integrated diving systems.

The Sensing Element: Galvanic Oâ‚‚ Cell
cella.jpg

The core of the system is a Teledyne R-22A oxygen sensor, a standard galvanic cell widely used in diving analyzers.

It works like a miniature battery. Oxygen molecules diffuse through a PTFE membrane, reach the electrolyte (typically potassium hydroxide, KOH), and cause a redox reaction that produces a small current. The more oxygen, the stronger the current.

  • Output voltage in air (20.9% Oâ‚‚ at 1 atm): 7 to 13 mV

  • Output is linear with respect to partial pressure of oxygen (ppOâ‚‚)

  • Typical sensor lifespan: ~36 months in ambient air

  • Internal resistance: ~10 kΩ

This electrochemical principle is well explained in this  (scientific study on galvanic oxygen sensors) (PDF). It’s a classic system, robust and easy to interface — as long as you amplify the signal properly.

 

 

​

​

​

​

​

bhd.JPG

Why Not Use Arduino’s Internal ADC?

Because it's too noisy and too coarse.
Arduino’s internal ADC is 10-bit, with a resolution of ~4.88 mV on a 5 V scale. But the oxygen cell produces signals in the range of millivolts, and we want to detect small variations.

Instead, I used the ADS1115, a 16-bit ADC with programmable gain. It offers:

  • Resolution: 76 µV/bit (with gain = 1)

  • I²C interface, easy to use

  • 4 channels (can expand for more sensors later)

This allows us to read oxygen voltage cleanly and with enough precision for accurate calculations.

Why Use an External ADC?

Now that we understand how a galvanic oxygen sensor works, the next step is simple: read its tiny voltage output with a microcontroller.

But there's a problem.

The ATMega328p, used in most Arduino boards, includes a built-in 10-bit ADC that operates at 5V. That means:

arduino

CopiaModifica

5V / 1024 = 0.00488 V per step

In other words, the smallest voltage it can reliably detect is 4.88 mV — which is too coarse for reading a sensor that outputs between 7 and 13 mV in air.
We’d lose precision, especially when trying to detect subtle variations.

So instead, we use an external 16-bit ADC, specifically the ADS1115. With its programmable gain amplifier, we can achieve a resolution as fine as:

arduino

CopiaModifica

0.00007627 V (76.27 µV per step)

That’s more than enough to accurately measure and track oxygen sensor output, even in low-ppOâ‚‚ environments.

 

Bonus: the ADS1115 communicates over I²C and is super easy to integrate into Arduino projects. No drama.

1085-02.jpg

Adafruit analogic digital converter a 16 bit

CONNECTION
bread.jpg

🔌 Wiring Diagram ADS1115 PinConnect 

VDD-->5 V from Arduino

GND-->GND (shared with Arduino & cell)

SDA -->A4 (Arduino Uno)

SCL -->A5 (Arduino Uno)

ADDR-->GND (to select default I²C addr)

A0-->Positive terminal of the Oâ‚‚ cell

The negative terminal of the sensor goes to GND. Simple and effective.

From Voltage to Oxygen Percentage

Once everything is wired up, the process is straightforward:
we just need to read the voltage across the sensor terminals, perform an initial calibration reading in ambient air, and then apply a simple formula to estimate the oxygen content.

 

The formula is:

​

Oâ‚‚ (%) = (Measured mV / Calibration mV) × 20.90

Where:

  • Measured mV is the current voltage output from the sensor

  • Calibration mV is the sensor's output when exposed to normal air (20.9% Oâ‚‚)

  • 20.90 is the reference oxygen percentage in dry air at sea level

 

Example:
If the sensor reads 9.00 mV in air, and later reads 4.50 mV when analyzing a gas mix,
the oxygen content is: (4.50 / 9.00) × 20.9 = 10.45% Oâ‚‚

This formula assumes linear behavior, which is valid for most galvanic sensors in normal diving conditions.
It’s accurate enough for blending nitrox, gas analysis before dives, or as the base for a DIY dive computer.

The system provides accurate oxygen readings using a Teledyne R-22A galvanic cell and a 16-bit ADS1115 ADC.
Calibration is handled via air reference, with averaging over 32 samples.
The output is stable, repeatable, and suitable for nitrox analysis or integration into custom dive electronics.
The design is minimal, functional, and open to extension — display, logging, pressure input, or wireless modules can be added if needed.

IMG_6442.jpg

About Me

With a strong passion for electronics and technology, I’ve begun integrating it into another deep interest of mine: scuba diving.

 

© 2023 by Going Places. 

bottom of page