Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use MG811: Examples, Pinouts, and Specs

Image of MG811
Cirkit Designer LogoDesign with MG811 in Cirkit Designer

Introduction

The MG811 is a carbon dioxide (CO2) sensor manufactured by Arduino with the part ID CO2. It utilizes non-dispersive infrared (NDIR) technology to detect CO2 levels in the air. The sensor outputs an analog voltage that is proportional to the concentration of CO2, making it ideal for applications requiring accurate and reliable CO2 measurements.

Explore Projects Built with MG811

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
WiFi-Controlled Basket-Carrying Robot with GPS and GSM Notification
Image of trash collecting vessel: A project utilizing MG811 in a practical application
This circuit is designed for a 4-wheeled WiFi-controlled car with a basket, which uses an ESP8266 NodeMCU microcontroller for logic control. It features an IR sensor for basket full detection, a GPS module for location tracking, and a GSM module (Sim800l) for sending SMS notifications. The L298N motor driver controls four DC gearmotors for movement, and the system is powered by a Li-ion battery with a 7805 voltage regulator providing stable power to the GSM module.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Remote-Controlled Servo System with GPS and IMU Integration
Image of RC Plane: A project utilizing MG811 in a practical application
This circuit integrates an ESP32 microcontroller with an AR610 receiver, an MPU-6050 accelerometer, a Neo 6M GPS module, and multiple servos. The ESP32 processes input signals from the AR610 receiver and MPU-6050, while controlling the servos and receiving GPS data for navigation or control purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Accident Detection and GPS Tracking System with GSM Notifications
Image of hello: A project utilizing MG811 in a practical application
This circuit features an ESP32 microcontroller interfaced with an MPU6050 accelerometer/gyroscope, a Neo 6M GPS module, and a SIM800L GSM module. The ESP32 communicates with the MPU6050 via I2C (SCL and SDA lines) to detect potential accidents based on acceleration thresholds, with the GPS module providing location data via a serial connection (RX0 and TX0). The SIM800L GSM module is connected to the ESP32 through another serial interface (RX2 and TX2) to send SMS alerts with location information in case of an accident detection.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP8266 and SIM800L Based GPS Tracker with I2C LCD Display and Battery Power
Image of Little Innovator Competition: A project utilizing MG811 in a practical application
This circuit integrates an ESP8266 NodeMCU microcontroller with a SIM800L GSM module, a GPS NEO 6M module, and a 16x2 I2C LCD display for communication and location tracking. It also includes a pushbutton for user input, a piezo buzzer for audio alerts, and is powered by a 2x 18650 battery pack through an LM2596 step-down module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MG811

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of trash collecting vessel: A project utilizing MG811 in a practical application
WiFi-Controlled Basket-Carrying Robot with GPS and GSM Notification
This circuit is designed for a 4-wheeled WiFi-controlled car with a basket, which uses an ESP8266 NodeMCU microcontroller for logic control. It features an IR sensor for basket full detection, a GPS module for location tracking, and a GSM module (Sim800l) for sending SMS notifications. The L298N motor driver controls four DC gearmotors for movement, and the system is powered by a Li-ion battery with a 7805 voltage regulator providing stable power to the GSM module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of RC Plane: A project utilizing MG811 in a practical application
ESP32-Based Remote-Controlled Servo System with GPS and IMU Integration
This circuit integrates an ESP32 microcontroller with an AR610 receiver, an MPU-6050 accelerometer, a Neo 6M GPS module, and multiple servos. The ESP32 processes input signals from the AR610 receiver and MPU-6050, while controlling the servos and receiving GPS data for navigation or control purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of hello: A project utilizing MG811 in a practical application
ESP32-Based Accident Detection and GPS Tracking System with GSM Notifications
This circuit features an ESP32 microcontroller interfaced with an MPU6050 accelerometer/gyroscope, a Neo 6M GPS module, and a SIM800L GSM module. The ESP32 communicates with the MPU6050 via I2C (SCL and SDA lines) to detect potential accidents based on acceleration thresholds, with the GPS module providing location data via a serial connection (RX0 and TX0). The SIM800L GSM module is connected to the ESP32 through another serial interface (RX2 and TX2) to send SMS alerts with location information in case of an accident detection.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Little Innovator Competition: A project utilizing MG811 in a practical application
ESP8266 and SIM800L Based GPS Tracker with I2C LCD Display and Battery Power
This circuit integrates an ESP8266 NodeMCU microcontroller with a SIM800L GSM module, a GPS NEO 6M module, and a 16x2 I2C LCD display for communication and location tracking. It also includes a pushbutton for user input, a piezo buzzer for audio alerts, and is powered by a 2x 18650 battery pack through an LM2596 step-down module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Environmental monitoring systems
  • HVAC (Heating, Ventilation, and Air Conditioning) systems
  • Indoor air quality assessment
  • Greenhouse CO2 monitoring
  • Industrial safety and control systems

