HKA5 Class
- ID: hka5
- Name: Laser Particulate Matter (PM) Sensor
- Category: gaseous
- Manufacturer: dfrobot
- Connection: uart gpio
- Link: https://www.dfrobot.com/wiki/index.php/DFRobot_LM35_Linear_Temperature_Sensor_(SKU:DFR0023)
This driver was tested with a DFRobot Laser PM2.5 Sensor. It connects to a UART at 9600 baud. This is the only baud rate supported. It optionally supports Reset and Set/Sleep gpios as well.
Methods
HKA5
-
uart
-
set_pin
-
reset_pin
HKA5 object constructor
Parameters:
-
uart
NumberSpecify which uart to use.
-
set_pin
NumberSpecify the GPIO pin to use for Set. -1 to not use a set pin.
-
reset_pin
NumberSpecify the GPIO pin to use for Reset. -1 to not use a reset pin.
Returns:
an initialized device context on success, NULL on error.
enable
-
enable
Enable or disable the device. When disabled, the device enters a low power mode and does not emit data. You must have initialized and connected the Set pin for this function to work.
Parameters:
-
enable
Booleantrue to enable the device, false otherwise.
reset
()
Reset the device. You must have initialized and connected the Reset pin for this function to work.
update
()
Query the device and store the latest values. You must call this function before calling any of the get*() functions.
getPM1
()
Number
Return the last read PM 1.0 value. The value is in micrograms per cubic meter (ug/m3). You must have called the update() function before calling this function.
Returns:
The value in ug/m3
getPM2_5
()
Number
Return the last read PM 2.5 value. The value is in micrograms per cubic meter (ug/m3). You must have called the update() function before calling this function.
Returns:
The value in ug/m3
getPM10
()
Number
Return the last read PM 10.0 value. The value is in micrograms per cubic meter (ug/m3). You must have called the update() function before calling this function.
Returns:
The value in ug/m3