Imp003 Deep Sleep


I have the imp003 development board, which has the 32kHz xtal.
With the crystal, I thought I would be able to use server.sleepfor().


But it goes to sleep and never wakes up (and restarts) after 300 seconds. It remains offline and I have to physically reset or cycle power to make it run again.

My goal is to deep sleep, wake up every 5 minutes, check a prox sensor, report it to agent and go back to sleep. Does this not work with imp003 / development board?
Or maybe I’m doing it wrong?


So, it’s likely actually sleeping and waking, but when it wakes, it won’t connect unless you ask it to.

If you’re in RETURN_ON_ERROR mode then a connect must be explicit - ie with a server.connect. A server.log will not bring the connection up unless you are in SUSPEND_ON_ERROR mode.

If you still have problems, please post the full code.


Thanks Hugo. That answer made me see my mistake. It was actually waking up, but it fell through the functions so fast and went back to sleep I didn’t see it happen. Now I check the sensor and report it to agent, use server log so I can see that it happened, and wait 5 seconds before I sleep again. Now I can see it working. My prox sensor which is always powered draws about 5ma all the time. But making the imp sleep for 5 minutes between reports saves a lot of battery. That is a huge difference.