Skip to content

drivers: sensor: pms7003: add support for additional PM values #89187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hanan619
Copy link

The current PMS7003 sensor driver in Zephyr only supports reading the basic PM1.0, PM2.5, and PM10 concentration values.

This update extends the driver to support additional data provided by the PMS7003 sensor, including:

  • Standard particle concentration values (CF=1) for PM1.0, PM2.5, and PM10
  • Particle counts for particles greater than or equal to 0.3 µm, 0.5 µm, 1.0 µm, 2.5 µm, 5.0 µm, and 10.0 µm per 0.1 liter of air

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the PMS7003 sensor driver to support additional particulate matter measurements including standard CF values and particle count statistics.

  • Added new sensor channel definitions in sensor.h for CF concentration values and particle counts.
  • Updated the PMS7003 driver to include additional data fields in the data structure, sample fetching, and channel get functions.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
include/zephyr/drivers/sensor.h Added new sensor channel enumerations for CF concentrations and counts.
drivers/sensor/pms7003/pms7003.c Extended the data structure and functions to support the additional PM values.
Comments suppressed due to low confidence (2)

drivers/sensor/pms7003/pms7003.c:45

  • [nitpick] The variable name 'pm_5_0_count' is inconsistent with the sensor channel 'SENSOR_CHAN_PM_5_COUNT' defined in sensor.h. Consider renaming it to 'pm_5_count' for clarity and consistency.
uint16_t pm_5_0_count;

drivers/sensor/pms7003/pms7003.c:46

  • [nitpick] The variable name 'pm_10_0_count' is inconsistent with the sensor channel 'SENSOR_CHAN_PM_10_COUNT' defined in sensor.h. Consider renaming it to 'pm_10_count' for clarity and consistency.
uint16_t pm_10_0_count;

@hanan619
Copy link
Author

@MaureenHelm
Can you guide me, why the twister is failing?
Please review this PR as it is very straight forward

@hanan619
Copy link
Author

Can anyone guide me, why the test is failing??

@MaureenHelm
Copy link
Member

Can anyone guide me, why the test is failing??

Probably need to update drivers/sensor/sensor_shell.c with the new channels.

INFO    - The following issues were found (showing the top 10 items):
INFO    - 1) sample.sensor.shell.pytest on native_sim/native failed (3/5 pytest scenario(s) failed)
INFO    - 
INFO    - To rerun the tests, call twister using the following commandline:
INFO    - west twister -p <PLATFORM> -s <TEST ID> --no-detailed-test-id, for example:
INFO    - 
INFO    - west twister -p native_sim/native -s sample.sensor.shell.pytest --no-detailed-test-id
INFO    - or with west:
INFO    - west build -p -b native_sim/native samples/sensor/sensor_shell -T sample.sensor.shell.pytest

https://github.com/zephyrproject-rtos/zephyr/actions/runs/14724375047/job/41449187096?pr=89187#step:12:3180

@hanan619 hanan619 force-pushed the pms7003_channels branch 4 times, most recently from 7f8495d to aba4ccb Compare May 26, 2025 14:07
@github-actions github-actions bot added the area: Samples Samples label May 26, 2025
@github-actions github-actions bot requested review from kartben and nashif May 26, 2025 14:08
The current PMS7003 sensor driver in Zephyr only supports reading the
basic PM1.0, PM2.5, and PM10 concentration values.

This update extends the driver to support additional data provided by the
PMS7003 sensor, including:

- Standard particle concentration values (CF=1) for PM1.0, PM2.5, and PM10
- Particle counts for particles greater than or equal to 0.3 µm, 0.5 µm,
  1.0 µm, 2.5 µm, 5.0 µm, and 10.0 µm per 0.1 liter of air

Adding support for these readings allows applications to access more
detailed particulate data, improving the sensor’s usability in air quality
monitoring and analysis scenarios.

Signed-off-by: Hanan Arshad <hananarshad619@gmail.com>
@hanan619 hanan619 force-pushed the pms7003_channels branch from aba4ccb to ef6416c Compare May 26, 2025 14:08
Copy link

@hanan619
Copy link
Author

@MaureenHelm
Kindly review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants