Rules for PMSx003 dust sensor
Moderators: grovkillen, Stuntteam, TD-er
Rules for PMSx003 dust sensor
Hi!
How to change the rules so that the sensor makes a measurement every ten minutes?
How to change the rules so that the sensor makes a measurement every ten minutes?
Armageddon was yesterday, today we have a serious problem.
Re: Rules for PMSx003 dust sensor
Hello,
Do you refer to the wiki https://letscontrolit.com/wiki/index.php?title=PMSx003 ?
If you use the rules from the wiki it is quite easy to change the time.
on System#Boot do
gpio,16,0
timerSet,1,20
endon
On Rules#Timer=1 do
LongPulse,16,1,5
timerSet,1,20
endon
The time is set with the "timerSet" command.
In this example it is set to 20 seconds. You may set this to bigger values.
Do you refer to the wiki https://letscontrolit.com/wiki/index.php?title=PMSx003 ?
If you use the rules from the wiki it is quite easy to change the time.
on System#Boot do
gpio,16,0
timerSet,1,20
endon
On Rules#Timer=1 do
LongPulse,16,1,5
timerSet,1,20
endon
The time is set with the "timerSet" command.
In this example it is set to 20 seconds. You may set this to bigger values.
Regards
Shardan
Shardan
Re: Rules for PMSx003 dust sensor
Thanks for quick answer.
I am not sure if I understand this rule correctly. The first part is responsible for the start after running Wemos, for exemple 20 seconds.
But what the second part does?
I will explain what I would like to achieve, the sensor is turned off for 10 minutes, then it takes measurements for 2 minutes and turns off again for 10 minutes and so in the loop. Maybe something is wrong with my sensor, because it looks like only the first part of the rule works. 600 seconds after switching on, the fan starts working, but it does not turn off after a set time, the readings are equal to zero. I checked all connections, I have the same as in the wiki.
I am not sure if I understand this rule correctly. The first part is responsible for the start after running Wemos, for exemple 20 seconds.
But what the second part does?
I will explain what I would like to achieve, the sensor is turned off for 10 minutes, then it takes measurements for 2 minutes and turns off again for 10 minutes and so in the loop. Maybe something is wrong with my sensor, because it looks like only the first part of the rule works. 600 seconds after switching on, the fan starts working, but it does not turn off after a set time, the readings are equal to zero. I checked all connections, I have the same as in the wiki.
Armageddon was yesterday, today we have a serious problem.
Re: Rules for PMSx003 dust sensor
On GPIO16 I've connected the SET connector from the PMS.Malanow wrote: ↑28 Dec 2018, 22:56 Thanks for quick answer.
I am not sure if I understand this rule correctly. The first part is responsible for the start after running Wemos, for exemple 20 seconds.
But what the second part does?
I will explain what I would like to achieve, the sensor is turned off for 10 minutes, then it takes measurements for 2 minutes and turns off again for 10 minutes and so in the loop. Maybe something is wrong with my sensor, because it looks like only the first part of the rule works. 600 seconds after switching on, the fan starts working, but it does not turn off after a set time, the readings are equal to zero. I checked all connections, I have the same as in the wiki.
The first part sets GPIO16=0 so the sensor is in deep sleep.
Then the timer1 is initialized for the first waiting period. (timerSet,1,20) This is necessary to trigger the Rules#Timer event in the second part the first time.
The second part fires up if the timer event Rules#Timer=1 is triggered.
It activates the sensor on GPIO16 for 5 Seconds (Longpulse, 16,1,5).
Then the timer is reinitialized to trigger this part again after 20 Seconds.
So the second part builds a time controlled loop that is executed every 20 seconds.
Regards
Shardan
Shardan
Re: Rules for PMSx003 dust sensor
I understand almost everything. If I wanted to extend the measurement time I should change it this part:
for example
for for one minute measurement?
Code: Select all
LongPulse,16,1,5
Code: Select all
LongPulse,16,1,60
Armageddon was yesterday, today we have a serious problem.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules for PMSx003 dust sensor
That is correctMalanow wrote: ↑29 Dec 2018, 20:22 I understand almost everything. If I wanted to extend the measurement time I should change it this part:for exampleCode: Select all
LongPulse,16,1,5
for for one minute measurement?Code: Select all
LongPulse,16,1,60
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules for PMSx003 dust sensor
The Longpulse says how long the sensor is activated.
Setting Longpulse to 60 seconds with a waittime of 20 seconds will set the sensor to permanent running!
Not a good idea.
The sensor, exactly the laser inside has a limited lifetime of around 8000h, less then one year
when permanently running, so it should run as short as possible.
Setting "Longpulse" to 60 seconds would keep the sensor alive for 60 seconds... much longer then necessary
and much longer then the waittime.. due to that sensor would never switch off.
on System#Boot do
gpio,16,0
timerSet,1,20 <-- Waittime until first measurement starts
endon
On Rules#Timer=1 do
LongPulse,16,1,5 <---- "On" Time of the sensor, 5 secs here
timerSet,1,20 <-- Waittime between measurements. Change this for longer waittime between measurements
endon
These setting says that every 20 seconds the sensor starts for 5 seconds. This extends lifetime up to around three years.
The values are stored by ESPEasy so it is no problem if you try to read values more often then the sensor starts.
It will just show the last values from the sensor.
If you need a measurement every minute, change the second "timerSet,1,20" to "timerSet,1,60.
For two minutes change to "timerSet,1,120" and so on.
Setting Longpulse to 60 seconds with a waittime of 20 seconds will set the sensor to permanent running!
Not a good idea.
The sensor, exactly the laser inside has a limited lifetime of around 8000h, less then one year
when permanently running, so it should run as short as possible.
Setting "Longpulse" to 60 seconds would keep the sensor alive for 60 seconds... much longer then necessary
and much longer then the waittime.. due to that sensor would never switch off.
on System#Boot do
gpio,16,0
timerSet,1,20 <-- Waittime until first measurement starts
endon
On Rules#Timer=1 do
LongPulse,16,1,5 <---- "On" Time of the sensor, 5 secs here
timerSet,1,20 <-- Waittime between measurements. Change this for longer waittime between measurements
endon
These setting says that every 20 seconds the sensor starts for 5 seconds. This extends lifetime up to around three years.
The values are stored by ESPEasy so it is no problem if you try to read values more often then the sensor starts.
It will just show the last values from the sensor.
If you need a measurement every minute, change the second "timerSet,1,20" to "timerSet,1,60.
For two minutes change to "timerSet,1,120" and so on.
Regards
Shardan
Shardan
Re: Rules for PMSx003 dust sensor
All clear, this is my rules:
10 minutes delay after start, and 10 minutes between the next measurements. But only the first part works, after 10 minutes from the start, the fan in the sensor starts. Do I understand correctly that after five seconds he should turn off and turn on again after another 10 minutes? In my case it does not turn off . I suspect the sensor is broken because it does not give any readings.
Code: Select all
on System#Boot do
gpio,16,0
timerSet,1,600
endon
On Rules#Timer=1 do
LongPulse,16,1,5
timerSet,1,600
endon
Armageddon was yesterday, today we have a serious problem.
Re: Rules for PMSx003 dust sensor
Sure you don't have any quirk with cabling?
Rx/Tx swapped? SET and RESET correct?
Be sure both are connected to the ESP and have a pullup resistor (10 KOhm from the SET / RESET to 3.3V)
I've added the schematics from the printed circuit board I've created for the PMS7003.
Beware: The PMS5003 has another connector layout!
. .
Sadly the forum does not take PDF uploads.
Maybe send me your email address via PM, I can send you the datasheets
and some documentation about the build I did.
Rx/Tx swapped? SET and RESET correct?
Be sure both are connected to the ESP and have a pullup resistor (10 KOhm from the SET / RESET to 3.3V)
I've added the schematics from the printed circuit board I've created for the PMS7003.
Beware: The PMS5003 has another connector layout!
. .
Sadly the forum does not take PDF uploads.
Maybe send me your email address via PM, I can send you the datasheets
and some documentation about the build I did.
Regards
Shardan
Shardan
Re: Rules for PMSx003 dust sensor
I use this datasheet.
I checked several times, and it seems to me that everything is fine, but I will check again tomorrow.
I checked several times, and it seems to me that everything is fine, but I will check again tomorrow.
Armageddon was yesterday, today we have a serious problem.
Re: Rules for PMSx003 dust sensor
Check for Rx & Tx. They might be swapped.
Second, test for GPIO16 <-< SET. 10KOhm resistor attached?
If the resistor is in place, just leave the resistor connected to 3.3V and SET, open the connection to GPIO16.
This sets the sensor to permanent running.
Second, test for GPIO16 <-< SET. 10KOhm resistor attached?
If the resistor is in place, just leave the resistor connected to 3.3V and SET, open the connection to GPIO16.
This sets the sensor to permanent running.
Regards
Shardan
Shardan
Re: Rules for PMSx003 dust sensor
I have a working connection between ESP and PMS 5003, but indeed, the fan keeps on forever.
In the documentation, I read :
GPIO 0-15 all have a built-in pull-up resistor, just like in an Arduino. GPIO16 has a built-in pull-down resistor.
If this is true, it is possible that GPIO16 is not capable to pull down the set port.
In the documentation, I read :
GPIO 0-15 all have a built-in pull-up resistor, just like in an Arduino. GPIO16 has a built-in pull-down resistor.
If this is true, it is possible that GPIO16 is not capable to pull down the set port.
Re: Rules for PMSx003 dust sensor
Definitely no. A Pull Down resistor will pull the output down so the fan would be off all time.BertB wrote: ↑31 Dec 2018, 16:43 I have a working connection between ESP and PMS 5003, but indeed, the fan keeps on forever.
In the documentation, I read :
GPIO 0-15 all have a built-in pull-up resistor, just like in an Arduino. GPIO16 has a built-in pull-down resistor.
If this is true, it is possible that GPIO16 is not capable to pull down the set port.
The schematic shown is running for 18 months now without a problem, GPIO16 works.
Regards
Shardan
Shardan
Re: Rules for PMSx003 dust sensor
There must be somthing wrong with LongPulse then.
Just for the purpose of faultfinding, I hooked up an oscilloscope to GPIO12 and put this conde in Rules.
At Boot I see the pin going to logic 0 for a little over 60 seconds.
But then it stays up forever.
Also tried this with this command:
Using Pulse makes it work again. Remember Pulse works with ms.
Just for the purpose of faultfinding, I hooked up an oscilloscope to GPIO12 and put this conde in Rules.
Code: Select all
on System#Boot do
gpio,12,0
timerSet,1,60
endon
On Rules#Timer=1 do
LongPulse,12,1,5
timerSet,1,60
endon
But then it stays up forever.
Also tried this with this command:
Same result.
Using Pulse makes it work again. Remember Pulse works with ms.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules for PMSx003 dust sensor
Male a test, set it to 1 and right after you set it to 0. After that you set the long pulse.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules for PMSx003 dust sensor
I did as you suggested.grovkillen wrote: ↑01 Jan 2019, 17:10 Male a test, set it to 1 and right after you set it to 0. After that you set the long pulse.
In this case I saw, GPIO16 going up, down and up forever.
LongPulse starts correctly but fails to return to the original state.
I also noticed that the GPIO Boot state is not there.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules for PMSx003 dust sensor
What version are you using?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules for PMSx003 dust sensor
mega-20181231, but I think the problem is much older. I could try an older version.
Re: Rules for PMSx003 dust sensor
Starting with ESP_Easy_mega-20180415_test_ESP8266_4096.bin, I had working releases up until ESP_Easy_mega-20180522_test_ESP8266_4096.bin
ESP_Easy_mega-20180524_test_ESP8266_4096.bin gave an unknown command.
The Current release, ESP_Easy_mega-20181231_test_ESP8266_4096.bin gives a good response:
But simply does not carry out LongPulse.log "GPIO 16 Pulse set for 1 s"
plugin 1
pin 16
mode "output"
state 1
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules for PMSx003 dust sensor
Please bug report on GitHub.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules for PMSx003 dust sensor
seems it already exists:
Command LongPuls does not work correctly #1622
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules for PMSx003 dust sensor
Sorry, you're right.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules for PMSx003 dust sensor
You could use timer until we have a fix. GPIO+TimerSet
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Who is online
Users browsing this forum: No registered users and 75 guests