CO2 Sensor
About this section, we are showing how to use the CO2 sensor in Arduino.
Motivation
We want to detect if the CO2 concentration at the outlet is decreasing as expected.
Experiments
- Experiment 1: Instrument calibration
- Purpose
- Because the analog value returned by each sensor may be inaccurate, and the carbon dioxide concentration in each area may be slightly different, it must be corrected before use.
- Method
- Connect the power supply to 3.3V and use arduino to measure the analog value of output A0. Its stable value is about 3.3/5*1024=675.84.
- Let the sensor enter a steady state and operate in an unventilated environment for at least 48 hours.
- At this time, the analog value of the atmospheric carbon dioxide concentration (about 400 ppm) was measured, and we measured 705 ppm.
- The known carbon dioxide concentration is adjusted by a CO2 incubator, and the ppm can be obtained according to the formula conversion, and the analog value of the concentration is obtained. Ex: We put the carbon dioxide sensor into 5% carbon dioxide and measured its analog value to 530 ppm.
- We assume that the carbon dioxide logarithmic concentration is negatively linearly related to the output analog value, and can be found by the known two points.
- Formula
- X% = 10000X ppm Ex: 5% CO2 concentration = 50000 ppm
- Let we assume the unknown CO2 concentration is C ppm.
- From the graph, we have shown that V50000 = 530 、V400 = 705
- Therefore, we can get the slope value.
- After shifting the equation we will get
- We can then get the unknown CO2 concentration from this formula.
- Picture
- We put CO2 sensor into the CO2 incubator and measure its analog value.
- Experiment 2: CO2 trend line verification
- Purpose
- To verify whether the logarithmic concentration of carbon dioxide is negatively linear with the output analog value.
- Method
- Use a CO2 incubator to adjust the known carbon dioxide concentration and measure its analogy to see if it is on this line.
- Result
- We put our sensor in the environment of CO2 2.7%, and we measured that the analog value 550, which is quite match with the theoretical analog value 552.
- Precaution
- It is best to preheat for the first time for 24 hours, use it for more than six hours, preheat for 1-2 hours, power off for more than 72 hours, and preheat for 24 hours.
- Materials used
- Arduino UNO
- MG811 CO2 Sensor
- Heating power supply: 7.5-12V
- Operating Temperature: -20 – 50 °C
- Measuring range: 400-10000ppm CO2
- Float flowmeter or CO2 incubator
- Arduino code
$$slope={V_{50000}-V_{400}\over log50000-log400}={V-V_{400}\over logC-log400}$$
$${logC-log400}={V-V_{400}\over slope}$$ $$C={10^{log400+{V-V_{400}\over slope}}}$$
Wiring
Reference
- Tiequan Shao.Peng Wei.(2016)Arduino 二氧化碳感測器MG811 校正計算.Retrieved from http://a-chien.blogspot.com/2016/03/arduino-mg811.html