In the original code from Yves Cazé, the calibration values are defined with constants. In his case, the MD62 sensor outputs 661.26mV with 100% helium. Since the sensor needs to warm up, a correction factor is applied (lines 169 till 186) until the device has been running 480 seconds.
For oxygen, the cell voltage in air is taken as a reference for 20.9%, and a linear line is assumed from 0mV=0% oxygen to the air calibration voltage and extrapolated to a theoretical 100%.
Although I'm not a rebreather pilot, the technology is very interesting and one of the recurring themes in CCR diving is the O2 cell drift. The cell can be assumed linear, but 0mV is not 0% oxygen.
Many CCR pilots can explain this way better than I can, but the most important part is that real-life behaviour differs from theoretical behaviour.
Three relative easy scenarios can be created at home or in a dive shop, and provide calibration values for the oxygen and helium sensors: air, 100% oxygen, 100% helium. I use the sensor values from these three situations and stored them in the eeprom memory for gas calculations. Each analyser will measure different calibration values because they will be different: soldering quality, cables used, resistance of the entire circuit. Measuring and storing actual values (=calibration) is the solution to this practical issue.
What I did next, was connect oxygen and helium tubes from tanks with needle valves and watch the voltages from the cells. The MD62 cell is theoretically linear according to the datasheet, but in relation to what gasses?
Oxygen and nitrogen have thermal conductivity that influences the total thermal conductivity measured by the MD62 sensor. When increasing the oxygen flowing over the MD62, you'll see a rise in the voltage and I used these to prevent the processor from displaying any helium values:
Code:
//correct heVact in case of high O2 levels - empirical!
if (oxygen>89) { heVact = heVact-17; }
else if (oxygen>82) { heVact = heVact-16;}
else if (oxygen>75) { heVact = heVact-15;}
else if (oxygen>71) { heVact = heVact-14;}
else if (oxygen>66) { heVact = heVact-13;}
else if (oxygen>62) { heVact = heVact-12;}
else if (oxygen>57) { heVact = heVact-11;}
else if (oxygen>52) { heVact = heVact-10;}
else if (oxygen>48) { heVact = heVact-9;}
So this is the only the case when measuring EAN48 or higher. I haven't tested e.g. TMX50/50 since I would never use that gas (and I don't know anyone who would). So
@stepfen is correct that such gasses are of no use in diving. This correction is only to prevent the processor from indication a low helium percentage in high nitrox blends.
The temperature factor that Yves Cazé applies
might work with a cold sensor. If you would restart the arduino, the same factor is applied again during the first 8 minutes and the way he programmed it, it's accumulative (I'm not sure if that was the intention). It's easier to place a temperature sensor next to the MD62 and check how warm it actually is. From what I've seen till now, the sensor is warmed up to a range of 29-33 degrees Celsius. And that's in an ambient temperature of 15-20 degrees Celsius. Once summer has daily temperatures over 30 degrees, I'll check again what the sensor does.
As for the MD61 versus MD62 sensor: I built a second analyser with the MD61 and what I see is that the voltage in 100% helium is higher (2 sensors placed in the same gas tube):
MD62
MD61
Further tests I have done (MD62): I blended TMX 10/70, 15/55 and 18/45. With a flow of 0.5 liters per minute, these gasses went over the sensors of my analyser and straight into a commercial analyser (I have tested with DiveSoft and Analox, unfortunately I didn't have these borrowed analysers at the same time).
The results were within 1% of the DiveSoft, and within 4% of the Analox. But...the chemical helium sensor was at least several years old, so I don't know how much that could have influenced. Because of the close-to-DiveSoft results with a warmed up sensor, I didn't apply any further corrections in the code.
At the moment, I don't have these gasses to test again with the MD61 sensor.
Most important aspect is that the tube with the sensors has no dead air spaces and is as small as possible, and that a flow is measured instead of static air. If static air with CO in it is measured, the CO sensor will saturate and display a higher value.