{"id":3258,"date":"2020-04-23T19:10:32","date_gmt":"2020-04-24T00:10:32","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=3258"},"modified":"2020-04-25T01:55:20","modified_gmt":"2020-04-25T06:55:20","slug":"using-seeed-studio-o2-sensor-arduino-without-grove-breakout-board","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/using-seeed-studio-o2-sensor-arduino-without-grove-breakout-board\/","title":{"rendered":"Using Seeed Studio O2 Sensor Arduino Without Grove Breakout board"},"content":{"rendered":"\n<p><a href=\"https:\/\/github.com\/SeeedDocument\/Seeed-WiKi\/blob\/master\/docs\/Grove-Gas_Sensor-O2.md\">https:\/\/github.com\/SeeedDocument\/Seeed-WiKi\/blob\/master\/docs\/Grove-Gas_Sensor-O2.md<\/a><\/p>\n\n\n\n<p>The Seeed Studio O2 sensor is a nice Oxygen sensor.  It works up to 25% Oxygen concentration and is easy to use in an Arduino project.<br><a href=\"http:\/\/wiki.seeedstudio.com\/Grove-Gas_Sensor-O2\/\">http:\/\/wiki.seeedstudio.com\/Grove-Gas_Sensor-O2\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wiring Up the O2 Sensor to Arduino<\/h2>\n\n\n\n<p>If you look on the back of the sensor there are only 3 wires used.  VCC, GND, and a SIG.  The NC pin is &#8220;Not Connected&#8221;<\/p>\n\n\n\n<p>Wire the <br>GND -> Arduino ground<br>VCC -> Arduino 3.3V (Looks like it may also accept 5V)<br>SIG -> A5 (Analog 5)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"818\" src=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-1024x818.jpg\" alt=\"\" class=\"wp-image-3265\" srcset=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-1024x818.jpg 1024w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-300x240.jpg 300w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-768x614.jpg 768w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-1536x1227.jpg 1536w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-2048x1636.jpg 2048w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/IMG_20200423_184758-375x300.jpg 375w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Code to read O2 Sensor<\/h2>\n\n\n\n<p>Copy and paste the following code into the Arduino IDE<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"php\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">\/\/ Grove - Gas Sensor(O2) test code\n\/\/ Note:\n\/\/ 1. It need about about 5-10 minutes to preheat the sensor\n\/\/ 2. modify VRefer if needed\n\nconst float VRefer = 3.3;       \/\/ voltage of adc reference\n\nconst int pinAdc   = A5;\n\nvoid setup() \n{\n    \/\/ put your setup code here, to run once:\n    Serial.begin(9600);\n    Serial.println(\"Grove - Gas Sensor Test Code...\");\n}\n\nvoid loop() \n{\n    \/\/ put your main code here, to run repeatedly:\n    float Vout =0;\n    Serial.print(\"Vout =\");\n\n    Vout = readO2Vout();\n    Serial.print(Vout);\n    Serial.print(\" V, Concentration of O2 is \");\n    Serial.println(readConcentration());\n    delay(500);\n}\n\nfloat readO2Vout()\n{\n    long sum = 0;\n    for(int i=0; i&lt;32; i++)\n    {\n        sum += analogRead(pinAdc);\n    }\n    \n    sum >>= 5;\n    \n    float MeasuredVout = sum * (VRefer \/ 1023.0);\n    return MeasuredVout;\n}\n\nfloat readConcentration()\n{\n    \/\/ Vout samples are with reference to 3.3V\n    float MeasuredVout = readO2Vout();\n    \n    \/\/float Concentration = FmultiMap(MeasuredVout, VoutArray,O2ConArray, 6);\n    \/\/when its output voltage is 2.0V,\n    float Concentration = MeasuredVout * 0.21 \/ 2.0;\n    float Concentration_Percentage=Concentration*100;\n    return Concentration_Percentage;\n}\n<\/pre><\/div>\n\n\n\n<p>Upload and Launch the Serial Monitor<br>Tools -&gt; Serial Monitor<br> or<br>Ctrl + Shift + M<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"344\" src=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/image-7.png\" alt=\"\" class=\"wp-image-3266\" srcset=\"https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/image-7.png 805w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/image-7-300x128.png 300w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/image-7-768x328.png 768w, https:\/\/www.incredigeek.com\/home\/wp-content\/uploads\/2020\/04\/image-7-500x214.png 500w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/github.com\/SeeedDocument\/Seeed-WiKi\/blob\/master\/docs\/Grove-Gas_Sensor-O2.md The Seeed Studio O2 sensor is a nice Oxygen sensor. It works up to 25% Oxygen concentration and is easy to use in an Arduino project.http:\/\/wiki.seeedstudio.com\/Grove-Gas_Sensor-O2\/ Wiring Up the O2 Sensor to Arduino If you look on the back &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/using-seeed-studio-o2-sensor-arduino-without-grove-breakout-board\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[717],"tags":[715,986,992,606,991,990],"class_list":["post-3258","post","type-post","status-publish","format-standard","hentry","category-arduino","tag-arduino","tag-grove","tag-o2","tag-programming","tag-seeed","tag-sensor"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=3258"}],"version-history":[{"count":3,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3258\/revisions"}],"predecessor-version":[{"id":3294,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3258\/revisions\/3294"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=3258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=3258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=3258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}