Skip to content

CALIBRATION & detection range

Dr. Takeyuki Ueda edited this page Jun 1, 2021 · 12 revisions

Untested functions

I'm afraid following functions are not tested due to lack of necessary devices and apparatus for test. I'll really appreciate if some kindly person who has necessary stuffs try following functions and tell me the result as a issue report, thank you!

Usage as command

Both Python2 & Python3 are supported.

pi@raspberrypi:~ $ python -m mh_z19 -h
usage: __main__.py [-h] [--serial_device SERIAL_DEVICE]
                   [--serial_console_untouched]
                   [--version | --all | --abc_on | --abc_off]
                   [--span_point_calibration span] [--zero_point_calibration]
                   [--detection_range_10000] [--detection_range_5000]
                   [--detection_range_2000] [--pwm] [--pwm_range range]
                   [--pwm_gpio gpioBCM]

return CO2 concentration as object as {'co2': 416}

optional arguments:
  -h, --help            show this help message and exit
  --serial_device SERIAL_DEVICE
                        Use this serial device file
  --serial_console_untouched
                        Don't close/reopen serial console before/after sensor
                        reading
  --version             show version
  --all                 return all (co2, temperature, TT, SS and UhUl) as json
  --abc_on              Set ABC functionality on model B as ON.
  --abc_off             Set ABC functionality on model B as OFF.
  --span_point_calibration span
                        Call calibration function with SPAN point
  --zero_point_calibration
                        Call calibration function with ZERO point
  --detection_range_10000
                        Set detection range as 10000
  --detection_range_5000
                        Set detection range as 5000
  --detection_range_2000
                        Set detection range as 2000
  --pwm                 Read CO2 concentration from PWM, see also
                        `--pwm_range` and/or `--pwm_gpio`
  --pwm_range range     with --pwm, use this to compute co2 concentration,
                        default is 5000
  --pwm_gpio gpio(BCM)  with --pwm, read from this gpio pin on RPi, default is
                        12

Without option, mh_z19 measure CO2 concentration and return as JSON string. When one of the above options are specified, measurement doesn't take place, instead just take place a setting about calibration or range acordingly. Just one option is abailable, it will be failed if multi option is set.

Use as python module.

Refer CALIBRATION & detection range of module wiki.