Try to express Birthday Balloon on Twitter

Try to Express Birthday Balloon on Twitter

What’s this?

When it’s your birthday, you can see balloons in your profile page on Twitter. I tried to expres this “Birthday Balloon.”
I used Google Calender’s date because there is unfortunately no Twitter API to get someone’s birthday.

Materials

  • obniz x1
  • power supply for obniz x1
  • DC Motor x1
  • display monitor x1
  • balloons x2-4
  • disposable chopstick x3
  • cardboard and paper, etc
  • (3D printer)

Steps

Hardware

Prepare balloons, a box for balloons and an image taken after profile page on Twitter.

Connect a DC Motor to an obniz. Then, connect the obniz to a power.

obnizDC Motor
0OUT1
1OUT2

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 part in AI Robot Kit which can combine an DC Motor with.

Additionally, make a box to fix the device behind the display monitor using cardboard box.

You have completed Hardware part. This will work like below video.

Software

When it is your birthday, which you registered on Google Calendar, IFTTT call webhook to trigger obniz Event. To make the system, this page 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 “Endpoint” URL.

Second, make IFTTT Applet to call webhook to trigger the event. Fill in entry fields as shown in the image below.

Finally, register your birthday on Google Calendar. you have to include “誕生日” character string.

It’s finished.

Program

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>お誕生日</title>
     <script src="https://obniz.io/js/jquery-3.2.1.min.js"></script>
    <script src="https://unpkg.com/obniz@1.15.2/obniz.js" crossorigin="anonymous"></script>
</head>
<body>

<script>
let obniz = new Obniz("OBNIZ_ID_HERE");
const WINDING_TIME = 7000;

obniz.onconnect = async function () {

    let motor = obniz.wired("DCMotor", {forward:0, back:1});
    motor.power(48);


     if (typeof req === "object") {

        if(req.body.birthday) {
         console.log("birthday");

        motor.forward();
         await obniz.wait(WINDING_TIME);
        motor.stop();

       }

     }else{
        console.log("failed");
    }

     if (typeof done === "function") {
       done();
     }


}
</script>
</body>
</html>