This project uses an MG811 CO2 sensor with Arduino to measure and display CO2 concentration levels. The sensor can detect CO2 concentrations between 400ppm (fresh air) to 10000ppm.
- Arduino board (Uno, Nano, or similar)
- MG811 CO2 sensor module
- Jumper wires
- Power supply (6V) for the sensor
- Voltage regulator (to provide 6V to sensor)
-
For the Sensor (One of these options):
- Option 1: Dedicated 6V DC power adapter
- Option 2: 9V battery with 6V voltage regulator
- Option 3: 7-12V power supply with 6V voltage regulator
-
For the Arduino (Separate from sensor power):
- USB connection
- OR dedicated power supply (7-12V)
Important: Do NOT attempt to power the MG811 sensor through Arduino's power pins. The sensor's heater requires its own power source to function properly and avoid overloading the Arduino's voltage regulator.
Connect the MG811 sensor to Arduino as follows:
MG811 Pin | Connection |
---|---|
VCC | 6V power supply |
GND | GND (common ground with Arduino AND 6V power supply) |
AOUT | A0 (Arduino) |
Important: The MG811 sensor requires 6V for the heater to work properly. Do NOT connect it directly to Arduino's 5V pin. Use a separate 6V power supply or a voltage regulator to power the sensor. Make sure to connect ALL grounds together (Arduino, sensor, and 6V power supply) to establish a common reference point.
- Install the Arduino IDE
- Download the project files
- Open
CO2_Sensor.ino
in Arduino IDE - Upload the code to your Arduino board
Connect the MG811 sensor module as follows:
- Sensor VCC → 6V power supply positive terminal
- Sensor GND → Common ground (connect ALL grounds together: Arduino GND, sensor GND, and 6V power supply GND)
- Sensor AOUT → Arduino A0 pin
Note: It is essential that all grounds (Arduino, sensor, and power supply) are connected together. Without a common ground, the analog readings will be incorrect or unstable.
The sensor requires calibration for accurate readings. Current calibration values in the code:
- Zero point voltage: 0.220V (at 400ppm CO2)
- Reaction voltage: 0.020V (per 100ppm change)
You may need to adjust these values based on your specific sensor:
- Power up the Arduino and sensor
- Wait for the 3-second warm-up period
- Open Serial Monitor (Tools > Serial Monitor) at 9600 baud
- Readings will display every 5 seconds showing:
- Voltage reading
- CO2 concentration in PPM
- The sensor needs about 48 hours for first-time preparation
- Requires 3-5 minutes warm-up time for each power-up
- Keep the sensor in stable temperature and humidity conditions
- Avoid exposing the sensor to high concentrations of:
- Alcohol
- Toluene
- Hydrogen
- Carbon Monoxide
-
No readings:
- Check power connections
- Verify analog pin connection
- Ensure correct serial monitor baud rate (9600)
-
Inaccurate readings:
- Allow proper warm-up time
- Check calibration values
- Ensure stable power supply
- Avoid interference from other gases
This project is open-source and available under the MIT License.
Feel free to submit issues and enhancement requests!