The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

RPi::PIGPIO::Device::DSM501A - Read dust particle concentraction from a DSM501A sensor

DESCRIPTION

Uses the pigpiod to read dust particle concentraction from a DSM501A sensor

Sampling time is 30 seconds.

Sensor specs can be found here : http://www.samyoungsnc.com/products/3-1%20Specification%20DSM501.pdf

Acceptable room air concentration for particles ≥1 µm is 8,320,000 / cubic meter. More info on dust levels for different environments here : https://en.wikipedia.org/wiki/Cleanroom#ISO_14644-1_and_ISO_14698

SYNOPSIS

    use RPi::PIGPIO;
    use RPi::PIGPIO::Device::DSM501A;

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

    my $dust_sensor = RPi::PIGPIO::Device::DSM501A->new($pi,4);

    my ($ratio, $mg_per_m3, $pcs_per_m3, $pcs_per_ft3) = $dust_sensor->sample(); # Sample the air for 30 seconds and report

NOTES

Please be aware that c<sample()> method will block until the sample time expires (30 sec).

METHODS

new

Create a new object

Usage:

    my $dust_sensor = RPi::PIGPIO::Device::DSM501A->new($pi,$gpio);

Arguments:

  • $pi - an instance of RPi::PIGPIO

  • $gpio - GPIO number to which the sensor is connected

sample

Sample the sensor for the given time and return the measured average concentration

Arguments:

  • $sample_time - time in seconds for which to sample the device

Returns an array containign:

1 $ratio - ratio of the time the signal was low
2 $mg_per_m3 - mg of particles / cubic meter
3 $pcs_per_m3 - pcs of particles / cubic meter
4 $pcs_per_ft3 - pcs of particles / cubic ft