“Like” on Twitter Makes Soap Bubbles Blowed

The bubble gun will blow soap bubbles each time your tweet gets like on Twitter.


  • obniz x1
  • power supply for obniz x1
  • bubble gun x1
  • soapy water x1


First, apply for a Twitter developer account and be approved in order to use Twitter API. You can apply from below URL and usually get approved in a few days. https://developer.twitter.com/

Second, open the battery case and connect electrode plate to the obniz.

obniz bubble gun
0 positive
1 negative

(Please be careful not to apply excessive voltage.)

Finally, connect the obniz to a power, and then dip bubble gun in soapy water.


Get “consumer_key“, “consumer_secret“, “access_token_key” and access_token_secret from here. Then, save as “secret.json” like below and put the file at the same directory as the program.

  "consumer_key"        :"YOUR_CONSUMER_KEY",
  "consumer_secret"     :"YOUR_CONSUMER_SECRET",
  "access_token_key"    :"YOUR_ACCESS_TOKEN_KEY",
  "access_token_secret" :"YOUR_ACCESS_TOKEN_SECRET"

This program is written in node.js. Not runnable on browser.

const fs = require("fs");
const Obniz = require("obniz");
const obniz = new Obniz("OBNIZ_ID_HERE");
const Twitter = require("twitter");
const client = new Twitter(JSON.parse(fs.readFileSync("secret.json","utf-8")));
const params = {Name: "YOUR_HANDLE_NAME_ON_TWITTER"};
const ROTATE_TIME = 1500;
const STOP_TIME = 1000;
let isBlowing = false;
let prevLikeCount = 0;
obniz.onconnect = async () => {
  obniz.repeat(async function(){
    await client.get('statuses/user_timeline', params, async function(error,tweets,response){
      if (error) {
      let currentLikeCount = tweets[0].favorite_count;
      if(currentLikeCount <= prevLikeCount){
        console.log("not like added");
        prevLikeCount = currentLikeCount;
      let diffLikeCount = currentLikeCount - prevLikeCount;
      await blowBubbles(diffLikeCount);
      console.log("like added!");
      console.log("like count:"+currentLikeCount);
      prevLikeCount = currentLikeCount;
  }, 10000);
  async function blowBubbles(count){
    isBlowing = true;
    for(let i=0; i<count; i++){
      await obniz.io0.output(true);
      await obniz.io1.output(false);
      await obniz.wait(ROTATE_TIME);
      await obniz.io0.output(false);
      await obniz.wait(STOP_TIME);
    isBlowing = false;