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 analogy value of the atmospheric carbon dioxide concentration (about 400 ppm) was measured, and we measured 705.
- The known carbon dioxide concentration is adjusted by a float flowmeter, and the ppm can be obtained according to the formula conversion, and the analogy value of the concentration is obtained. Ex: We put the carbon dioxide sensor into 100% carbon dioxide and measured its analogy value to 260.
- 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 V1000000 = 260 、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.
- 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 float flowmeter to call up the known carbon dioxide concentration and measure its analogy to see if it is on this line.
- Result
- 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
- a register of 4700 ohms
- Arduino code
$$slope={V_{1000000}-V_{400}\over log10^6-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