Skip to content

Lightweight python library for interactions with MH-Z16 MH-Z19 Intelligent Infrared Gas Module CO2

License

Notifications You must be signed in to change notification settings

fdobrovolny/mh-zxx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mh-zxx

Lightweight python library for interactions with MH-Z16, MH-Z19 and similar Intelligent Infrared Gas Module CO2

MH-ZXX CO2 Sensor API

CO2Sensor

class CO2Sensor()

MH-Z16 and MH-Z19 CO2 sensor.

__init__

def __init__(port: str, baudrate: int = 9600, timeout: float = 0.2)

Setup CO2 sensor

Arguments:

  • port: The serial port name, for example /dev/ttyUSB0 (Linux), /dev/tty.usbserial (OS X) or COM4 (Windows).
  • baudrate: Baudrate to use.
  • timeout: Read timeout after each command.

read_co2

def read_co2() -> int

Read CO2 concentration.

read_temperature

def read_temperature() -> float

Read temperature.

read_status

def read_status() -> int

Read status.

read

def read() -> Tuple[int, float, int, int]

Read all values.

Returns:

CO2 concentration, temperature, status, co2 auto calibration point

zero_calibration

def zero_calibration()

Zero calibration.

span_calibration

def span_calibration(span: int)

Span calibration.

set_auto_calibration

def set_auto_calibration(state: bool)

Set auto calibration point.

close

def close()

Close serial port.

About

Lightweight python library for interactions with MH-Z16 MH-Z19 Intelligent Infrared Gas Module CO2

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages