Nitrox/Trimix & CO analyzer

Please register or login

Welcome to ScubaBoard, the world's largest scuba diving community. Registration is not required to read the forums, but we encourage you to join. Joining has its benefits and enables you to participate in the discussions.

Benefits of registering include

  • Ability to post and comment on topics and discussions.
  • A Free photo gallery to share your dive photos with the world.
  • You can make this box go away

Joining is quick and easy. Log in or Register now!

Miyaru

Technical instructor
ScubaBoard Sponsor
Scuba Instructor
Messages
1,708
Reaction score
2,057
Location
Malta
# of dives
5000 - ∞
nitrox_co.gif

Example of a Nitrox & CO analyzer. The CO is increasing while smoke enters the tube with the sensors. Using air from my scuba tanks results in a neat 0.0ppm (hopcalite filter installed).

Part list:
  • Arduino Uno/Nano
  • ADS1115 analog-digital converter
  • OLED or TFT display
  • Citicel AO2 or another oxygen cell
  • ZE07-CO carbonmonoxide sensor
  • 9V battery
And finally, a box which holds all the parts.
There's one last thing which I haven't figured out 100%: linear drift. Theoretically, a cell that provides 10.5mV in 20.9% oxygen, should provide 50.24mV in 100% oxygen. In real life, the cell provides 49mV in 100% oxygen:
linearity.jpg

There should be a correction factor. To do this, I programmed a 2-point-calibration:
First calibration at startup, when the analyzer is in air.
Second calibration when 100% oxygen is flowing over the cell. This value is stored in the eeprom of the Arduino.

With these two calibration points (airVoltage and oxygenVoltage in the calculation below), the correction can be calculated, to make the purple line behave like the theoretical green line. My attempts for oxygen levels above 21%:

correction = (100 / oxygenVoltage) - (20.9 / airVoltage)
oxygenPercentage = measuredVoltage * (20.9 / ( airVoltage - correction) )

This results in a displayed percentage that is within 0.1% of what a Divesoft and Analox analyzer show. But if any bright mathematics wizard can doublecheck and improve my idea, please do!

Anyone?
 
Thanks for posting this, it looks great!
Regarding your correction factor, I'm not sure I follow the equation you wrote. There is an error in the form it is written as you are subtracting your correction factor (which you defined as the slope differential between your 2 extreme calibration points), which is the inverse of a voltage, from the measured airVoltage (a voltage).
In any case, how are you trying to fit your calibration points? A line that fits your 2 calibration points exactly? (but then would not be accurate for percentages below 21 and wouldn't indicate 0% for 0mV measured).
You have to decide how you want to fit your calibration points to begin with. Possibilities could be a line fitted to your 3 calibration points (0, 20.9 and 100) using a least squares method for example, or if you want to fit exactly those 3 data points to your final equation, you'd have to use a second degree polynomial with 3 constants as in:

% = aV^2 + bV + c.
The (0,0) point eliminates c, and then solve for a and b with your calibration measurements.
 
Okay, the 2 calibration points might be far apart, but those are practical ones, as most tech divers have 100% oxygen available. Anything in between would have to be a laboratory calibration gas ($$$).

Zero oxygen isn't readily available. I tested the sensor with 100% He and the cell provided 0.38mV. That's probably because the tube with the sensors can't be saturated to 100% He within a minute.

My method can certainly be improved (hence this topic). I'll look into your idea to see if I get it.....mathematics was some decades ago for me, and I never deal with issues like these...
 
Nice project! especially to include the CO detection. I have recently done an oxygen analyser as well and chose to keep it for single point air calibration and assumption of linear from 0. Many comercial meters do the same, and of course all the typical DIY ones using a digital panel meter with adjusted vRef are the same concept too.

How is your 20.9 Air calibration point captured? Is it dry air from a scuba tank or atmospheric air. If Atmospheric then you should be accounting for temperature and humidity. It does not take much humidity and temperature for the calibration point to need adjusting to less than 20.9 in your case if your calibration was around 20.4 then you are back to linear (10.5mV/49mV = 21.4%)

Thankfully someone has done the maths for us here :)

https://www.analoxsensortechnology...._O2EII_RM-001-003_-_Humidity_compensation.pdf

Just for fun and to overcomplicate a simple job, my project is using a temp and humidity sensor and auto adjust the calibration with a lookup table based on the above :)

I find it to provide consistent mesurement on same tank over different days, also comparible to the meter in the local shop, which is definitely nothinging special but at least is calibrated from dry air via a regulator at consistent flow rate.

Dean
 
This is a super cool project! I don't have much to add, but am following along :).

What's the ballpark figure on cost for materials? I imagine that it is substantially less than a cheap O2 analyzer plus a cheap CO analyzer.
 
keeping in mind too that these galvanic oxygen sensors are typically spec'd accuracy at +/-1% of full scale or even +/-2%. In practice they seem better and more repeatable than that, but we perhaps put too much trust in them.

Dean
 
whatever it is you are building, it looks beautiful
 
0% = 0mV (or any fixed value) should not be used or fixed in your formula/conversion, i think you proved this in your testing to yourself

as the sensors *should* have a linear output only use the 2 calibration points you capture to calculate a straight line, you can extend it below the 20.9 level allowing you to measure those ranges as well

maybe something like
(oxygenVoltage - airVoltage)/79.1 = percentVoltage ; should give you a voltage for each 1%

oxygenPercentage = ((measuredVoltage - airVoltage) / percentVoltage) + 20.9 ; then use the air voltage as the reference to calculate actual oxygen percentage
 
https://www.shearwater.com/products/teric/

Back
Top Bottom