Open Source Trimix Enabled Dive Computer

Hi All

I'm looking for help in putting together an open source dive computer. All designs and code will made available for free upon completion.

Why you ask?
Well commercial versions of these start at £600 and sail all the way to £1200+ and that's just crazy in my opinion. I also want to give back as I've recently decided to be more socialist than capitalist so want to do this.

What have I done so far?
Well I have the algorithm to drive it, and have researched all the required components. Being a mechanical engineer I can't do the programming but I will be designing the housing and case for this which will be my donation to the cause. I will produce 2d and 3d models so people can make their own.

It's governed by theoretical compartments in the body (16 each for Nitrogen and Helium) and the half times for these to absorb each gas then off gas it. The single algorithm governs these which is so simple even I understand it :o Others who have done this say the code is very short; to get it running is 150 - 200 lines of code. The interface takes longer but hopefully by then we will have interest from others who can push the project along.

So I'm looking for help to try and make others lives better. Ideally, as I'm not making any money from this, I'm hoping to find other like minded individuals, maybe divers or those who want to give a little back too. If there is none of them I am prepared to pay for this but hopefully it won't be too much to make the project prohibitive.

I would be happy to make any contributors a free case for their own dive computer / rebreather controller (I have a CNC mill and make shiny things from Aluminium and Delrin) so that if they do dive they can use it for their own needs.

Please help!


Hi Jools,
I would be interested to help if I can... would you mind elaborate a little bit more of what exactly arduino should do here?

Feel free to send me an email at

Hi jools

This is a really well organized post and am interested since I have done something similar

Hi Gianluca

Thanks for the offer. I thought I'd respond here, then if others find it helpful it benefits all.

The basics for minimum viable product to get in the water would be as follows.

2 piezo electric buttons. to turn on and select the gas mixes that you are using
Depth sensor. One of the variables that the algorithm uses is depth.
Arduino board
Possibly memory and clock timer if there isn't one on the board we choose.

To explain the algorithm it uses is as follows. It's the Buhlmann algorithm for decompression and dates back to the middle of last century. Mr Buhlmann used it to mathematically represent the on-gassing and off-gassing of inert gasses into the body at pressure.

He decided upon the model having 16 compartments for each inert gas that you would be breathing. Mainly he used nitrogen but it works for helium too with modified half times.

The algorithm that governs this is
Pcomp = Pbegin + [ Pgas - Pbegin ] x [ 1 - 2 ^ ( - te / tht ) ]

Pbegin = Inert gas pressure in the compartment before the exposure time ( ATM )
Pcomp = Inert gas pressure in the compartment after the exposure time ( ATM )
Pgas = Inert gas pressure in the mixture being breathed ( ATM )
te = Length of the exposure time ( minutes )
tht = Half time of the compartment ( minutes )

and ^ stands for exponentiation
I have the half time information and all values needed to make this work.

1 ATM = 14.7 psia ( 1 Atmosphere, or sea level standard pressure )

What the arduino has to do is run this algorithm repeatedly for each of the 16 compartments for He and Nitrogen and add the cumulative load up.

This gives total load at any given time.

Depending on the loading then the computer should calculate if you can ascend directly to the surface or need to stop at any point for an amount of time to allow the pressure in the compartment to reduce. This is governed by another even simpler algorithm.

The Arduino should always be calculating the above ascent information and displaying it too.

The piezo electric buttons would turn on the computer (after MVP then I would like to add wet contacts), select gas mixes (so there would need to be a display to show these options) and adjust date and time.

The depth sensor allows you to calculate pgas in the algoritm simply by depth x fraction of gas in breathing mixture.

The display should show times and potential decompression stop obligations.

The clock and memory would be to store the compartment data after a dive incase you did a new dive and had preloaded compartments.

This would be minimum viable product. Moving forwards I would like to add a few more things but they can be done modularly.

Hope this helps and hope you can help.


Hi jools

This is a really well organized post and am interested since I have done something similar

Hi Mugambi

Thank you.

I’d love to have all the help I can get. The more people we have the bigger our success will be.

Please see my response to Gianluca regarding it in more detail.

I think we would need to decide on a platform for where the code is to be developed. Does Github work for Arduino code or is there a better platform or specific Arduino one.


do you have any idea on what to use as 'depth sensor' and gas pressure sensors? what would be the typical values for gas pressure? i mean how great would the pressure change be?

Yes the depth sensor is sorted and even comes with a library. It’s a bit expensive at $70US but for simplicity I will go with it. You can get them from China for substantially less but then would have to write the library; one for the future.

Gas pressure is purely a function of fraction of gas in breathing mix multiplied by depth.

As an example on the surface at 1bar of pressure nitrogen is .79 bar in the air. Slightly less in the lung due to water vapour there (though I have the value for that too).
Every 10 meters of depth adds an extra bar of pressure and increases the density of the air accordingly (at 10meters deep the air we are breathing is twice as dense as on the surface, 30, 20 meters deep 3 x as dense etc ). So breathing air at 10 meters depth would be 1.78 bar (it’s commonly called the partial pressure (PP) of that gas). Correspondingly the PP of the Oxygen proportion of the air you would be breathing would be .21 bar on the surface and .42 bar at 10meters.

You wouldn’t need a gas pressure sensor as such. Gas pressure in the algorithm means the pressure as explained above.

A good explanation is below:

A diver descends from the surface to 30 meters on air and waits there ten minutes. The partial pressure of nitrogen in the breathing gas Pgas is 4 x 0.79 = 3.16 ATM. (In the example 4 = absolute bar pressure as explained above).
Let’s pick a compartment, say number five. The nitrogen half-time for compartment five tht is 27 minutes. The nitrogen partial pressure in compartment five on the surface Pbegin is 0.79 ATM, assuming the diver hasn’t already been diving or subject to any altitude changes. The length of the exposure te is ten minutes. Plugging these values into the equation, we get:

Pcomp = 0.79 + [ 3.16 - 0.79 ] x [ 1 - 2 ^ ( - 10 / 27 ) ]
= 1.33 ATM
So the partial pressure of nitrogen in compartment five of our diver would be 1.33 ATM. In reality, the diver couldn’t have made an instantaneous descent to 100 feet and would have been taking on gas during the descent as well. We could average the pressure during the descent and repeat the above calculation to get an idea of the extra gas, or simply repeat the calculation many times at short intervals during the descent. A computer makes this easy.

You can repeat this calculation, of course, for all the other compartments, you just need to know the half-times, ( See Table 1 ) Again, a computer is the ideal tool for this job. The beauty of the equation is its versatility. Absolute pressure ( not depth ) is used everywhere, as is the actual partial pressure of the inert gas being breathed, so we can ascend or descend to/from any pressure, breathe any gas, change gases, go flying after diving, stay on the surface, do a repetitive dive or anything we can think of.



Hi Jools and others,

I have come across this project and was wondering if you ever managed to scrape together. I'd love to be able to build my own and this looks like it would have been a fun project.