Change Request - Dust Sensor

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Change Request - Dust Sensor

#1 Post by Shardan » 25 Feb 2017, 11:02

Hello all,
i took this from my post in another thread, sorry for double post.

There are some issues with the plugin for the GP2Y10 dust sensor that should be improved.
Sadly my programming knowledge is completely outdated so i'm not able to do that myself.

The improvements are based on the datasheet and the application note from the manufacturer:
Datasheet: https://www.sparkfun.com/datasheets/Sen ... 10au_e.pdf
App note: http://www.sharp-world.com/products/dev ... appl_e.pdf

I've checked a dozen of these sensors and found tolerances up to 30% so the value may be used
for switching an air cleaner "by feeling" but not for even an approximate measurement.

Oversampling
The sketch starts an oversampling with adding 25 measurements from the sensor.
Any reason why the result is not divided by 25 within the plugin to give average directly?

Zero point calibration "down".
Due to the application sheet the zero value (offset) should be stored in the sketch.
If a value lower as the stored zero value is measured this should be the new zero value (offset).

This shouldn't be too difficult to implement. Set a "ZeroV" variable to a high value at start and
check if to set it down with every measurement cycle.

Zero point calibration "up".
Over time the offset moves up due to dust adhered inside the sensor and aging of the sensor's LED.
Aging led due to app note can influence the measuerement up to 50%.

App Note says: "If the sensor does not come down to the stored zero value ver a long time, the
lowest measured value over a certain time should be the new zero value."


This might be more complex to implement.
Easiest way might be to reset the stored zero value to a high value and let it do the "down" way again.
Might be triggered manually? ("Recalibrate")
Disadvantage: As long as the new zero point is calibrated the measurement gives bad values.

Maybe an idea to calibrate zero offset automatically, without that disatvantage:
Use a variable "zeroV" for current measurement as described above, set it to a default value at start.
The default value should be something around 2000, subtracted from the sum of 25 measurements in the plugin.

Set a second variable, e.g. "zeroCal" to a high value (e.g. 10000) at start and calibrate it "down" as described above.
This may run in parallel with the usual measurement cycle of the sensor too.
Every now and then (maybe once a week?) copy the zeroCal value into
the "zeroV" current value variable, then reset zeroCal to high value and start the cycle again.

Another point that should be mentioned:
Store the zero value in the RAM or in the flash?
Storing in RAM says it is lost every time you reset / power the device and has to recalibrate.
Storing in flash solves loosing the zero value at the cost of write cycles to the flash.

Maybe do both, RAM for current working value and flash for long time storing to reduce flash writes?
Maybe if we get a new "zeroCal" written to "zeroV" once a week, save it to flash and use it as the
default value in "zeroV" for next start?

I'm not sure about using flash..

Regards
Shardan
Regards
Shardan

thonshic
New user
Posts: 4
Joined: 25 Feb 2017, 11:00

Re: Change Request - Dust Sensor

#2 Post by thonshic » 26 Feb 2017, 13:19

BTW, we found the SDS011 sensor to be a really good PM sensor with much less noisy measurements.
This sensor is not yet implemented (it has a serial interface), but should be easy to do, there is arduino code available already.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Change Request - Dust Sensor

#3 Post by Shardan » 26 Feb 2017, 19:34

There are several better dust sensors, even laser based ones on the market.
Even different readings for PM2,5 and PM10 are availlable.
The common disadvantage is a price much higher then the GP2Y10

For exact measurements they are better, no doubt. For controling an air cleaner or such
the GP2Y10 does the job as long as the points above are solved.
Regards
Shardan

psy0rz
Normal user
Posts: 232
Joined: 02 Feb 2017, 12:12

Re: Change Request - Dust Sensor

#4 Post by psy0rz » 04 Mar 2017, 13:45

good suggestions shardan! i have the gp2y10. ill look into it as soon as i have time.

keeling a separate "new minimum" variable thats used and then reset once a week sounds like a good idea.
Please support ESPEasy development via Patreon or buy us a coffee.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Change Request - Dust Sensor

#5 Post by Shardan » 04 Mar 2017, 15:50

Ooops.. sorry double post
Last edited by Shardan on 04 Mar 2017, 15:51, edited 1 time in total.
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Change Request - Dust Sensor

#6 Post by Shardan » 04 Mar 2017, 15:50

Great!
I'm definitely looking forward to it.

I've two GP2Y10 running in a selfmade circuit and some in my shelf so i can test changes.

Regards
Shardan
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 24 guests