Power-saving watering device using the sleep function of the obniz Board 1Y
The obniz Board 1Y now has a sleep function. This feature can be used to create a device that can run for a year on batteries alone.
This time, we’ll be creating a program that uses the sleep function to water regularly.
- obniz Board 1Y
- pump : Amazon
How to make
Connect the obniz to the pump as shown in the following table.
Register your obniz Board!
Go to the developer console in obniz and click on “Devices” → “Add Device”.
When the dialog opens, click on “Use OBNIZ Official Device”. Follow the instructions on the screen to register.
Let’s write a program.
Save the program to a repository for use in serverless events.
Go to the developer console of obniz and select “Repository” → “New”.
A dialog will appear, and you can set it as follows
- Type : WebApp
- Access level : Non-public
- File name : As you like (this time it’s sleep_motor)
Once configured, click “Create”. After doing so, the program input screen will appear, and you will be able to replace the program with the one you have completed.
※This program operates normally only with obniz Board 1Y.
When the program is ready, hover your mouse over the file name in the upper left corner, and click “Save” to display “Save”.
Configuring a Serverless Event
Serverless events are a feature that makes it easy to use obniz without having to prepare the servers that each one of you will need.
From the obniz console, click on “Serverless Events” → “New”.
Let’s set them in order.
- Name : As you like (this time it’s SleepMotorEvent)
- WebApp to run : Name of the program you just saved
- Trigger : obniz Hardware Event
- obniz : obnizID to measure the temperature this time
- Event : online
Once you’re set up, click “Create”! Now you’re ready to go.
I started watering them once every 12 hours. The obniz Board 1Y sleeps as soon as the watering is complete.
Also, with the obniz Board 1Y, the power can be supplied directly from the power input/output pins, without having to connect via USB.
You can easily create a power-saving watering device using the sleep function like this.
You can change the sleep interval, even if it’s in a remote location, and you have the advantage of being able to easily update the program with a different kind of sensor replacement.