PMSA003I: add support for driving SET pin low while not actively taking a telemetry reading#6569
Conversation
|
|
…are into upstream-pmsa003i
…en't doing a telemetry reading
61d337c to
79c49a9
Compare
|
Hi @vogon , thanks a lot for this patch :) Are you familiar with the trunk linting tool? We use it to keep our codebase consistent |
|
@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. |
…are into upstream-pmsa003i
There was a problem hiding this comment.
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) {
|
NFC2 is IO6 on the RAK4631, which is broken out on the RAK13002 Works with my Adafruit PMSA003I |
…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>
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_PINwhich 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:
master.🤝 Attestations