Jan/07/14



Electric Imp guest bloggers Bunnie Curtis and Andrew Lim are from IFTTT, a service than enables users to make powerful connections with one simple statement: “If this then that.”

We love music at IFTTT and being the office DJ is a coveted role. Unfortunately, our water boiler also likes to play music. Every time it hits the boiling point it plays us Minuet in G major. It was cute for about a week.

After getting our hands on the imp at the Electric Imp Hack With Us hackathon, we first wondered how we might hack our boiler to play whatever we pleased. We might still try that, but without our boiler at the hackathon we decided if we couldn’t beat them we would join them. That’s when we decided to make The IMPLAY.

image

The IMPLAY has an array of piezo buzzers connected directly to the GPIO pins on the imp hardware.  We added an LED to indicate when any of the buzzers are playing. Although we used 4 buzzers, the code supports any number of piezo buzzers as long as there are enough pins to connect them to.

The IMPLAY agent exposes a very simple web interface where you can enter and send music code.  The agent receives the music code and forwards it to the device. The device then parses the code into frequency and duration information to drive the piezo buzzers. We found Firebase was a great means to store pre-programmed songs by name. If the agent receives a request matching the name of a song it will pull that song from Firebase and send the resulting code to the device.

Anyone can play music on our device! The Agent also listens on Twitter for any tweets with the hashtag #implay. You can play us a song with just a tweet and it strips any #hashtags, @mentions, and works with retweets. The music uses a simplified MML Syntax.

Information on how to make your own IMPLAY using Electric Imp and specs on the music syntax can be found at the GitHub repo. We also used the following great APIs that Electric Imp and Firebase provided during the hackathon:

The IMPLAY has been a hit at IFTTT HQ, and we look forward to growing our song library and more imp hacks!

Bunnie and Andrew 
IFTTT