MCU Accessing Internet Service Via IFTTT – Ameba Arduino
by xidameng in Circuits > Arduino
197 Views, 3 Favorites, 0 Comments
MCU Accessing Internet Service Via IFTTT – Ameba Arduino
Accessing internet service is an easy job for a smart device like an android phone, tablet or a PC, but not so easy on microcontrollers since it usually requires better connectivity and processing power. However, we may offload the heavy part of the job to IFTTT to help us accomplish a great variety of internet service with ease. This tutorial will show you how to make use of IFTTT to do just that.
Supplies
- Ameba x 1
- An account from https://ifttt.com/ , in order to access IFTTT service
Introduction to IFTTT
IFTTT, known as If This Then That, is a website and mobile app and free web-based service to create the applets, or the chains of simple conditional statements. The applet is triggered by changes that occur within other web services such as Gmail, Facebook, Telegram, Instagram, Pinterest etc.
· Generate Applet from IFTTT
In next, we obtain an example of IFTTT Applet to send email to specified recipient.
To run the example, HTTP POST feature of the ameba is used to post a simple webhook service that is received by IFTTT Platform and in turn be used to trigger a response (sending an email).
After logging in https://ifttt.com/, click My Applets from Top.
Check images above to follow along the steps.
Setup IFTTT on Ameba MCU
· Post the Trigger via Ameba
Once the Applet is ready in the IFTTT dashboard, the example program can be flashed onto Ameba board to post HTTP request.
1. The example program is under the folder “HTTP_IFTTT_POST”. Follow the steps below:
1) Click on *.ino file inside the example folder provided in the class to open the example with the Arduino IDE.
2) Once the program is opened, edit the following 3 items inside the code in order to make the program works successfully.
Edit the wi-fi credentials to connect to the wi-fi hotspot or access point of desirable choice.
Under the host name field, enter the hostname of the IFTTT service “maker.ifttt.com”
under the Path field, enter the EventName and key field “trigger//with/key/”
− Event name: The event name should be same as the one specified in the IFTTT applet. In this example, the event name is “test_event”
− Key: available under Webhook service in individual IFTTT account. See next step to obtain.
3) How To obtain a key from documentation tab of the Webhooks?
find the Webhooks service in the Services tab.
On Webhooks service page, click on the Documentation tab on the
top right corner.
The key can found in the documentation page. Also, how HTTP request can be used as shown
Coding and Running
The sample of the completed code is indicated above
Now let's run the sample program on Ameba
Once the example is ready, connect to Ameba board via USB Cable.
Compile the code. Click on “Sketch” -> “Verify/Compile” on Arduino. Upon completion, “Done compiling” will be prompted at the bottom of Arduino.
Upload (flashed) the code onto Ameba by clicking on “Sketch” -> “Upload”. (The uploading process will be indicated by component D3 which will be flashing on the board)
Once the upload is completed (component D3 on the board will stop flashing), “upload finish” will be reflected on the bottom of the Arduino IDE window
Open the serial monitor.
Press the “Reset” button to see the output logs.
After the event has been successfully fired, the line of “Congratulations! You have fired the test_event event” can be seen on the serial monitor and an email reminder for this event will be delivered.
Thereafter an email is sent to recipient email account
registered at IFTTT Applet and email notification will be received.