Skip to content
nocona71Public

About

A project for monitoring CO2 levels, temperature, humidity, and pressure using the SCD30 and BMP280 sensors.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Generate Doxygen Documentation

CO2 Meter

picture CO2 Meter

A project for monitoring CO2 levels, temperature, humidity, and pressure using the SCD30 and BMP280 sensors. The data is displayed on an OLED screen and logged for debugging and monitoring purposes.


Features

  • CO2 Monitoring: Measures CO2 levels using the SCD30 sensor.
  • Environmental Data: Reads temperature, humidity, and pressure from the SCD30 and BMP280 sensors.
  • OLED Display: Displays sensor readings and warnings on an SSD1306 OLED screen.
  • Logging: Logs sensor data and system messages using the Logger class.
  • Calibration: Automatically calibrates the SCD30 sensor and stores the calibration flag in EEPROM.
  • I2C Scanner: Scans the I2C bus for connected devices.

Software Installation

Tools and Libraries

  • PlatformIO for building and deploying the firmware.
  • make for running the build and deployment tasks.
  • Required libraries (automatically installed via platformio.ini):
    • Adafruit GFX Library
    • Adafruit SSD1306
    • SparkFun SCD30 Arduino Library
    • Adafruit BMP280 Library

Installation

  1. Clone this repository to your local machine:
git clone https://github.com/your-username/CO2-Meter.git
cd CO2-Meter
  1. Install PlatformIO if you haven’t already:
    • Install the PlatformIO extension in Visual Studio Code.
    • Alternatively, install it via the command line:
pip install platformio
  1. Install make:
    • Windows:
      • Install Git for Windows to get Git Bash, which includes the make command.
      • Alternatively, install make via MinGW:
        1. Download and install MinGW.
        2. During installation, select the mingw32-make package.
        3. Add the MinGW bin directory (e.g., C:\MinGW\bin) to your system's PATH environment variable.
    • Linux/Mac:
      • Use your package manager:
sudo apt install make        # For Debian/Ubuntu
brew install make            # For macOS
  1. Open the project in Visual Studio Code:
    code CO2-Meter

Hardware Installation

Requirements

  • Hardware:
    • ESP8266-based board (e.g., ESP-12E or NodeMCU).
    • SCD30 CO2 sensor.
    • BMP280 pressure sensor.
    • SSD1306 OLED display.
    • colored wires for connecting the microcontroller sensors, display and power source.
    • 5V power source
    • 2 tiny bread boards

Wiring Diagram

The following diagram shows the connections between the ESP8266, SCD30, BMP280, and SSD1306 OLED display:

Wireing of the circuit on 2 tiny bread boards


Building

  1. Open the project directory in a terminal:

    • Windows: Use Git Bash or a terminal where make is available.
    • Linux/Mac: Use your default terminal.
  2. Build the project using the Makefile:

make build

Deployment

  1. Connect your ESP8266 board to your computer via USB.
  2. Upload the firmware to the board:
make upload
  1. Open the serial monitor to verify the output:
make monitor

Configuration

The project uses a centralized configuration file (config.h) to define constants and settings. You can modify the following parameters to suit your needs:

Key Configuration Options

EEPROM Settings:

#define EEPROM_CALIBRATION_FLAG_ADDRESS 0x10
#define CALIBRATION_DONE 1

CO2 Thresholds:

#define CO2_MODERATE_THRESHOLD 1000.0 // ppm
#define CO2_CRITICAL_THRESHOLD 2000.0 // ppm

Default Sensor Readings:

#define DEFAULT_CO2 400.0f
#define DEFAULT_TEMP_SCD 20.0f
#define DEFAULT_HUMIDITY 50.0f

Display Settings:

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C

Modifying Configuration

  1. Open the config.h file in the include directory.
  2. Update the constants as needed.
  3. Rebuild and upload the firmware to apply the changes:
make build
make upload

Using Additional Makefile Targets

The Makefile includes additional targets for specific tasks:

Run the I2C Scanner:

make i2c-scan

Run the Display Check:

make display-check

Clean the Build Files:

make clean

Show Help:

make help

Windows-Specific Notes

  • Use Git Bash or a terminal where make is available to run the commands.
  • Ensure that the make command is in your system's PATH. If you installed make via MinGW, add the C:\MinGW\bin directory to your PATH:
    1. Open the Start menu and search for "Environment Variables."
    2. Click "Edit the system environment variables."
    3. In the "System Properties" window, click "Environment Variables."
    4. Under "System variables," find the Path variable and click "Edit."
    5. Add the path to the MinGW bin directory (e.g., C:\MinGW\bin).
    6. Click "OK" to save and close all windows.

License

This project is licensed under the MIT License.


Contributing

Contributions are welcome! Feel free to submit issues or pull requests to improve the project.


Contact

For questions or support, please use the issue tracker.

About

A project for monitoring CO2 levels, temperature, humidity, and pressure using the SCD30 and BMP280 sensors.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages