Founder interviews, pre-release product design, hand crafted inventions.
Get the digest of our best ones, straight in your inbox. Every month.
Founder interviews, pre-release product design, hand crafted inventions.
Get the digest of our best ones, straight in your inbox. Every month.

How we made a Twitter powered bubble machine

Techmog is a liquid network of engineers, programmers, designers and entrepreneurs in and around London who report on the industry we work in, from an insider's view. We're always looking for Londoners with something interesting to say. Send an email to info@techmog.com if you would like to contribute to the website.

Peter Bailey

Freelance Wordpress Developer in London (peabay.xyz) @peabay
Share on Google+
Post to Reddit
Share on Linkedin

Check out: Arduino Day 2015

Electronic gizmo’s and do-da’s were piling up in my locker at work and not doing much beyond perpetuating my nerd image, so I thought I’d roll up my sleeves and plug stuff into other stuff to create A Twitter Powered Wifi Arduino Bubble Machine!

Luckily I’m familiar with electronics, having a Diploma in it, however I’d never actually made anything due to the fact that my course made anything electrical seem infinitely dull and theoretical. No more of that though with the coming of Arduino; the little programmable circuit that lets you make anything into anything with minimum effort and maximum back patting.

I decided to find the most basic bubble machine. One with only one setting – on or off. None of those fancy bubble customization options I would have had to decipher and reorganize. Bypassing the on/ off switch was simple enough, minus the remembering I can’t solder part. The two cables poked out the top where I could easily plug the Arduino in.

Next was the relay. This component is essentially a switch which can be turned on or off by a signal from another circuit (our Arduino). Worth noting that I bought a relay module and not just a relay so I wouldn’t have had to create a mess of wires on a prototype board. The module needs only three wires connected to the Arduino – 5V power, any binary pin that’s not 10, 11, 12 or 13 (our wifi shield needs those), and ground.

Arduino has a brilliant collection of example code. I used their looping wifi client which downloads a page over and over and modified it a little for our needs.

I wanted to keep the code on the Arduino to a minimum to give me more options later on. The only thing the Arduino would be responsible for was downloading a page from our server every few seconds, reading its content and blowing out three seconds worth of bubbles if the content contained instructions to do so.

The heavy work was done by two PHP scripts. One would be run frequently to search Twitter for a specific word (“@IUHQ” in this case) and save the search results to a database. The second would read the database and output instructions for the Arduino to download and act upon. On a scale of one to disgustingly dirty, this method is about a 7. The elegant solution would have been to use Twitter’s streaming API to search for tweets and then stream instructions to the Arduino. Alas, time was against me and the hoard of bubble dancers were becoming inpatient.

The machine worked surprisingly well and was far more responsive than I expected. But polling Twitter isn’t ideal, especially since some tweets can be missing from the search results, you only get 450 searches per 15 minutes and is a waste of server resources. But it’s certainly worth giving the project a go given how quick it was.

Posted 11th Nov 2013
Share on Google+
Post to Reddit
Share on Linkedin

Comments

  • pixelpusher_ca

    You should use the Twitter streaming API it’s awesome… no need to poll and you get every tweet.

    • Peter Bailey

      Totally! This project was just to get something up and running as quickly as possible, but I would like to do it properly.