Design maths for measuring helium by speed of sound - GregoryPye/Trimix-analyser GitHub Wiki
A key component is to measure the percentage of helium in the gas, and one option for that is to use the varying speed of sound - almost 1000 m/s in pure Helium and a third of that in oxygen or nitrogen (and therefore in air which is a mix of the two). This post has some maths to support thinking about design options.
- Must be able to go from 0% through to 100% of range. Almost the full range is used in technical diving, so the device has to be able to handle the whole range.
- Entire measurement inc. calibration must be accurate to +- 1%. Gas analysis for diving does not tend to need precision for helium tighter than 1%. Better would be nice, but is not critical. But, that needs to include all sources of error, including any calibration or corrections for things like temperature. Note that oxygen may need to be better, especially for hypoxic mixes (those of below ~15%).
- Should resolve to +-0.1%. People are used to 0.1% reporting precision in gas analysis, so that seems a good a starting place, even if the actual accuracy may not be as high (last bullet).
- Should require no more than a litre of gas (=1l/min for a minute). A core aim is to measure the gas mix right before you dive, so you don't want to loose much volume in doing so. The smallest cylinder used for breathing gas is 2 litre (on a CCR like the Redbare), typically at 200 bar, so containing 400 litres of gas. If the test volume is kept to a litre then that is only 0.5bar each time which is manageable. Less is better - e.g the Divesoft analyser that uses speed of sound is stated to work on 0.1l/min or a tenth of this flow ... but it isn't considered a deal breaker if not possible at the target price level.
- Should require only 'standard' components. Its clearly possible to go all aerospace and use specialist / expensive components, but the goal of the whole project is to see if a good quality device can be built at a much lower price point.
- At this early stage, design for pre calibration / correction measurement accuracy of 0.1%, aka the same level as the resolution. Given that the underlying effect of helium mix on speed is linear that should provide headroom for other sources of error to be contained well within the overall error budget
- The timing challenge clearly gets harder as the distance gets shorter, but there isn't much room for a straight line in any reasonable device. My base design assumption is that a waveguide is used, and that waveguide wraps a decent distance up in a much shorter volume. One option might well a spiral guide which can contain a considerable length but with has no hard corners that would reflect sound. That could be 3D printed or milled from a block, with both being cheap enough to consider as 'standard' components. In fact, it should be possible to stack spirals so that a considerable distance (much more than a metre) could be contained in a small size envelope, though attenuation might become an issue. For the purposes of this first cut a distance of 1 metre is used
- If gas is flowing then the speed will be higher when measured with the direction of gas flow and lower when measured against it, with the real speed that relates to the gas when at rest the average of the two. If this makes a material difference that impacts on target accuracy at the max flow rate likely to be seen then it needs correcting. It is assumed that it might, not least as its mentioned as an approach for the Divesoft analyser that uses this speed of sound approach. So, design assumption is to measure the speed in both directions and take the average. This also means that as a helpful side effect it should be possible to detect gas flow from the difference in measurements, though practically the gas flow can be heard in most devices, so it would also be possible to just wait for a suitable period as is done in practice for most current analysers.
- Key 'standard component' is expected to be the use of standard 40kHz ultrasonic transducers. As will become clear, this could in fact become a limiting factor as the period is about 10 times the target detection time, so it could drive substantially more complex approaches to signal processing. But given price it is a good starting point.
| Fastest speed (Helium) | 972 | m/s |
| Slowest speed (Oxygen) | 326 | m/s |
| Target resolution | 0.10% | n/a |
| Measuring distance | 1 | m |
| Shortest duration (= distance / speed) | 1,029 | microseconds |
| Longest duration (= distance / speed) | 3,067 | microseconds |
| Timing accuracy needed (= duration difference * target resolution) | 2.0 | microseconds |
Second is that things like interrupt handling on microprocessor devices can mean that actual timing accuracy is less good than expected. Interrupts can cause delays of the order of 100-2000 microseconds which clearly isn't useful. People have dealt with this e.g. by stopping interrupts briefly, or by dropping any samples where an interrupt occurred that affects the sample. Even then, the underlying accuracy needs careful thought as this is pretty much at the limit that people have achieved with cheap devices. All that said, people have done timing down to the right kind of level using cheap multifunction devices, and if one assumes that the precision is only required for a very short time window then it should be possible (e.g. see here). And, its possible to buy very cheap pocket digital oscilloscopes that are sampling at a MHz or higher, so its clearly a soluble problem.
I'm expecting that waveguide sizing will be a tradeoff, with larger areas reducing attenuation of the signal, but requiring more gas. At a theoretical level it would be possible to take a small static sample of gas and test it. However, it seems much safer to assume a flow of gas and wait until the reading stabilises.If one assumes that up to a minute could be required from first opening the gas flow until the point the user is comfortable that the output is stable, then the sample chamber must be full fairly quickly (say 10% of the time).
Given the design goal of no more than a litre of gas, the flow rate has to be 1l/min or less and to fill in 6 seconds (10% of a minute) at 1l/minute equates to 0.1 litres of gas. For a length of 1 metre that gives a waveguide area of 100mm^2 or 10mm x 10mm. Since there are 40kHz transducers in 10mm round cases that feels likely to be fine, and quite possible that smaller is also very possible.
Whilst not a primary design goal, it would also be nice to be able to detect the flow of gas was adequate which requires the speed of gas when measured in each direction to make a difference of ~2 times the smallest detectable speed of sound difference. That equates to +-0.1% of ~650m/s or 0.65m/s. For a 1 metre waveguide that means changing the gas in 1.5 seconds, or 4 times as fast as the answer above. That would result in a 5mm x 5mm sized waveguide. Post some tests in open air then that might be a good initial assumption for a waveguide test.