Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

PMS5003 Laser lifetime

For discussion of DIY weather equipment - sensors, accessories, improvements to existing kit etc
Post Reply
watsonm
Posts: 208
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

PMS5003 Laser lifetime

Post by watsonm »

For any of you that have been using the PMS5003 in a homebuilt set up with your own code I wanted to show a possible upgrade to the code to extend the life of the laser. Basically it means disabling the unit for a couple of minutes and then re enabling it. It is not likley that the air quality changes significantly in that time frame but the code can be adjusted if you are in a significantly changing environment. (This is not my idea but adapted from another forum suggestion for arduino code)

I have been using the code pointed to by Pi Hut.

Code: Select all

https://thepihut.com/products/pms5003-particulate-matter-sensor-with-cable

On my system the library module is stored in /usr/local/lib/python3.9/dist_packages/pms5003 in file _init_py

Code: Select all

 I have added the following  after the def reset(self):  code

# In library module  _init_py
    ....
    def sleep(self):
        time.sleep(0.1)
        GPIO.output(self._pin_reset, GPIO.LOW)
        self._serial.flushInput()
        time.sleep(0.1)

    def awake(self):
        time.sleep(0.1)
        GPIO.output(self._pin_reset, GPIO.HIGH)
        time.sleep(0.1)
        .....
and then in my own python script where I read the PMS5003 I have :

Code: Select all

#   In python reading code
       ........
        data = pms5003.read()
        pms5003.sleep()    # put in low power mode
        time.sleep(90)      # delay as long as you want
        pms5003.awake()
        time.sleep(30)   # wait to allow to stabilise (I believe 30secs is recommended)
        ......
This seems to work for me as the pms5003.sleep() call does stop readings being read. I tested that by commenting out the awake call. This resulted in a Timeout error.

I also had to connect the "SET" pin of the PMS5003 to GPIO22 (pin 15) on the Raspberry Pi board.

Reference:

Code: Select all

https://forum.airgradient.com/t/extending-the-life-span-of-the-pms5003-sensor/114

Hope this is of use to someone.
Regards Mike
Image
Raspberry Pi 4 Bullseye
Directly connected : BMP388 pressure sensor. DHT22 For internal Humidity/temp Sensor. PMS5003 Particle Sensor
Wireless connected: 3 (WS2083)Temp TXr's, WH57 Lightning Sensor, FO Solar sensor
User avatar
mcrossley
Posts: 12776
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PMS5003 Laser lifetime

Post by mcrossley »

I don't know about this device, but in general switching diode lasers that are meant for continuous use off and on lots of times can shorten their life.

The problem is the inrush current at switch on can be considerably larger than the continuous running current. The power supply needs to be designed to avoid this.

So a claim that switching a laser off for say 50% of the time doubles the life span may be a bit simplistic and not be true. You would have to factor the run time saved against that lost due to cycling.

As I say, it may not apply in this case, but these units will be built to a price point and power cycling may not have been high on the agenda.

I believe temperature is the biggest killer though, let the diodes heat up and they fail faster, so power cycling may keep them cooler overall and extend their life.

To prove any of this though you need to run a number of units in each mode and see what the failure rates were.

My 2p worth, and probably worth less!
watsonm
Posts: 208
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

Re: PMS5003 Laser lifetime

Post by watsonm »

Mark,
Thanks for your reply.

The data sheet does refer to the set pin so it seems it was designed to be put into sleep mode, with the appropriate level of translation into english ;)
However I do take your point that at this price point it may not improve the lifetime that much, but it was fun working out how to do it!! :D

Code: Select all

PIN3 SET Set pin  High level or suspending is normal working status, while low level is sleeping mode

Code: Select all

The SET and RESET pins are pulled up inside so they should not be connected if without usage
Regards Mike
Image
Raspberry Pi 4 Bullseye
Directly connected : BMP388 pressure sensor. DHT22 For internal Humidity/temp Sensor. PMS5003 Particle Sensor
Wireless connected: 3 (WS2083)Temp TXr's, WH57 Lightning Sensor, FO Solar sensor
Post Reply