Try to Express Birthday Balloon on Twitter
Contents
Make things
When it’s your birthday scheduled on Google Calendar, real balloons will fly.
When it’s your birthday, you can see balloons in your profile page on Twitter. Let’s try to express this “Birthday Balloon.” I used Google Calender’s date because there is, unfortunately, no Twitter API to get someone’s birthday.
Materials
- obniz Board (in AI Robot Kit)
- power supply for obniz
- DC Motor (in AI Robot Kit)
- tire wheel for DC Motor (in AI Robot Kit)
- vertical display monitor
- balloons x2-4
- disposable chopstick x3
- cardboard and paper, etc
- (3D printer)
How to make
Body
Prepare balloons, a box for balloons, and an image taken after the profile page on Twitter.
Put threads to balloons and make a device to wind up the threads. This device is composed of disposable chopsticks, 3D printed parts, and a tire wheel part in AI Robot Kit which can combine a DC Motor with.
Additionally, make a box to fix the device behind the display monitor using a cardboard box.
This will work like the below video.
Hardware connection
Connect parts to an obniz Board like the table and the image below by referring to DC Motor Library. Please adjust the orientation of DC Motor appropriately.
obniz | DC Motor |
---|---|
0 | OUT1 |
1 | OUT2 |
Software
When it is your birthday, which you registered on Google Calendar, IFTTT call webhook to trigger obniz Event. (To make the system, Webhook IFTTT Integration | obniz is really helpful.)
First, save below “Program” to your repository and make obniz Event to run the program. “WebApp to run” is the program. You need to take a note of the “Endpoint” URL.
Second, to run a program triggered by the start of an event with the string “birthday” in the Google Calendar, 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 Google Calendar from the Service.
Choose “Event from search starts.”
(You need to log in with Google if you use Google Calendar for the first time with IFTTT.)
In the Which calendar? field, select the calendar name of the Google Calendar in which you want to register your birthday. Also, enter “birthday” in the Keyword or phrase field.
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.
Finally, register your birthday in Google Calendar. You have to include the “birthday” character string. You have now completed it.
When it becomes your birthday, real balloons will fly along the side of the display that looks like the Twitter profile.
The program judges the contents of Webhook call at this part of if statements and rotates the DC Motor. It judges if Body of posted webhook call is {"birthday":true}
or not.
if (typeof req === "object") { if (req.body.birthday) { ... } }
Please rewrite const WINDING_TIME = 7000;
(code.js line2) and motor.power(48);
(code.js line6) appropriately.