Open Source Dive Computer

Abstract

A dive computer project will be demonstrated. Based on an ATMEL 8-bit microntroller (ATmgea32) an implementation of Buhlmann’s algorithm ZH-L16 will be presented. The respective hardware will be described, including a high pressure resistant housing usable for water depths of >100 meters (300ft.) being able to resist ambient pressure of >10bar (150psi) will also be explained. The first version of this project has been released in 2003 (starting with a dot matrix display) undergoing a lots of modifications and finally come to a computer with a graphical display in 2010.

A brief theory of decompression in scuba diving

When scuba diving the diver is exposed to a higher pressure compared to being surfaced. Ambient pressure under waters increases as depths increases on the basis of a linear function. The rate can be calculated as bout 1 bar pressure increase per 10 meters diving depth. Thus, in a depth of 50 meters for example, we find 6 bars ambient pressure (1 bar air plus 5 bars water pressure).

As the diver breathes compressed air from a diving regulator the nitrogen that forms about of 78% of breathing air solutes into the body’s tissues. The nitrogen inside the tissues is kept there as long as ambient pressure is more or less constant. When surfacing again and ambient pressure decreases nitrogen in solution leaves the body’s tissues and comes into blood stream. In case the amount of free nitrogen exceeds a certain level, solid bubbles of nitrogen are formed. These bubbles can lead to severe health damage, even death has often been reported.

Thus it is necessary to thoroughly plan the diver’s ascent back to the surface, i. e. to limit the ascent rate. In former times this has been done by tables which divers used to carry with them. Together with a depth gauge (reading out maximum dive depth) and a watch for timing the ascent could be calculated and underwater stops (defined by depth and time) were mandatory to surface safely. As this has got something to do with calculation it was quite a logical development to delegate the computing to an underwater calculator as soon as affordable hardware was available. So, the development of hand-held scuba computers started between the 80s and the 90s of the last century.

The calculation can be based on various algorithms of whose the model ZH-L16 by professor A. A. Buhlmann from Zurich University is the best documented and a widely used method of calculation. It calculates a so called “tolerable tension” of nitrogen in body tissues by defining certain parameters that lead into a calculation consisting of 3 formulas. These formulas are implemented in the software that will be shown in this article.,

Hardware of the Open Source Dive Computer

The complete electronic circuitry fits on a board of about 7 x 5 centimeters in size:

On board there are:

  • Atmel AVR-Mikrocontroller (ATMega32, 32 kB Flash-RAM, 1024 Byte EEPROM),
  • LCD-Module Type 162C,
  • analog pressure sensor (INTERSEMA MS5212BZ),
  • operational amplifier,
  • temperature sensor
  • power supply (6V) by rechargeable battery,
  • user keys,
  • reed switch for on/off operation.

Pressure gauging

The central part of every dive computer is an electronic pressure gauge. We call this a “sensor”. A sensor converts a measurement value into an electrical value, usually a voltage. The sensor”s output can be either analog or digital. As digital sensors were quite new about 20 years ago an analog sensor was the #1 choice that time. Several sensors have been tested, the one that “made it” was the INTERSEMA MS5212BZ that can be applied to an ambient pressure of 20bars (~300psi).

This sensor is based on the principal of the so called “Wheatstone Bridge”, a network of 4 resistors, 3 of them fixed values and one variable (in this case the pressure depending resistor element).

Picture adapted from Wikipedia

When one of the 4 resistors in the network changes its value, a relatively high voltage alternation (ΔU) will result. This voltage swing is based on a linear function on the ambient pressure. The voltage must be amplified, here by an operational amplifier which will be subject for later explanation.

The resulting DC voltage then will be fed into the analog-digital-converter (ADC) inside the microcontroller and converted into a pressure value, the basis for decompression calculation.

 

Another similar sensor, a Siemens KPY14 type, had been examined in preparation for this research project in the respective way and showed a relatively linear function between ambient pressure and voltage out (here here enhanced by an operational amplifier LM358):

To get the data a pressure chamber had to be constructed that was able to withstand inside pressure of about 10 bars. This chamber was made of flexible high pressure hose material terminated with copper fittings from hardware store to which hose connectors had been soldered. The pressure chamber was pressurized by air from a scuba tank connected to the intermediate stage of a 2 stage diving regulator. A diving regulator had also been connected to release pressure when the chamber was about to be deflated. This made it possible to drive fast end reliable testing sessions of the sensor with lots of repetition.

