sds011 problem with sleep timer

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Normal user
Posts: 1
Joined: 14 Jun 2018, 08:26

sds011 problem with sleep timer

#1 Post by till90 » 14 Jun 2018, 09:27

Hello everybody,

i try to set up a sds011 dust sensor with a measure interval of 3 minutes to save battery life (at the moment it is on power plug supply). I habe the Problem that i dont understand the connection/interaction between the different methods of sleep time, deepsleep, sensor sleep.....

My target is that the nodemcu v3.0 (esp8266) with espeasy_mega firmware and the sds011 dust sensor should run every 3 minutes for a measure cycle and after meassure send the data to thingspeak api and than go to sleep for another 3 minutes.
I dont know which of the parameters i have to set?!

1. There is the sleep time of the sensor itself on the device page.
2. There is the Data Acquisition interval time also on the device page.
3. There is the Sleep Mode section in the Config menue
3.1 With Sleep awake time
3.2 With Sleep time

What is the most power saving config?
Thank you for answers! Best regards Till

Normal user
Posts: 1201
Joined: 01 Sep 2017, 22:13
Location: the Netherlands

Re: sds011 problem with sleep timer

#2 Post by TD-er » 15 Jun 2018, 00:16

The timer interval of the SDS011 is written to the flash of the sensor itself (when changed).
This means the sensor will wake up by itself, run for 30 seconds and go to sleep again.
This sensor uses a fan and a laser. Both consume quite something and I would think twice before powering them from a battery.
The minimal run time of this sensor is 30 seconds.

At this moment it is not (yet) possible to trigger the sensor to take a sample and send it to sleep again in software. There is however a request for that and it is on my to-do list. (long list)

Without this "software wake" feature, I advice not to use deep sleep with this sensor.
Using the deep sleep feature, it is quite hard to make it wake up at the right moment. These will get out of sync, since the SDS011 will run on its own timer and the deep-sleep of the ESP depends on a lot of variable timings like the time it takes to connect to WiFi.

It may be possible to let the ESP collect the reading and then use some rules to set it to sleep again. That would make it keep sync at least.
But still power consumption is too much for long-time battery runs.

Normal user
Posts: 2
Joined: 24 Jul 2018, 00:45

Re: sds011 problem with sleep timer

#3 Post by danbates » 24 Jul 2018, 10:40

There's definitely a problem with the sleep timer and sending data to controller..

I set sleep time to 2 minutes (2*60s)-30s. I set the data acquisition interval to 120 seconds to correspond.. The data is grabbed from the device at the moment the fan powers up.. not after the 30s work time.
When I choose a different simpler sleep time of 1 minute and interval of 60 seconds.. The data is grabbed from the device after the 30s fan run time.. however the HTTP action to post the data happens before the data is updated from the device, meaning a different kind of inaccuracy.
I've attached the 1 minute typical settings.

What are the correct settings for the following to occur..
Sleep SDS011 for 90 seconds, work for 30 seconds, get data from device, send to controller, sleep SDS011 for 90 seconds etc..

How can rules work as a temporary workaround?

20102 - Mega
ESP82xx Core 2_4_1, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3
GIT version
73 [Normal] [Testing] [Development]
Build time
Jul 23 2018 02:16:08
Binary filename
Screen Shot 2018-07-24 at 10.36.15.png
Screen Shot 2018-07-24 at 10.36.15.png (56.64 KiB) Viewed 752 times

Normal user
Posts: 1201
Joined: 01 Sep 2017, 22:13
Location: the Netherlands

Re: sds011 problem with sleep timer

#4 Post by TD-er » 25 Jul 2018, 00:24

It isn't (yet) perfect, I know.

The 30 second run time is just a constant value we cannot change (for now). So you're actually setting the measurement interval and sleep-time at once.
For example when you set it to "5", this means every 5 minutes it will wake and run for 30 seconds and start to sleep again.

You have to make sure the "Interval" timer is at a shorter interval.
Every "Interval" number of seconds, the plugin is called to do some reading and it will collect the data from the serial buffer.
Note that for reading to the SDS011, you only need a read pin. The write pin to the SDS011 is only needed to change the wake/sleep interval on the SDS011.
In the future I may want to change the means of handling wake/sleep to a more "measurement on demand". Now the timing is handled on the sensor itself.

When you set the "Interval" timer too high, then it will try to read a measurement while a new one has just started. This may lead to corrupt data and thus no output.
When the "interval" timer is set too low, you just do more queries for data than needed. But it will only update the measurement when new (valid) sample data is received.
So setting it too low, may just waste resources. Setting too high may give you lots of invalid samples and thus no output at all.
When a valid output is read, it will be available for other processes like rules, but it is almost impossible to sync the ESP time and the sensor time, since they are operating on their own.

Thus keep in mind:
- Interval should be lower than measurement interval
- Interval shorter than 30 seconds is of no use when using the sleep mode of the sensor.
- Short interval timer may only be useful when performing continuous measurements.

Post Reply

Who is online

Users browsing this forum: Hairyloon and 1 guest