• Welcome to ScubaBoard


  1. 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. Login or Register now by clicking on the button

Nitrox/Trimix & CO analyzer

Discussion in 'Do It Yourself - DIY' started by Miyaru, May 19, 2020.

  1. hsinhai

    hsinhai Contributor

    # of Dives: 500 - 999
    Location: Taipei, Taiwan
    204
    129
    Couple more random thoughts, in the old datasheet it shows sensitivity with 100% helium as 244mV, whereas you get 530mV. Interestingly latest datasheet does not show helium at all.. Is voltage for the sensor running at 3V not 3V3 or 5V? not sure others see similar output levels? but higher voltage may cause heating of the sensor affecting reading (or damage it), is the gas flowing directly over sensor rather than via some flow control, could that potentially cause cooling of the sensor affecting reading, how about corrosion on the sensor structure restricting flow.. wired correctly? you do have the D side of the sensor marked "■" connected to ground, and the C side to positive supply..
     
  2. stepfen

    stepfen Contributor

    # of Dives: 200 - 499
    Location: Greece
    747
    557
    FYI I am using the MD61 (not MD62) sensor because inert gas were explicitly mentioned in the data sheet of MD61 (MD62 was more general). BTW I haven't seen the older datasheets you mention. Any chance you can share them?


    My sensor gets 3V. The whole device is powered by a 18650 battery using a TP4056 based circuit to get 5V (for arduino, adc, screen etc) and then another LM2596 based DC DC converter in series for the 3V required by the sensor.

    Gas flow is limited by a small hole in a plastic tube (at least for now). The whole sensor is placed inside the tube. The tube also has few bigger holes to prevent pressure build up. I have also tried to have a sponge inside the tube to make the flow even more uniform without difference in the measurements.

    Yeap, it is wired correctly.

    Thanks once more for your effort.
     
  3. hsinhai

    hsinhai Contributor

    # of Dives: 500 - 999
    Location: Taipei, Taiwan
    204
    129
  4. hsinhai

    hsinhai Contributor

    # of Dives: 500 - 999
    Location: Taipei, Taiwan
    204
    129
    Ahh.. couple more random thoughts:

    . Looking at the MD61 datasheet, it look like it is not a linear result for helium from 0% ~100%, is that curve sufficient to account for error?

    . Are you using the original formula for calculating results or did you create your own? in the original there is an offset that needs to be applied based on the %% of O2 because "active element meet the combustible gas, its resistance become smaller, and when meet reducing gas, its resistance become larger", helium is a reducing gas and O2 is a combustible gas and so affecting output opposite to the helium? and if Y that could be what is causing the error, if the offset is their maybe test to see if those offset values used match your sensor (add no helium, test different O2 levels and record offset)

    . Also possibly an issue with the offset function itself, >48% O2 offset is -9, but no offset <48%, though not sure it's needed.. hmm maybe Miyaru can comment
     
  5. stepfen

    stepfen Contributor

    # of Dives: 200 - 499
    Location: Greece
    747
    557
    The MD61 data sheet I have has sensitivity curves only for H2 and CH4 which are indeed not linear. I will see if this non linearity (assuming He curve is similarly nonlinear) can explain the difference I get. I also wish I had used MD62 so that I could compare directly my results with everybody's else.

    The formula I am using is simply:
    percentHe = 100 * currentmvHe / VmaxHe;

    where percentHe is the % of He
    currentmvHe is the measurement I get from ADC (actually the average of 20 samples) and
    VmaxHe is the max value for 100% (530mV in my case)
    I assume that for 0% He I have 0mV. In practice as I said in previous post this is ~3mV when sensor is cold and falls <0.5mV after 20 minutes or so - but since the value is changing over time correcting this is not as straight forward as subtracting a value from the actual measurement.

    The correction factor Miyaru is using is for O2 > 48%. According to the guy I am helping (remember I am not trimix certified nor I plan to become any time soon) trimix blends with so high O2 have not much practical use (the MOD is such that narcosis doesn't justify the use of He) hence I have chosen not to implement this correction (at least for now). In any way we are talking about max -16mV (for 80% O2! - much less for lower O2) while I see differences of about -50mV at 21% O2.

    Cheers
     
  6. Miyaru

    Miyaru Tec Instructor ScubaBoard Sponsor

    # of Dives: 2,500 - 4,999
    Location: below sea level
    930
    992
    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):
    [​IMG] MD62
    [​IMG] 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.
     
  7. Francisco Trevisan PY2ALC

    Francisco Trevisan PY2ALC New

    # of Dives: 5,000 - ∞
    Location: Ubatuba São Paulo Brazil
    4
    0
  8. Miyaru

    Miyaru Tec Instructor ScubaBoard Sponsor

    # of Dives: 2,500 - 4,999
    Location: below sea level
    930
    992
    See pages 3 and 4. Libraries are mentioned in the code. Menu & screen buildup is totally up to your creativity.
    Or, read the thread and follow the instructions for a ESP32 version with firmware.
     

Share This Page