I recently got a PMSA003i (on Stemma QT breakout board) and hooked it up to a Heltec ESP32 board. I'd like to put the fan to sleep periodically to extend its lifetime. I modified the Adafruit library to let me send sleep/wakeup commands (based on official documentation and looking at what a couple of other libraries are doing) but it hasn't had an effect. Has anyone else been successful in getting the PMSA003I to sleep using other libraries?
The summarized code is:
static constexpr int PMSx003_COMMAND_LENGTH = 7;
[Sleep] = { 0x42, 0x4d, 0xe4, 0x00, 0x00, 0x01, 0x73 },
i2c_dev->write(commandData[PMSx003Command::Sleep], PMSx003_COMMAND_LENGTH, true);
I enabled I2C library serial debugging and it claims to be sending the command listed above.
Getting PMSA003I to sleep
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 14182
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Getting PMSA003I to sleep
You can pull the SET pin low (not over i2c).
I've not seen a successful i2c sleep, but it is pretty cool that you are trying to mod the library for it. Are you watching the current draw to verify that the command you are sending is not going through?
https://learn.adafruit.com/pmsa003i/pinoutsSET - Set pin. High when working status, low level is sleeping mode.
I've not seen a successful i2c sleep, but it is pretty cool that you are trying to mod the library for it. Are you watching the current draw to verify that the command you are sending is not going through?
- mikenel
- Posts: 3
- Joined: Sun Aug 01, 2021 2:56 am
Re: Getting PMSA003I to sleep
I can see the fan still spinning which is the part I really want to go to sleep :-). Thanks for the tip about the SET pin. I'll also try to hook up a meter or scope and see if anything is changing after the command.
Thanks,
-mike
Thanks,
-mike
- mikeysklar
- Posts: 14182
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Getting PMSA003I to sleep
mike,
The set pin should give you the fan sleep you are looking for. There is a offsite example here:
https://cassiopeia.hk/laserdust/
The set pin should give you the fan sleep you are looking for. There is a offsite example here:
https://cassiopeia.hk/laserdust/
- mikenel
- Posts: 3
- Joined: Sun Aug 01, 2021 2:56 am
Re: Getting PMSA003I to sleep
Just to follow up... I soldered a wire to the SET pin on the breakout board and hooked it up to an output capable GPIO pin on the ESP32. Setting the pin to LOW shut down the fan as expected.
Code: Select all
// Set output mode
pinMode(sleepPin, OUTPUT);
[...]
// Turn off fan
digitalWrite(sleepPin, LOW);
[...]
// Turn on fan
digitalWrite(sleepPin, HIGH);
- mikeysklar
- Posts: 14182
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Getting PMSA003I to sleep
Perfect. Thank you for the confirmation and code.
Please be positive and constructive with your questions and comments.