Loading...
Searching...
No Matches
HM330X Laser Particulate Matter Sensor

Driver for HM330X particle matter sensor. More...

Detailed Description

Driver for HM330X particle matter sensor.

About

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.

Files

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...
 

Macros

#define CONFIG_HM330X_INDOOR_ENVIRONMENT   1
 HM330X deployment setting.
 

Functions

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

Macro Definition Documentation

◆ CONFIG_HM330X_INDOOR_ENVIRONMENT

#define CONFIG_HM330X_INDOOR_ENVIRONMENT   1

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.

Parameters
[in,out]devDevice descriptor of the driver
[in]paramsInitialization parameters
Return values
0Success
-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.

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

◆ hm330x_reset()

void hm330x_reset ( hm330x_t dev)

Reset the sensor.

Parameters
[in]devDevice descriptor of the driver

◆ hm330x_sleep()

void hm330x_sleep ( hm330x_t dev)

Set Device to Sleep.

Parameters
[in]devDevice descriptor of the driver

◆ hm330x_wakeup()

void hm330x_wakeup ( hm330x_t dev)

Wakeup Device.

Parameters
[in]devDevice descriptor of the driver