element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Vertical Farming
  • Challenges & Projects
  • Design Challenges
  • Vertical Farming
  • More
  • Cancel
Vertical Farming
Blog Automated Green House Blog:14 - CO2: Measurement
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: m.ratcliffe
  • Date Created: 2 Nov 2015 5:31 PM Date Created
  • Views 969 views
  • Likes 4 likes
  • Comments 2 comments
  • adapted_greenhouse
  • CO2
  • arduino
Related
Recommended

Automated Green House Blog:14 - CO2: Measurement

m.ratcliffe
m.ratcliffe
2 Nov 2015

It has been a busy week with Halloween and some unforeseen breakdowns on the farm. we will be catching up on a slow week today.

 

CO2 is an important factor in plant growth, in some instances sealed grow rooms run at a artificiality elevated CO2 concentration. We wont be doing this in the greenhouse but it would be nice to have a fully defined set of growing conditions for comparing experiments.

 

DfRobot have been kind enough to send me out a PH sensor and CO2 sensor to keep the project moving along quickly, so we will be using the parts from them:

 

CO2 Sensor (Arduino compatible)

[You can most likely source the parts from elsewhere]

 

I will wire the sensor up and talk about how it performs in the next blog on CO2, I think we need to find a cheap way to calibrate the sensors as not everyone is going to have access to CO2 calibration gases [I certainly dont]. Looking at the spec sheet[for the MG811] it might not need calibration, a real life test will be needed to confirm this.

 

Wiring diagram:

image

 

 

Header 1

/*

   CO2 Sensor Gas:

 

This script allows you to use a analog c02 gas sensor [like the one in the link below]:

 

 

http://www.dfrobot.com/index.php?route=product/product&product_id=1023&search=co2&description=true#.VjeKyXzhDVM

 

 

 

 

Procedure:

>warm sensor up and take a reading of two known c02 solutions  [note down ADC readout and c02 ppm]

>plug the numbers into the top of the code [Lines 28-31]

>see if it works with a amonia solution between the min and max you calibrated with.

 

 

 

 

other info:

>Burn Sensor in for a hour or so before stable readings will be had

>Sensor needs time to warm up after being powered up

 

 

 

 

 

 

 

   25/10/2015  Michael   Ratcliffe

   

   

          This program is free software: you can redistribute it and/or modify

    it under the terms of the GNU General Public License as published by

    the Free Software Foundation, either version 3 of the License, or

    (at your option) any later version.

 

 

    This program is distributed in the hope that it will be useful,

    but WITHOUT ANY WARRANTY; without even the implied warranty of

    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

    GNU General Public License for more details.

 

 

    You should have received a copy of the GNU General Public License

    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 

Sensors and useful info:

>Gas Sensor needs burning in before first use

>

 

 

*/

 

 

int GasPin=A0;

float CO2MinADC=0;

float CO2MaxADC=0;

float CO2MinPPM=0;

float CO2MaxPPM=0;

 

 

//We will proberbly have to correct for temperature in the long run [not used yet]

float Temperature=0;

float Temp_Coef=0;

float Offset=0;

 

 

//[Im guessing it will be liner with a offset]

 

 

int i=0;

int SensorBuffer=0;

float CO2PPM=0;

float Gas_Readout=0; //Float incase we attempt to change ADC to PPM

// ************************ Setup Routine ********************************//

void setup() {

 

 

  Serial.begin(9600);// turn serial coms on for sending data to pc

  Setup_Info();

 

}

 

 

//************************** Main Loop ***********************************//

//************************************************************************//

void loop() {

      //Taking ten readings and averaging for accuracy

      i=1;

      SensorBuffer=0;

      while(i<=10){

      Gas_Readout= analogRead(GasPin);

      SensorBuffer=SensorBuffer+Gas_Readout;

      delay(50);

      i++;

      };

      Gas_Readout=SensorBuffer/i;  // cheack that my maths is correct her, I usssualy *** up this bit by one iteration

    

Map_Results();

Print_Results();

 

 

 

 

}

 

 

//*************** Printing dome useful info to seerial on boot up *********//

void Setup_Info(){

Serial.println("This script is a proof of concept that we can get useful representation of amonia in water by measuring its gas off");

Serial.println("Gas Sensor needs burning in before first use [30 mins minimum]");

Serial.println("Calibrate, take ADC read out at MAX CO2 and Min and put them in the top od code");

 

 

 

}

 

 

 

 

 

 

//****************Maps Results after we have Calibration values************//

void Map_Results(){

 

 

// Map only gives integers, we will need to modify to get better readings  [thats what all the *100 are about

CO2PPM = map(Gas_Readout*100, CO2MinADC*100, CO2MaxADC*100, CO2MinPPM*100, CO2MaxPPM*100);

CO2PPM=CO2PPM/100;

 

}

 

 

//********************Print something useful to Serial here****************//

void Print_Results(){

Serial.println("NEW RESULTS ");

Serial.print("ADC Gas Sensor: ");

Serial.println(Gas_Readout);

Serial.print("Amonia PPM: ");

Serial.println(CO2PPM);

 

};

 

 

 

 

Check out the home page for updates:

 

Automated Green House Blog's Home Page

  • Sign in to reply
  • m.ratcliffe
    m.ratcliffe over 9 years ago in reply to DAB

    Hey Dab, I haven't got the sensor to test with yet, so cant say about the sensitivity until a later date.

    But I plan on logging the data from every sensor in the greenhouse for the whole main grow[still deciding if it should be local or web based]. The grow room is around 36m^3 with good air movement, so it has a lot air mass to make readings less noisy [I hope].

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 9 years ago

    Nice update.

     

    Are you going to show some of the data you collect?

     

    I am curious on how sensitive the sensor is given your small growing space.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube