Introduction: Home Made - One Hand - Nitrox Analyser Arduino Based

Hello readers,

In this instructable, I will show you how I built this Arduino based oxygen analyser.

*** WARNING - This is the kind of material that can be used to control your dive mix composition. Diving may be dangerous and everything you do with this is at your own risk. ***

This note is composed of two parts

1) I will describe how I built the box, because building a circuit on a breadboard is one thing, building a finished product is another one.

2) I will provide you the source code

Every parts I used are available on Ebay, from China or Hong Kong.

Here is the details of what I used :

- 9V battery (IKEA one because i like the color)

- 9V battery connector

- PVC enclosure.

> after thinking a lot, I found one in wich the battery can enter and is "naturally locked" by its dimension

- Arduino board

- LCD display

- Two switch.

One for on/off.

Push to set the new mix to 21%. It must be "push and release"

- One oxygen sensor

- A cable to connect your oxygen sensor (here it terminate by a jack plug)

- ADS1115 to convert mV provided by the sensor to digital signal.

- Cables

Step 1: Display

The display is connected using a "Dupont" cable.

It is glued on the box cover

I used some "plastic foam" (the kind of stuff widely used to protect electronic component during post transfer). I cut a small part of it, glued it on the LCD and on the box cover.

This is working very good.

Step 2:

The box contains an ADS1115 with convert millivolt to digital signal. It is connected to the sensor via a jack audio cable.

Two button : one to switch the system on/off.

The second (the red one), once pressed, will set the system 21% oxygen.

The system automatically calibrates on 21% when started.

*** HOW DOES IT WORK - DETAILS***

In fact when there are no oxygen, the sensor delivers 0mV

When started, the system consider it is in 21% oxygen, measure the mV (let call it x ) provided by the sensor and store it.

Then it observe at rapid interval the potential provided by the sensor, and thus display the corresponding oxygen level.

0 mV ->0%

x mV -> 21%

<measure> mV -> ..

It display also the details potential and the slope used for the calculation (s= ... on the display)

It performs an quick average in order to avoid fuzzy display and Is able to display '--' if the sensor is HS.

I added a moving avery to smooth the variations.

(I leave you studying the code for this)

Step 3: And the Arduino

At the bottom, an arduino is also glued and powered directly but the 9V battery.

Step 4: And Now the Arduino Code

This is the arduino code :D

Put the libary in the arduino libray folder.

It is the original "running average" with some additionnal function.

Comments

author
EastCrow made it!(author)2017-04-14

hi. i have another problem : Arduino: 1.8.1 (Windows 8), Плата:"Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

D:\Diving\rebreather\po2\RunningAverage\RunningAverage\po2\po2.ino:16:28: fatal error: RunningAverage.h: No such file or directory

#include <RunningAverage.h>

^

compilation terminated.

exit status 1

author
goobes made it!(author)2017-04-14

Unzip the running average i provide and put the folder "running average" in your arduino library folder.

author
goobes made it!(author)2017-04-14

Hello EastCrow,

My code is using several external libraries (one for the display and for for the converter analog digital). I do not provide them because they are completely standard.

That's written in the beginning of the code but it seems you are not completely familiar with arduino.

They are also web available. If you want i sent you the zipped folder by mail.

#include
#include "U8glib.h"

Chris

author
EastCrow made it!(author)2017-04-15

Hi, i beginner for the ardunio. Please send me zipped folder to east_crow@mail.ru

author
EastCrow made it!(author)2017-04-14

another trouble : Arduino: 1.8.1 (Windows 8), Плата:"Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

C:\Program Files (x86)\Arduino\RunningAverage\RunningAverage.ino:18:31: fatal error: Adafruit_ADS1015.h: No such file or directory

#include <Adafruit_ADS1015.h>

^

compilation terminated.

exit status 1

author
EastCrow made it!(author)2017-01-28

hello! what are the pin connect to The second (the red one), once pressed, will set the system 21% oxygen.

author
goobes made it!(author)2017-04-12

This is the pin2. Google arduino pro mini pinout to know exactly where is the pin2 on the board. You will get lot of beautiful diagram.

author
goobes made it!(author)2017-01-28

Hello, i am travelling and have no access to source. I will be back on 5/2 and take a look. Perhaps take abus look at the pin wich is inputpullup...

author
EastCrow made it!(author)2017-04-12

Hi! may you access to source?

author
EastCrow made it!(author)2016-11-28

Hello! what the ardunio bord need?

author
goobes made it!(author)2016-11-29

Hi eastcrow,

Arduino mini 5v.
Mainly because it fit in the box... otherwise any model will work!

author
tom.keijmel made it!(author)2016-09-09

can you detect if the o2 sensor is ok? i have a gox100 and it can tel when the o2 sensos is no good. is that based on the mv output of the cell ?

author
goobes made it!(author)2016-09-09

Hello tom.
I do not handle this.
The cell just return a potential ( in mVolt).
Zero when no oxygen.
X for 21%
If you have y mv... you habe to calculate the ratio considering the potential vs oxygen is linear.

When a cell is used: the potential vs voltage is no more linear or not stable.
Has no method seemed to me sure, i prefered not to implement anything bad.

If you have a doubt.. better to do a test with two known gaz like nitrox 80 ans air !

author
rvisser2 made it!(author)2016-08-10

Cool! I love it

Trying to build it now and cannot get the error 'class RunningAverage' has no member named 'getDelta' solved.

Maybe i use the wrong library?

author
goobes made it!(author)2016-08-10

No problem. I will help.
Thanks for your comment.

I did this last year. I forgot to mention that (even if it is not good), I added a function in the library to have an idea of the "stable or not" measure.
I add the library (cpp and h file) in the provided files.
Just replace yours.
No worry, it should stays compatible.

author
goobes made it!(author)2016-08-10

Remove alos debug if you have size issue. The display library takes a LOT of program space.

To remove, just remove #define DEBUG in the following.

If you do not define it, the compiler will replace the debug command by nothing

#define DEBUG
#ifdef DEBUG
#define DEBUG(x) Serial.print(x)
#define DEBUGLN(x) Serial.println(x)
#else
#define DEBUG(x)
#define DEBUGLN(x)
#endif

author
rvisser2 made it!(author)2016-08-10

To be sure, the O2 sensor is connected to A0 and A1
+ to pin A1

Then i should see something on the serial output? ( i have no display at the moment connected )
Because i cannot get any result other then O=21.0 when blowing in the sensor for example

author
goobes made it!(author)2016-08-10

happy to see it compiles. ! (You are the pioneer) I have to publish a more didactic version of the code... I will.

I instanciate the ads object with "74" as argument. This is the address the ADS chip and the arduino will use to communicate on the I2C bus wich can connect lot of devices.

To say the ads that he has to use that address (it can use 4 differents), you have to connect its addr pin to sda. If you want detail : All is explained in ads techspec from texas instrument - section I2c address selection.

I spend myself lot of time with I2C ... if with another stuff you are one day wondering, you can google to get an I2C address dumper that gives you all the adresses on system connected. Always noce to have.

author
rvisser2 made it!(author)2016-08-10

Cool service!

Thanks a lot!

author
tomatoskins made it!(author)2016-07-22

What a fun project! Thanks for sharing and welcome to the community!