Technical Specifications

The MG811 sensor is designed to provide high sensitivity and stability for CO2 detection. Below are its key technical details:

Parameter Value
Operating Voltage 6V DC
Output Signal Analog voltage (proportional to CO2 concentration)
CO2 Detection Range 350 ppm to 10,000 ppm
Preheating Time 24 hours (recommended for stable readings)
Operating Temperature -20°C to 50°C
Operating Humidity 0% to 95% RH (non-condensing)
Power Consumption ~200 mA
Sensor Type NDIR (Non-Dispersive Infrared)

Pin Configuration

The MG811 sensor module typically comes with a 4-pin interface. Below is the pin configuration:

Pin Name Description
1 VCC Power supply input (6V DC)
2 GND Ground connection
3 AOUT Analog output voltage (proportional to CO2 level)
4 DOUT Digital output (high/low signal based on threshold)

Usage Instructions

Connecting the MG811 to a Circuit

  1. Power Supply: Connect the VCC pin to a 6V DC power source and the GND pin to ground.
  2. Analog Output: Connect the AOUT pin to an analog input pin of your microcontroller (e.g., Arduino UNO) to read the CO2 concentration as an analog voltage.
  3. Digital Output: Optionally, connect the DOUT pin to a digital input pin of your microcontroller to detect whether the CO2 level exceeds a preset threshold.

Important Considerations

  • Preheating: The MG811 sensor requires a preheating time of approximately 24 hours for optimal performance. During this time, the sensor stabilizes and provides accurate readings.
  • Calibration: For precise measurements, calibrate the sensor in a known CO2 concentration environment.
  • Power Supply: Ensure a stable 6V DC power supply to avoid fluctuations in the output signal.
  • Ventilation: Place the sensor in a well-ventilated area to avoid accumulation of gases that could affect readings.

Example Code for Arduino UNO

Below is an example of how to interface the MG811 sensor with an Arduino UNO to read the analog output and display the CO2 concentration:

// Define the analog pin connected to the MG811 AOUT pin
const int analogPin = A0;

// Variable to store the analog reading
int sensorValue = 0;

void setup() {
  // Initialize serial communication for debugging
  Serial.begin(9600);
  Serial.println("MG811 CO2 Sensor Test");
}

void loop() {
  // Read the analog value from the sensor
  sensorValue = analogRead(analogPin);

  // Convert the analog value to a voltage (assuming 5V reference)
  float voltage = sensorValue * (5.0 / 1023.0);

  // Display the raw sensor value and voltage
  Serial.print("Raw Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");

  // Add your calibration formula here to convert voltage to CO2 concentration
  // Example: float co2Concentration = (voltage - offset) * scaleFactor;

  delay(1000); // Wait for 1 second before the next reading
}

Notes on Calibration

  • The output voltage of the MG811 sensor is proportional to the CO2 concentration. To convert the voltage to a CO2 concentration in ppm, you will need to determine the sensor's offset and scale factor through calibration.
  • Use a known CO2 concentration environment (e.g., 400 ppm for outdoor air) to calculate the offset and scale factor.

Troubleshooting and FAQs

Common Issues

  1. No Output Signal

    • Cause: Incorrect wiring or insufficient power supply.
    • Solution: Verify the connections and ensure a stable 6V DC power source.
  2. Unstable Readings

    • Cause: Insufficient preheating time or environmental interference.
    • Solution: Allow the sensor to preheat for at least 24 hours and ensure proper ventilation.
  3. Inaccurate CO2 Measurements

    • Cause: Lack of calibration or incorrect reference voltage.
    • Solution: Calibrate the sensor in a known CO2 concentration environment and verify the reference voltage.
  4. High Power Consumption

    • Cause: The MG811 sensor's internal heating element.
    • Solution: Ensure your power supply can handle the sensor's ~200 mA current draw.

FAQs

Q: Can the MG811 sensor detect gases other than CO2?
A: No, the MG811 is specifically designed for CO2 detection using NDIR technology. It is not suitable for detecting other gases.

Q: How long does the MG811 sensor last?
A: The sensor has a long lifespan if used under recommended conditions. However, periodic calibration is necessary to maintain accuracy.

Q: Can I use the MG811 with a 5V power supply?
A: No, the MG811 requires a 6V DC power supply for proper operation. Using a lower voltage may result in inaccurate readings or sensor malfunction.

Q: Is the MG811 suitable for outdoor use?
A: The MG811 can be used outdoors, but it must be protected from extreme weather conditions and condensation to ensure reliable performance.