ricki-z / SDS011

Arduino library for SDS011 dust sensor
GNU General Public License v3.0
81 stars 53 forks source link

Noob needs help with sleep function #2

Open Druidus opened 7 years ago

Druidus commented 7 years ago

Could you please provide a short example how the sleep function is called. Thanks in advance!

ricki-z commented 7 years ago

for sleep you can use the sleep() and wakeup() functions. SDS011 mySDS(pinRX,pinTX); mySDS.begin(); mySDS.sleep(); mySDS.wakeup();

Any command sent to the SDS011 will wake him up. So if you try to read data from a "sleeping" SDS011 that will wake up the SDS.

Druidus commented 7 years ago

Thx for your answer! Helped me to track down the problem. // Sleep my_SDS.sleep(); ESP.deepSleep(sleepTimeS * 100000);

the deep.sleep() command for the ESP always wakes up the SDS011 - dont know who is to blame for that ;-) Thx again

cyrinux commented 7 years ago

@Druidus I can confirme I have the same problem on a arduino mega with Sleepy::loseSomeTime(sleepTime);

ubergesundheit commented 7 years ago

@Druidus The issue with the deepSleep of the ESP8266 could be related to the fact, that the ESP pulls all pins to high just before sleeping. Since the SDS011 is connected through a SoftSerial, it could be possible, the SDS011 interprets this signal and wakes up.