(App Ver.) Collaboration between obniz and Alexa (IFTTTT)
Contents
Make Things
With obniz, you can easily light LEDs and move things from your smart speaker.
We tried to link it with Alexa, which is built into Amazon Echo and other devices.
There is a way to extend Alexa’s functionality by developing a Skill, but this time we’ll use IFTTT so that you can extend the functionality more easily than creating a Skill.
IFTTT is a web service that makes it easy to connect various web services and devices.
Talk to Alexa and blink the LED
Let’s make a system that makes the LED blink when you talk to Alexa. The summary is as follows.
- Say to Alexa, “Alexa, trigger blink the LED.”
- Make a Webhook call of App with IFTTT
- The program is run and the LED blinks.
Materials
- obniz Board
- Alexa-powered smart speaker(eg. Amazon Echo)
- power supply for obniz
- LED
- (In case of LED without resistor, resistor, breadboard and jumper are also prepared.)
How to make
Hardware connection
Connect LED (and resistor) to an obniz Board like the table and the image below by referring to LED Library. (It’s no need to connect resistor if you use LED with a resistor. If you’re unsure, please check the datasheet.)
Also, pay attention to the direction of the LED. The longer leg (anode) is closer to the 0 pin of obniz.
obniz | LED |
---|---|
0 | Anode (the longer one) |
1 | Cathode (the short one) |
Software
Register your obniz Board!
Go to the obniz console and click on “Devices” → “Add Device.“
When the dialog opens, click on “Add Bought Device.” Follow the instructions on the screen to register.
▼
Make your App!
Make an app to run the program. You can distribute apps you created and installed and run on each device(Please see App – obniz Docs for more details.)
If you want to run the app first without creating it yourself, install and run the following apps that have already been created.
→ Alexaとの連携 (Lチカ)
For installation instructions, see Install an App and the next section, “Install your App on your Device.”
Go to the obniz console and click on “App Development” → “Create WebApp.“
Choose “Empty” from the “obniz Board/1Y Templates” and type the name of your app in the window that comes up. Then press “Create New App.”
Then, edit the app settings.
In this case, the program is run by Webhook calls with IFTTT when you say “trigger blink the LED” to Alexa, so check the “Run on Webhook” box.
After updating settings, click on the “Edit Program” to enter the program editing screen.
Then, paste the program in the Alexaとの連携 (Lチカ) link in the “Program” chapter below and save it. Once saved, the application is complete.
Install an App on your device
Install the app you have created on your device. Go to the obniz console and click on “Install.”
Next, select the obniz Board that you would like to run the program and click on “install.”
Then, click on the triangle icon next to “Open App” and press “Check Webhook URL.”
Make a note of the “Webhook URL” in the “Cloud Execution Triggers” section of the device setting’s screen. This will be used later for the connection with IFTTT.
Connect Alexa to IFTTT
To run a program triggered by the phrase “Alexa, trigger blink the LED”, use a service called IFTTT, which is a service that allows any web service(app) to run triggered by another web service(app).
Click “Create” in the top right corner of the main page and let’s start to make one. Then, click on “This” and select Amazon Alexa from the Service.
Choose “Say a specific phrase.” (You need to log in with your Amazon account if you use Alexa for the first time with IFTTT.)
Type “blink the led” in the field as the phrase you talk to Alexa (only lower case letters.)
Click on “Create trigger” to save the settings.
Next, edit the “That” part. Click on “That” and select “Webhook” in the Service.
Choose “Make a web request.”
Enter the Webhook URL you made a note in the “Install an App on your device” section in the URL field and fill in the remaining field like the image below.
Click on “Create action” and finish the settings.
Run
Let’s say to Alexa, “Alexa, trigger blink the LED.” LED probably blinks for 3 seconds like the video below.
(It might delay up to 15 minutes).
You can check if it’s running properly in the “Devices” section of your console. If the app status is green as shown below, the most recent run was successful.
Program
Please see the program of Alexaとの連携 (Lチカ) that have already been created.
Application example
In the previous chapter, we blinked the LED, you can also apply this to many things.
Turn the switch on and off.
For example, if you change the LED part to a servomotor, you can turn on and off the lights and outlets just by talking to Alexa.
Even if it’s not a smart home appliance, you can easily (physically) turn a switch on or off just by talking to Alexa, so it’s convenient when you’re not free or want to operate a switch in another room.
We tried it with the ON/OFF switch of the outlet. (See video below).
As you can see, you can easily operate the physical switch just by talking to Alexa.
Turn Alexa’s timer like a party↑↑↑
Since IFTTT’s Alexa’s trigger has “Your Timer goes off”, we changed IFTTT’s trigger and program a little and made the timer party-like by making the ring LED light-up colorful when Alexa’s timer goes off!
in the end
Thus, you can easily connect the obniz Board and Alexa through IFTTT.
However, IFTTT does not have Alexa on the action side, so it is impossible to make Alexa talk depending on the sensor value from obniz.
Creating an Alexa Skill gives you more flexibility to extend your functionality. Please see this article.