RPi::PIGPIO::Device::DSM501A - Read dust particle concentraction from a DSM501A sensor
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
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
Please be aware that c<sample()> method will block until the sample time expires (30 sec).
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 the sensor for the given time and return the measured average concentration
$sample_time - time in seconds for which to sample the device
Returns an array containign:
To install RPi::PIGPIO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPi::PIGPIO
CPAN shell
perl -MCPAN -e shell install RPi::PIGPIO
For more information on module installation, please visit the detailed CPAN module installation guide.