/arduino-mhz19

๐Ÿ’ฅ Arduino library for Winsen MH-Z19 โ€“ infrared carbon dioxide sensor. The library allows using the sensor over hardware or software UART on any board that supports Arduino.

Primary LanguageC++MIT LicenseMIT

๐Ÿ’ฅ Arduino library for Winsen MH-Z19

The library allows using the sensor over hardware or software UART on any board that supports Arduino.

License Husky Commitizen semantic-release Style Guide clang-format markdownlint commitlint Tested on Arduino Uno Tested on Arduino Nano Tested on NodeMCU Tested on Wemos D1 Code Coverage CI Workflow Release Workflow

๐ŸŽ‰ Features

โœจ Getting Started

๐Ÿ“ฆ Installation

๐Ÿ‘‰ PlatformIO

Run pio lib install "malokhvii-eduard/arduino-mhz19" or declare in platformio.ini configuration file using lib_deps option. Enjoy! ๐ŸŽ‰๐Ÿ‘

๐Ÿ‘‰ Arduino IDE (Library Manager)

Go to the Arduino IDE and click Tools > Manage Libraries. In the library manager dialogue that opens, enter search query Mhz19. Afterward, find a library Mhz19 by Eduard Malokhvii and click Install. Enjoy! ๐ŸŽ‰๐Ÿ‘

๐Ÿ‘‰ Arduino IDE (Manual)

Download Mhz19.zip from release assets. Once downloaded, go to the Arduino IDE and click Sketch > Include Library > Add .zip Library. In the file dialogue that opens, locate your downloaded ZIP file. Afterward, you should receive a Library Added message just above the debug window. Enjoy! ๐ŸŽ‰๐Ÿ‘

๐Ÿ‘€ Usage

There is only one example, but comprehensive, to demonstrate usage of the library. See Basic.ino to see how to read carbon dioxide over software UART.

โ“ FAQs

๐Ÿ™‹โ€โ™‚๏ธ In which units carbon dioxide is measured?

๐Ÿ‘‰ The carbon dioxide is measured in parts-per-million (symbol: ppm).

๐Ÿ™‹โ€โ™‚๏ธ How to set a measuring range?

๐Ÿ‘‰ You can set a measuring range by call of Mhz19::setMeasuringRange(). The measuring ranges are listed below:

  • Mhz19MeasuringRange::Ppm_1000
  • Mhz19MeasuringRange::Ppm_2000
  • Mhz19MeasuringRange::Ppm_3000
  • Mhz19MeasuringRange::Ppm_5000

๐Ÿ™‹โ€โ™‚๏ธ What is automatic baseline correction?

๐Ÿ‘‰ Sensor itself do zero point judgment and automatic calibration procedure intelligently after a continuous operation period. The automatic calibration cycle is every 24 hours after powered on. The zero point of automatic calibration is 400ppm. The default setting is with built-in automatic calibration function if no special request. This function is usually suitable for indoor air quality monitor such as offices, schools and homes, not suitable for greenhouse, farm and refrigeratory where this function should be off.

๐Ÿ™‹โ€โ™‚๏ธ How does it work?

๐Ÿ‘‰ You can explore unit tests to see the behavior of all library members.

๐Ÿ› ๏ธ Tech Stack

EditorConfig Markdown C++ PlatformIO Arduino Google Test gcovr npm clang-format Prettier markdownlint commitlint semantic-release MH-Z19 Shields.io Git GitHub GitHub Actions

โœ๏ธ Contributing

๐Ÿ‘๐ŸŽ‰ First off, thanks for taking the time to contribute! ๐ŸŽ‰๐Ÿ‘

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/awesome-feature)
  3. Commit your Changes (git commit -m 'Add awesome feature')
  4. Push to the Branch (git push origin feature/awesome-feature)
  5. Open a Pull Request

๐Ÿ’– Like this project?

Leave a โญ if you think this project is cool or useful for you.

โš ๏ธ License

arduino-mhz19 is licenced under the MIT License. See the LICENSE for more information.