Introduction: Easy to Build Oxygen Analyzer Using an Arduino Compatible Micro Controller
As a builder of gadgets and a scuba diver I have been trying to build an oxygen analyzer for a bit now. The big problem is that most micro controllers can’t read the mv that the sensor puts out. I played with opamps, but never got it to work properly. Finally I found the Texas Instruments ads1015, an analog to digital convertor chip “adc”. Adafruit makes a nice breakout board to make your life easier.
Now I only need a micro controller, an LCD screen, an oxygen sensor, a push buttons and like 9 resistors or so and I got yourself an oxygen analyzer.
Step 1: Shopping List
Below are the components and parts with the links to where you can buy them
- Adafruit Pro Trinket 3v micro controller https://www.adafruit.com/products/2010
- Adafruit Lipo backpack charger for the Pro trinket with battery https://www.adafruit.com/product/2124
- Adafruit ads1015 breakout board https://www.adafruit.com/product/1083
- Nokia 5110/3310 monochrome LCD https://www.adafruit.com/product/338
- 7 10k ohm resistors
- 1 300 ohm resistors
- 1 push buttons
- 1 mono mini headphone plug
- Hookup wire
- Audio Jack - 3.5mm (Panel Mount) https://www.sparkfun.com/products/11154/
- Teledyne R17 O2 Sensor http://www.oxycheq.com/analyzers-sensors/sensors/...
- Sensor Cable *2 Foot* http://www.oxycheq.com/analyzers-sensors/accessor...
- Sensor Tee http://www.oxycheq.com/analyzers-sensors/accessor...
Step 2: Connecting It All Together
ADS1015
VDD Pin to 3.3v
GRD Pin to Ground
SCL Pin to A5 Pro Trinket
SDA Pin to A4 Pro Trinket
A0 Pin to Connected to the Audio Jack - O2 Sensor + pole
A1 Pin to Pull up Resistor 10K
A2 Pin to Pull up Resistor 10K
A3 Pin to Pull up Resistor 10K
Nokia display
VCC Pin to 3.3v
GRD Pin to Ground
SCE Pin to D8 Pro Trinket
RST Pin to D6 Pro Trinket
D/C Pin to D5 Pro Trinket
DN(MOSI) Pin to D11 Pro Trinket
SCLK Pin to D13 Pro Trinket
LED Pin to 200 ohm resistor to 3.3 V
Push Button
1 pin to Ground
2 Pin to D3 and a 10k pull-up resistor to 3.3v
Lipo Backpack
G Pin to Grd on Pro Trinket
3V 3V Pro Trinket
Pro Trinket
All the connections to the pro trinket are described in the above descriptions. I have added one 10k ohm pullup resistor to the RX pin. The Pro Trinket has the habit to sometimes hang on boot. This pullup resistor seems to remedy this. Why?..... Don’t know, a much smarter tinkerer on one of the Adfruit forums told me this piece of wisdom.
Note
The Lipo Backpack is the power source for the project. Every 3v connection needs to be connected to the Lip Backpack 3v and all the Ground connections need to be connected to the Lipo Backpack Ground including the audio jack witch is connected to the Ground of the Oxygen Sensor.
Step 3: The Code
All the libraries used are from Adafruit and are easy to download from their site at www.adafruit.com. The formula for calculation the O2 % is simple.
(current mv from sensor / mv from sensor in the air) *20.9.
The only thing you need to do is store the "mv from sensor in the air" value in a variable before you try to analyze any gas. I do this in setup routine of my sketch or when you press the push button. Just download this zip file and upload the sketch to your pro trinket.
Attachments
Step 4: Finishing Toughes
To complete the project I put all the components in an enclosure and added 5v Regulator like a the 7805T witch I connected to the 5V in pin and the ground pin on the Lipo backpack to charge the battery.
I also added some code to calculate the maximum operating depth “mod” of the analyzed gas for a PO2 of 1.4,1.5, and 1.6
Formula for Imperial “Feet”
mod= ((po2/fraction of gass)-1)*33
Formula for Metric “Meter”
mod= ((po2/fraction of gas)-1)*10;
I also added a button so I could create a menu to select your mod unit “Meter or Feet”. To prolong the battery life I made it so that you can turn the backlight on the LCD display on and off.
I could show you how to do these things but figuring this stuff out is half the fun. If you get stuck I can help a little. If you know how to improve on the project please let me know as it is always good to learn new things.
36 Discussions
5 weeks ago
hello dear
i cant under stand ur sketch
it seems not complete and is for just callibrating sensor,
how do u know what percentage is o2 with current mv of sensor
it must be a function
4 months ago
Please mention If someone did this instrument. How much it costs ? The links with sensor îs not more available . Could You mention other links ? Thanks.
If somebody knows a similar circuit for oxigen monitorizing please mention it here or on email : constbad@gmail.com. thanks
Question 4 months ago
CAN I GET SINGLE LINE CIRCUIT DIAGRAM OF THE ABOVE PROJECT
Question 5 months ago
Hi! Can I turn this into a controller as well?
Question 7 months ago on Step 2
can you send the circuit diagram and some fundamental calculation
8 months ago on Step 3
Thank you for your training
Does this sensor show up to 98%?
Question 11 months ago
What is the accuracy limit of the oxygen sensor used in this analyzer?
Can it detect the oxygen within a limit of 0.1 - 0.5%?
Question 1 year ago on Introduction
Hi, could this be turned in to a trimix analyzer? Used to Show both 02 and He maybe even the MOD of the mix?
Thanks
3 years ago
Hi, Can it measure the oxygen in the air like in the room???
I want to buid it to measure the oxygen in the factory...
Reply 2 years ago
yes it can
Question 2 years ago on Introduction
Hi.
i wanted to findout if you had a circuit diagram of the oxygen anlyser you worked On ,i really wanted to see the arrangements.
THANKS!
3 years ago
Can O2 sensor measures the oxygen in air?
Actually,I want to use this sensor to measure the oxygen in hill areas.is this possible or not?
3 years ago
mine is not working i have used an arduino uno and my sensor is envitech oom 102-1 but the display just gives the output calibrating nothing else .
please help me
3 years ago
i want to connect this to piezoelectric valve. the purpose is to keep oxygen at 5% in a small space close environment of biological organism. is it just simple modification of your code? Can someone point me the right direction? thanks!
4 years ago
Hi! Does this reads water oxygen level?
Reply 4 years ago
No it does not, it is a gas analyzer. I am not even sure if there is a probe or sensor that reads dissolved O2 in a liquid .
Reply 3 years ago
Dissolved oxygen is one of the most common wastewater analyses conducted. Multiple vendors provide ion-specific electrodes
4 years ago
Hi and thanks for replying.
Finally got time to play with it again and do some debugging.
I was using ADS1115 board and at gain 16 it must have been too sensitive or something. Did a coversion of the reading to real mV on the screen and once set to gain 4 I finally get readings that are similar to the multimeter.
Thanks again for the great post!
4 years ago
Hello. Have you tested the readings against some reference oxygen meter?
I have some issues with results - I do get the output, put the readings are dependent on the air pressure to the sensor.
My simple reference is just a multimeter. For my sensor it reads 10.1mV in air.
I am actually testing for nitrogen, so expecting to see a drop. With
nitrogen mix of about 10% O2, on the multimeter I get about 5mV. But on
the arduino the readings translate to like 8%.
I also tried O2 at
high % (did not do reference read on the multimeter, so do not know
what it was) - the readings on the arduino changed into negatives =(
Also, after calibrating to 20.9% O2, if I unplug the sensor it still reads around 1.5% on the arduino.
What am I doing wrong?
Reply 4 years ago
I have tried it with the sensor mentioned in the build. I had an oxycheck o2 analyzer with the same sensor. I had a period of time where I was using nitrox almost every weekend. I have tested it against other analyzers and it was well within 1% which is the acceptable
I build it to calibrate against compressed air 20.9% O2. You need to calibrate as the voltage your sensor output changes with the age of the sensor and the temperature the sensor is in.
Q did you alter the code?
Q did you use the same components
Q Is your sensor within factory spec outputs. I have had bad sensors before.
If you can send me diagram or pic of your build I can look it over. My email is akurk@4divers.ca.