A new board, obniz board 1Y, has "sleep mode function". I think you have already heard about sleep mode function. Yes, it's making devices working only when in use. Devices don't operate when it's not being used so you can save power and use it for longer time.
Thanks to this sleep mode function, you can operate the board for "1 YEAR" with AA batteries and do your development project anywhere, even at the place without power outlet.
This time, let's make use of this sleep mode fucntion of obniz board 1Y and detect door open/close using magnetic switch!
What to makeWhen door open/close is detected by magentic swtich, obniz board 1Y wakes from sleep and sends message to Slack. Then, it turns back to sleep mode again!
Things in UseStepsStep1Connect obniz Board 1Y with magnetic switch as below.
This time, we can connect the board to magentic wsitch using obniz Grove connector!
[Reference: If you do not use Grove connector] obniz parts library (CT10)
Step2Let's arrange setting to send messages to slack → https://api.slack.com/apps
(Please prepare slack account previously)
2-1 Slack API
Click "Create New App" on [Your Apps] on Slack API screen.
2-2 Create a Slack App
App name: As you want (here, we use "obniz_event")
Development Slack Workspace: Workspace you want to send messages
When you finish creating App, the screen would be as below. You can set up the app on your own, this time please click "Incoming Webhooks"
2-3 Setting Webhooks
Let's move to [Incoming Webhooks] and turn on "Activate Incoming Webhooks"
Scroll down and Click "Add New Webhook to Workspace"
2-4 Setting Channel
Choose where to send messages. You can send messages to private or group channels.
2-5 Copy Webhook URL
Copy the URL and use it when coding.
Move to obniz developer console and register the device. [devices] - [add devices] - [Use obniz official devices]
Because we use serverless event, save program on repository. [repository] - [New]
Please, set up as below and click the blue button "create"
- Type : WebApp
- Access : Private
- File Name : As you want(here, "sleep_sw")
And write the code! The source is attached below!
Step5Click [Serverless Event] - [Create] on obniz Console!
- Title : As you want(Here, "SleepSwEvent")
- WebApp : Code Title you saved
- Activation (きっかけ) : obniz Hardware Event
- obniz : obniz ID
- Event : online
Now everything is prepared!
What is obniz?obniz Is a cloud-connected IoT development board. Start DIY electronics with obniz! You can control devices and robots via cloud and do AI projects very easily with obniz. You can connect to Wi-Fi just by scanning QR code on the screen and start programming on the web browser of your smartphone or computer with any language you prefer. obniz supports whatever you want, from simple DIY electronics to advanced IoT projects. Let’s try!
A new board, obniz board 1Y, has been on sale from 17th Dec. Let's check the powerful board with sleep mode function and additional power pins at the official store!











Comments