Skip to content

PMSA003I: add support for driving SET pin low while not actively taking a telemetry reading#6569

Merged
thebentern merged 14 commits into
meshtastic:masterfrom
vogon:upstream-pmsa003i
Apr 29, 2025
Merged

PMSA003I: add support for driving SET pin low while not actively taking a telemetry reading#6569
thebentern merged 14 commits into
meshtastic:masterfrom
vogon:upstream-pmsa003i

Conversation

@vogon

@vogon vogon commented Apr 11, 2025

Copy link
Copy Markdown
Contributor

the Plantower PMSA003I sensor takes about 60-120mA of power at all times while the fan is running, as I discovered when I was building a solar-powered DIY weather station node. now you can assign a GPIO in your variant file with PMSA003I_ENABLE_PIN which drives the SET pin on the sensor low to put it in standby mode. tested on my DIY node with a fork of 2.5.20.4c97351.

fixes #6518.

known todos:

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below): DIY node with a Heltec Mesh Node T114 and Adafruit PMSA003I breakout board.

@CLAassistant

CLAassistant commented Apr 11, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@fifieldt

Copy link
Copy Markdown
Member

Hi @vogon , thanks a lot for this patch :)

Are you familiar with the trunk linting tool? We use it to keep our codebase consistent

@vogon

vogon commented Apr 21, 2025

Copy link
Copy Markdown
Contributor Author

@fifieldt I'm not, sorry! would be happy to learn more and make it part of my workflow.

also, I followed up offline with someone with a RAK4631 node (maybe @klikva, the opener of #6518, but I'm not sure) and managed to get the change made to the RAK4631 variant to allow it to work out of box. more changes for that forthcoming.

edit: confirmed that the person I worked with offline was @klikva.

@thebentern thebentern requested a review from Copilot April 29, 2025 11:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds support for powering down the PMSA003I sensor when it is not actively taking a telemetry reading. Key changes include:

  • Defining PMSA003I_ENABLE_PIN in the variant file to control the sensor’s SET pin.
  • Updating the AirQualityTelemetry module header to include a new sensor state and initialize it.
  • Modifying the telemetry module in the source file to toggle the sensor’s power state between IDLE and ACTIVE modes during sensor reading cycles.

Reviewed Changes

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

File Description
variants/rak4631/variant.h Added definition for PMSA003I_ENABLE_PIN using PIN_NFC2 to control sensor standby.
src/modules/Telemetry/AirQualityTelemetry.h Introduced a new enum (State) to manage the sensor power state and conditional initialization.
src/modules/Telemetry/AirQualityTelemetry.cpp Updated runOnce() to wake the sensor on IDLE and put it back to sleep after telemetry is taken.
Comments suppressed due to low confidence (1)

src/modules/Telemetry/AirQualityTelemetry.cpp:80

  • [nitpick] Consider renaming the enum 'State' and the variable 'state' to 'SensorState' for improved clarity regarding sensor power management.
switch (state) {

@thebentern thebentern merged commit 72eae42 into meshtastic:master Apr 29, 2025
@ArgoNavi

Copy link
Copy Markdown
Contributor

NFC2 is IO6 on the RAK4631, which is broken out on the RAK13002

Works with my Adafruit PMSA003I

jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
…ng a telemetry reading (meshtastic#6569)

* support manually shutting off power to the PMSA003I sensor when we aren't doing a telemetry reading

* add comment about PMSA003I_WARMUP_MS to AirQualityTelemetry.cpp

* fix typos, use arduino gpio defines instead of magic numbers

* support manually shutting off power to the PMSA003I sensor when we aren't doing a telemetry reading

* add comment about PMSA003I_WARMUP_MS to AirQualityTelemetry.cpp

* fix typos, use arduino gpio defines instead of magic numbers

* RAK4631: add PMSA003I_ENABLE_PIN define

* fix indentation

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fan of the Particle Matter Sensor is rotating all the time

7 participants