DIY Gas 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!

I take your word that it is more accurate. Are the inacuracies in other methods like the el cheapo that great? are they larger than 1/2 % (gas mix) error?




Just amplifying the O2 cell's level is not the _right_ way to read it. It works somewhat, and a lot of the el Cheapo analyzers use that method, but it's not the correct loading for the cell to work as spec'd. There's a more elegant way to do it, and it ensures your reading is a lot more accurate.

To get it right, you really want to stabilize the cell with a constant load of 100K across it regardless of calibration. Attached is a standalone schematic of an analog oxygen analyzer (not mine, source now lost, but I built a similar circuit...) It demonstrates the proper way to set up the circuit. If you ignore the on/off circuitry on the left side -- this meter turns on with a SPST pushbutton and automatically turns off whenever the voltage across the R/C network pulls the FETs low -- the rest of the schematic illustrates the proper construction for providing the right load to the O2 cell.

Diodes D1 & D2 protect and ensure that the input of the op amp can never exceed the supply rails by more than the diode's drop voltage - about .6V.

C2 & C3 are for decoupling the supplies to minimize electrical noise etc. Especially using a microcontroller, you need these.

The amplifier output voltage will always drive to a voltage level that results in the voltages at pins 2 and 3 being equal. The voltage at pin 2 is attenuated by the network R8, R9 and P2 and it is the combinations of these that determine the gain of the amplifier.

The lowest gain is given by: (R8+R9+P)/(R8+P), whilst the highest gain is: (R8+R9+P)/R8.

To optimize, the starting point for values of resistors will always be the value of potentiometer P2, as the available values are limited, typically 10K, 20K 50K or 100K. You'll then need to establish the maximum and minimum gains, AH & AL; i.e. AH = 20.9/Vmin and AL = 20.9/Vmax where Vmin & Vmax are the limits of the sensor output quoted on the datasheet. Usually for an R-17 type cell, this is 7 and 17 mV, respectively.

You can now insert these figures into the formulas below:
R8=(AL*P2)/(AH-AL)
R9=(P2+R8)*(AL-1)

Doing it this way gives you a straight reading on the voltmeter, so no math required in software. If you are using an A-D converter in the chip to do your reading, you'd scale the amplifier for 100% O2 on a fresh cell giving you a full-scale reading of your reference voltage instead of targeting 1V full-scale to get the best resolution.
 
I take your word that it is more accurate. Are the inacuracies in other methods like the el cheapo that great? are they larger than 1/2 % (gas mix) error?
The common oxygen sensors are about +/-1% accuracy at full scale just to begin with... how much else you want to add in with your circuits compounds that.

FWIW, I'm a fan of eliminating as much as possible (hence the offset elimination and high precision op amp in the circuit I shared) but the reality is neither gas mixes nor physiology around how your body behaves is exact science. Most of the recommendations for oxygen exposures, the concept of "narcotic effect", decompression models, etc, are based on statistical models fitted to empirical observations of a large set of samples. They're not fundamental truths of the universe; they're simply observations that work. That's not to discredit the work that went in over the years in building those models, but they're just that: models.

For entertainment, watch people at dive shops who get all upset around 32% vs 31% mixes for nitrox, or 17% vs 17.5% helium. It should just crack you up... Or worse, when you're in the water with someone diving 32% nitrox and they won't go to 133' because the MOD is 132'. They make it abundantly clear they have no clue what they're actually doing in the water or to their bodies.

So YMMV...the answer is to always know what you can control, and control it. Know what you can't and plan for it.
 
I take your word that it is more accurate. Are the inacuracies in other methods like the el cheapo that great? are they larger than 1/2 % (gas mix) error?

I use the "el cheapo" and find that my analyser is up to 0.5% above the shop reading on 32% Nitrox. I am supplied Nitrox using a membrane system. I expect the shops analyser on the system and at the door will be higher quality (and cost more) than mine, but I do not know how accurate it is! There is no much in the readings.


As Cemerone points out when diving with a gas mix there is not a pure science governing the effect on your body systems, hence we have safety factors. My view is the safety factors well account for the possible 0.5% variation. But given personal circumstances the general safety factors may not...

Given more cash I might look at a better analyser, but given the tanks come for a membrane system, get analysed at the shop door and then re-check before diving I think the risks are reduced.
 
*A lot of great information*
Thanks for the interesting information.
I guess I will still use the "El cheapo"-way, keeping it K.I.S.S and doing the calculation in software, this is how I have hooked up the sensor,
Untitled Sketch 8_schem.png
And after testing it with different concentration of O2, I am now at the point that I trust the analyzer when analyzing breathing gas.
The MQ7 CO sensor is an another story, that sensor is useless for this purpose and I have been looking for a good CO sensor to use in this project, did find a sensor by Analox but can't find anyone that sells them, and the prices for that sensors that I could find is not within the budget of this project, also found some sensors sold by euro-gas (Gas Sensors - Carbon Monoxide CO - Gas Sensors) but again, can't find anyone who is willing to sell to private persons and can't find any prices for those sensors.

For powering the analyzer I butchered a "Cell phone emergency charger powerbank", which basically is 5v 2600mAh Lithium ion battery with a charging circuit, that setup gives the analyzer a continuously run time of at least 7 hours.
 
To these 2 posts. Yes i enjoy the attitudes of absolute accuracy is a very rounded sport. I havre never concerned my self with that kind of accuracy so long as it does nt hit the pocket book. I see it as 1.6 is tehlimit we use 1.4 to be conservative. Mods ate targeted for 1.4. If a litle over no biggy. As i see it the conservativeness is there for that and other aspects. If i am gong to 130 then i look for a mix for 140 and go for that. I try to not leave the 32 blend cause ti is so usefull for any recreational depth. Camerone you describe so many divers.


The common oxygen sensors are about +/-1% accuracy at full scale just to begin with... how much else you want to add in with your circuits compounds that.

FWIW, I'm a fan of eliminating as much as possible (hence the offset elimination and high precision op amp in the circuit I shared) but the reality is neither gas mixes nor physiology around how your body behaves is exact science. Most of the recommendations for oxygen exposures, the concept of "narcotic effect", decompression models, etc, are based on statistical models fitted to empirical observations of a large set of samples. They're not fundamental truths of the universe; they're simply observations that work. That's not to discredit the work that went in over the years in building those models, but they're just that: models.

For entertainment, watch people at dive shops who get all upset around 32% vs 31% mixes for nitrox, or 17% vs 17.5% helium. It should just crack you up... Or worse, when you're in the water with someone diving 32% nitrox and they won't go to 133' because the MOD is 132'. They make it abundantly clear they have no clue what they're actually doing in the water or to their bodies.

So YMMV...the answer is to always know what you can control, and control it. Know what you can't and plan for it.


---------- Post added August 14th, 2015 at 01:59 PM ----------

Tbar you hit right on the head. More should think like this.


I use the "el cheapo" and find that my analyser is up to 0.5% above the shop reading on 32% Nitrox. I am supplied Nitrox using a membrane system. I expect the shops analyser on the system and at the door will be higher quality (and cost more) than mine, but I do not know how accurate it is! There is no much in the readings.


As Cemerone points out when diving with a gas mix there is not a pure science governing the effect on your body systems, hence we have safety factors. My view is the safety factors well account for the possible 0.5% variation. But given personal circumstances the general safety factors may not...

Given more cash I might look at a better analyser, but given the tanks come for a membrane system, get analysed at the shop door and then re-check before diving I think the risks are reduced.


I read something long time ago and it makes so much sence. 10% of your resources will fix 90% of your problems. To fix the last 10% takes 90% of your resources.
So dive have fun and keep out of the 10% problem areas.......

---------- Post added August 14th, 2015 at 02:08 PM ----------

Im with you jboneng. I blend my own inknow what is in the tank. if i dive to 80 i blend for mod no less than +20 ft I use 1.4 adn not 1.6 for mod. At what point will this practices fail to cover what inaccuracy?????


