Long Term Operation on Battery

The obnizBoard 1Y can operate continuously on AA batteries for up to one year by using the Sleep function to reduce battery consumption at unnecessary times.

This feature is only available on obnizBoard 1Y. obniz Board and M5StickC It's not available on the obnizOS version.

Get sensor values only once a day.

For example, let’s say you only measure the temperature once a day and store it in the cloud. obniz device is up and running once a day is enough, and there is nothing to do during the lumpy hours.

By Sleeping in this do-nothing time, you can reduce battery consumption. And after a period of time, it will automatically start up to measure the temperature again.


obniz.onconnect = async function(){
  var tempsens = obniz.wired("LM61", { gnd:0 , output:1, vcc:2});
  var temp = await tempsens.getWait();
  console.log(temp);  //output tempeature

  obniz.sleepMinute(60*24); // one day sleep
}

Using sleepMinute allows you to sleep for a specified amount of time, and when sleep is started, it automatically starts to The connection to obniz will be severed and it will enter the sleep state. The obnizBoard 1Y looks the same as it does when it is not connected to the power supply, and there is nothing on the screen It will no longer be possible.

Sleep中のobnizBoard 1Y

After the specified time has passed (24 hours in this case), it will automatically release the sleep state, make a wifi connection and call the program onconnect.

Activated by an external stimulus.

In addition to sleep until the time is up, external factors such as “a button was pressed” or “a person came” are also considered to be You can also use triggers to cancel Sleep.

On the obnizBoard 1Y, io0 is a special pin that can be used to break the sleep state by changing the voltage on this pin.


obniz.onconnect = async function(){
  var tempsens = obniz.wired("LM61", { gnd:0 , output:1, vcc:2});
  var temp = await tempsens.getWait();
  console.log(temp);  //output tempeature

  obniz.sleepIoTrigger(true);  // wake up when rising edge on io0
}

sleepIoTrigger wakes up from sleep when io0 changes from 0V to 5V. When the button is not pressed, the voltage is 0V when the button is pressed, and when the button is pressed, the voltage is 5V. When the button is pressed, the sleep state is released and the device starts up. 

By devising a sensor, you can also create a program that will send a notification to slack when a door is opened to release sleep.

Articles