UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

HKA5 Class

Module: hka5

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
)
Number

HKA5 object constructor

Parameters:

  • uart Number

    Specify which uart to use.

  • set_pin Number

    Specify the GPIO pin to use for Set. -1 to not use a set pin.

  • reset_pin Number

    Specify the GPIO pin to use for Reset. -1 to not use a reset pin.

Returns:

Number:

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 Boolean

    true 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:

Number:

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:

Number:

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:

Number:

The value in ug/m3