Sleep is entering low power consumption mode by shutting almost all functions. It makes available working with batteries for long time by continueing sleep and wake up.
Some device like obniz Board 1Y has a sleep function. Depending on usage, It will keep over 1 year. It makes you put obniz Board 1Y where no power supply.
Below is example usages
- Watering a plant in intervals.
- Monitoring a temperature in intervals.
- To handle nexpected events like humandetect or exceeding temperature.
Integrating with Serverless Event is useful to use sleep function.
Wi-Fi and Displays and other almost all functions are no longer available while sleep. It will wake up from sleep when specified trigger occurred.
You can choose on of below triggers.
- Past time(second) 1sec to 64800sec(18 hours)
- Past time(minutes) 1min to 64800min(45 days)
- edge up detection of io0(Level is TTL. But it depend on VCC level)
- edge down detection of io0(Level is TTL. But it depend on VCC level)
When waking up from sleep, a device start same as first power up. A device will wake up by cutting and supplying a power again regardless sleep mode.
obniz.sleepSeconds() and obniz.sleepMinute() start sleep until time past. obniz.sleep() accept date object to determine next wakeup time. It is useful to calculate time.
obniz.sleepIoTrigger() start sleep until io0 changed.
How long does it work
It depends on average power consumption on each device. Power consumption while sleep is 20uA-40uA(VCC=5V) for obniz Board 1Y.
You need to calculate with standard power consumption (120mA avg).