Pressure measurement test unit

Cabinet

The requirements for this project defined that the hardware must be able to resist ambient water pressure in the range of about 20+bars, which equals to water depths of about 200 meters. To keep the design as simple and reliable as possible a cabinet consisting of 2 basic parts had been designed. The lower part was a simple aluminum frame (tub shaped) with 6 screw threads (M2.5) to hold the upper part.

The upper part was made of rectangular shaped piece of acrylic glass. The thickness was calculated with 10mm by using formulas from mechanical engineering. Thus it is able to withstand the high ambient pressure required by the project definitions.

A notch had been cut into the edges of the aluminum block an been filled with an o-ring of appropriate lengh to avoid penetrating water from the outside.

Sensor sealing

As the pressure sensor element in use is not able to withstand water (particularly salt water) it had to be protected from harsh environment. A hole of 7mm in diameter had been drilled into the acrylic and the sensor was glued inside fro the reverse side with 2 component glue. This built up a tiny “pressure chamber” in the acrylic outside cover that had been filled with silicon oil. The water side subsequently had been covered with a small piece of thin rubber to conduct ambient pressure to the inside.

The electronic circuit

The main parts of the dive computer are the microcontroller, the operational amplifier, the battery and the interconnections between the various parts. This made a relatively simple circuit. User keys were only accessible in surface mode with cabinet opened. Being submerged no more alternations in settings could be made.

Open Source Dive Computer

Explanation

The pressure sensor is interfaced to an operational amplifier that generates a DC voltage between 0V and about 2 volts depending on ambient pressure. This signal is fed into the analog-digital-converter (ADC) of the microntroller unit (ATmega32), then read by software periodically in a 10 seconds interval and afterwards converted into a depth value to be displayed to the diver. The pressure value also is the numerical entry value for a set of equations according to the ZH-L16 decompression algorithm.

Also a temperature sensor is integrated. It is mounted very close to the edge of the circuit board providing close thermal contact with the aluminum cabinet. Due the the high thermal conductivity of this material the outside temperature can be measured on the inside surface of the cabinet with high accuracy.

The unit is powered by 5 NiCd cells (1.2V volts each, 800mAh capacity) switched in serial thus providing DC supply with 6V. A simple charge unit has been integrated: A 6V light bulb (6V, 50mAh current) that is used as simple PTC device thus delivering relatively constant charge current to the battery.

The dive computer is switched on/off by a neodyn magnet outside. When starting the dive it is pushed into a position right across the reed switch thus putting the computer into operation.

A DOT-matrix-display has been selected in this version of the project because it is very low power consuming.

Software

The software has been written in C using the GNUGCC environment for ATMEL AVR RISC machines. It can be downloaded from y Github repository.

The code implies the following main submodules:

  • Reading data from ADC for pressure ant temperature
  • Processing pressure data in real time to convert it into tissue saturation of the diver according to Buhlmann algorithm ZH-L16.
  • Showing the current dive parameters to the diver, especially the decompression stops that have to be kept.

The calculation is done on run time by dynamically calculating tissue saturation and computing acceptable ascent parameters on the basis of the real-time tissue factors. The code also allows different gas mixes because not only air is used in scuba diving. Thus the fraction if nitrogen can be set individually to calculated so-called “Nitrox” dives where oxygen fraction increases and nitrogen decreases. Also mixed gas diving (Trimix) has been included to certain versions of the software.

Results

The dive computer described in this article has been used in more than 500 dives in sea and fresh water. Dives to depth up to 80 meters were performed. Temperature range had been from about 2 or 3 °C water temperature in local lakes to about 26 to 27 °C in coral seas.

The hardware, all in all, showed only minor failures. One problem that sometimes occurred was that the acrylic cover, when it had not been fixed very thoroughly, allowed some drops of water to penetrate to the inside when being submerged. No severe leakage had been observed.

All decompression dives that had been performed with this computer did not produce any adverse health affects after the dives.

With an LCD DOT matrix display the battery was able to stand a 6 days dive holiday without the need to recharge.