Build a CO₂ Monitor Using M5Stack and CO2L Sensor
Introduction

In this project, we will create a real-time CO₂ Air Quality Monitor using an M5Stack Core2 and a CO2L Sensor Unit. This device will display CO₂ levels in ppm, along with temperature and humidity data. It’s ideal for classrooms, bedrooms, offices, and indoor air monitoring.
Objectives
- Flash M5Stack firmware using M5Burner
- Build a CO₂ monitor using UIFlow
- Read CO₂ values from a CO2L sensor
- Display air quality on the screen
- Understand how to interpret CO₂ levels
Hardware and Materials
- M5Stack Core2
-
M5Stack CO2L Unit (CO₂ Sensor)
- Grove Cable
- USB-C Cable
- Laptop (Windows/Mac)
Connections

The CO2L sensor communicates via I2C using the Grove port. The M5Stack board reads the CO₂ concentration in parts per million (ppm) and displays it as numerical values and color-coded air quality levels (Good, Moderate, Poor).
M5Burner Setup
1. Download M5Burner
Go to the official M5Stack downloads page M5Burner. Choose Windows/Mac/Linux version. Extract and run M5Burner

2. Select Your Device
Choose Core2 (or your device: Atom, Stick C Plus2, Core S3, etc.). Select the firmware version.

3. Configure Firmware
Set WiFi SSID & Password (optional auto-connect). Name the device (optional)

4. Burn Firmware
Connect the device via USB-C. Then, Click Burn. Wait until it finishes and reboots

5. Get the API Key
After reboot, check the screen. The device displays its API key. You will use this to connect UIFlow to the device.

UIFlow Project Guide
1. Visit the UIFlow browser editor. Click Setting > Enter your device's API key > Choose your specific Device. Then Click OK.

2. Add the CO2L sensor block. Initialize the sensor. Add display blocks. Add timer or loop blocks for continuous readings.

3. Large text block for CO2. Smaller labels for Temperature and Humidity.

4. begins by resetting the CO2L sensor and starting its periodic measurement so it can continuously read CO₂, temperature, and humidity. Inside the loop, the device repeatedly collects fresh sensor data, displays the CO₂ value on CO2_label, temperature on Temp_label, and humidity on Hum_label, and uses a data-ready check to ensure every reading is new and accurate. The program then changes the screen’s background color based on CO₂ levels—green for good air (<800 ppm), yellow for moderate (<1200 ppm), and red for poor air—to make air quality easy to understand at a glance.

5. Test in UIFlow. Click Run. Device should display real-time data.
Testing the Build
- Breathe near the sensor → ppm should rise
- Place outdoors → should read 400–450 ppm
- Put in an enclosed room → ppm increases over time
Conclusion
You have successfully created a real-time CO₂ Monitoring System using M5Stack and the CO2L sensor. This project teaches I2C communication, UIFlow programming, data visualization, and basic air quality analysis. You can expand it further with IoT logging, alarms, or environmental dashboards.
Downloads
- UIFlow .m5f file
-
Diagram image
Recommended Next Projects
- Temperature + Humidity Dashboard
- Smart Plant Watering System
- PM2.5 Air Quality Monitor
- Home Security Motion Detector
- RTC Digital Clock for StickC Plus2