Thanks for the interesting information.
I guess I will still use the "El cheapo"-way, keeping it K.I.S.S and doing the calculation in software, this is how I have hooked up the sensor,
View attachment 214659
And after testing it with different concentration of O2, I am now at the point that I trust the analyzer when analyzing breathing gas.
The MQ7 CO sensor is an another story, that sensor is useless for this purpose and I have been looking for a good CO sensor to use in this project, did find a sensor by Analox but can't find anyone that sells them, and the prices for that sensors that I could find is not within the budget of this project, also found some sensors sold by euro-gas (Gas Sensors - Carbon Monoxide CO - Gas Sensors) but again, can't find anyone who is willing to sell to private persons and can't find any prices for those sensors.

For powering the analyzer I butchered a "Cell phone emergency charger powerbank", which basically is 5v 2600mAh Lithium ion battery with a charging circuit, that setup gives the analyzer a continuously run time of at least 7 hours.
 
Todays update:
I went back to plan A and used 5v as the referance voltage, using a LM358 opamp, 330Ω resistor and a 1.5Ω resistor to create an no inverted amplifier circuit with a gain of 221, to aplifie the signal from the O2 sensor from 0-20mV to 0-4.42v. Using a referance voltage of 1.1v made the CO sensor act funny.
View attachment 214155
Hi jboneng

I'm a senior R&D electronics engineer. Feel free post your schematic, could be as a pm, for a check.
A L358 can output supply-2V max at 10K load, so max reliable output will be 3V.
Your feedback resistors are too small. you should at least multiply both by 3, but 30 is also fine, reaching those 10K load.
LM358 has a large offset, varying over temperature. It is really easy to use, as it includes 0V for input CM range, but the offset is not good for this use - typ 2mV, max 7mV (with variation over temperature) is not nice. It is not easy to null by simply removing the sensor and shorting its terminals, as the opamp can't output 0V correctly.
I would really recommend a more precise opamp, however most would require a DC offset circuit like the one published here.

I have searched for precise 5V opamps, including negative rail on input, and with rail to rail outputs (so you can keep your simple circuit) and in PDIP 8-pin house, and at TI they make the following ones:
TLC2652 is great but expensive
OPA241 is good and less expensive.
Both are MUCH more precise.
 
Hi jboneng

I'm a senior R&D electronics engineer. Feel free post your schematic, could be as a pm, for a check.
A L358 can output supply-2V max at 10K load, so max reliable output will be 3V.
Your feedback resistors are too small. you should at least multiply both by 3, but 30 is also fine, reaching those 10K load.
LM358 has a large offset, varying over temperature. It is really easy to use, as it includes 0V for input CM range, but the offset is not good for this use - typ 2mV, max 7mV (with variation over temperature) is not nice. It is not easy to null by simply removing the sensor and shorting its terminals, as the opamp can't output 0V correctly.
I would really recommend a more precise opamp, however most would require a DC offset circuit like the one published here.

I have searched for precise 5V opamps, including negative rail on input, and with rail to rail outputs (so you can keep your simple circuit) and in PDIP 8-pin house, and at TI they make the following ones:
TLC2652 is great but expensive
OPA241 is good and less expensive.
Both are MUCH more precise.

Thank you very much for the information and offer :D
Right now I have removed the op-amp and just run the arduino with an internal reference voltage of 1.1v, which seems to work well (it gives correct readings of the test gases). But I would prefer to use an op-amp,
Since I live in Redneck-county, Norway I can't just walk into a shop and buy electrical components, so I wondered if you know any webshops that sells the TLC2652 and ships to Norway for a reasonable fee?

And on an unrelated note, a problem that have manifested it self, is that as soon I plug in any of my 3 LED buttons, the Arduino IDE reports that the programmer is not responding when uploading a new sketch, and the Serial.println stops outputing, making debugging difficult.

Anyway I have learned much more from this project than what I thought I would :)
 

Back
Top Bottom