NAME

RPi::PIGPIO::Device::MH_Z14 - Read CO2 concentration from a MH-Z14 CO2 module

DESCRIPTION

Use the GPIO serial interface to read the CO2 concentration from a MM-Z14 module

SYNOPSIS

use RPi::PIGPIO;
use RPi::PIGPIO::Device::MH_Z14;

my $pi = RPi::PIGPIO->connect('192.168.1.10');

my $co2_sensor = RPi::PIGPIO::Device::MH-Z14->new($pi,'/dev/ttyAMA0');

$ppm = $co2_sensor->read();

METHODS

new

Create a new object

Usage:

my $led = RPi::PIGPIO::Device::MH_Z14->new($pi,mode => 'serial', tty => '/dev/ttyAMA0');

Arguments: $pi - an instance of RPi::PIGPIO %params - Additional params for the sensor

Currently the params must be:

%params = (mode => 'serial', tty => '<serial port>');

There are aditional modes in with you cand read data from this sensor (pwm and analog output), but this modes are not implemnted yet.

read

Read the CO2 concentration (in ppm - parts per milion)

Usage :

my $ppm = $sensor->read();