HM330X Laser Particulate Matter Sensor

Driver for HM330X particle matter sensor. More...

Detailed Description

Driver for HM330X particle matter sensor.


This driver provides an interface for the HM-330/3600 laser dust sensor. The datasheet can be found here

The device also support an UART mode, but the currently available breakout from seedstudio only supports I2C.


file  hm330x_constants.h
 Internal addresses, registers and constants.
file  hm330x_params.h
 Default configuration.
file  hm330x.h

Data Structures

struct  hm330x_data_t
 Set of measured particulate matter values as sent by the device. More...
struct  hm330x_params_t
 Device initialization parameters. More...
struct  hm330x_t
 Device descriptor for the driver. More...


 HM330X deployment setting. More...


int hm330x_init (hm330x_t *dev, const hm330x_params_t *params)
 Initialize the given device. More...
int hm330x_read (hm330x_t *dev, hm330x_data_t *data)
 Read particle matter measurements. More...
void hm330x_reset (hm330x_t *dev)
 Reset the sensor. More...
void hm330x_sleep (hm330x_t *dev)
 Set Device to Sleep. More...
void hm330x_wakeup (hm330x_t *dev)
 Wakeup Device. More...

Macro Definition Documentation



HM330X deployment setting.

The HM330X sensor outputs two set of PM* values, one calibrated for indoor environment and another one for atmospheric environment, set this value according to your deployment.

Definition at line 52 of file hm330x.h.

Function Documentation

◆ hm330x_init()

int hm330x_init ( hm330x_t dev,
const hm330x_params_t params 

Initialize the given device.

[in,out]devDevice descriptor of the driver
[in]paramsInitialization parameters
Return values
-EIOFailed to initialize GPIO pins
-EPROTOSensor did not acknowledge command

◆ hm330x_read()

int hm330x_read ( hm330x_t dev,
hm330x_data_t data 

Read particle matter measurements.

[in]devDevice descriptor of the driver
[out]dataPre-allocated particle matter data
Return values
-EBADMSGCRC checksum didn't match
-EPROTOSensor did not acknowledge command

◆ hm330x_reset()

void hm330x_reset ( hm330x_t dev)

Reset the sensor.

[in]devDevice descriptor of the driver

◆ hm330x_sleep()

void hm330x_sleep ( hm330x_t dev)

Set Device to Sleep.

[in]devDevice descriptor of the driver

◆ hm330x_wakeup()

void hm330x_wakeup ( hm330x_t dev)

Wakeup Device.

[in]devDevice descriptor of the driver