How to Make a SoundCloud Powered Children's Toy

Just over a week ago we had our first internal hackathon at SoundCloud. You can read (and listen!) about it on our community blog or read some of the awesome press coverage the event received.


We had over 60 people attend and over 20 projects were demoed. I joined a team organized by Josh Devins to build ToyBox, a children’s toy that plays sounds from SoundCloud in response to physical events. The team consisted of myself, Horaci Cuevas, Josh Devins, and Oliver Hookins.

The first task was to come up with a design for our project. An Arduino fitted with gyro, accelerometer and motion sensors provided the interface between real world events and the rest of the system. A Raspberry Pi would then run the following pieces of software:

  • toybox:downloader - The downloader polls a webapp for data about what sounds from SoundCloud should be played in response to certain events. In order to make the toy more responsive, toybox:downloader downloads the sounds from SoundCloud and stores them on disk (The Raspberry Pi’s SD card).
  • toybox:playback - An asynchronous wrapper around mplayer.
  • toybox:serial - An app that listens for data on the Raspberry Pi’s serial port. Event data from the Arduino is printed out on stdout for other processes to consume. toybox:serial also uses 0MQ to push event data to a web interface so you can monitor a toy’s activity from a browser. The 0MQ consumer also responds to events by playing the appropriate sounds using toybox:playback.

To provide an interface for toy owners to register a toy (id’d by the Raspberry Pi’s MAC address) and associate SoundCloud sounds with events, we built a simple Sinatra application that we hosted on Heroku. toybox:webapp also provides a couple of endpoints that serve JSON describing what sounds should be played when for a particular toy. This provided the service endpoint needed by toybox:downloader.

Knowing what needed to be built, we each started hacking on a piece. Horaci worked on toybox:serial, Oliver worked on toybox:downloader and toybox:playback and I worked on toybox:webapp. Josh focused on the Arduino soldering and coding and Oliver and Horaci helped get the Pi set up. You can see the Arduino code here.

There was a bit of frantic integration work at the end, but it did all come together nicely. It was great to see sounds being played from SoundCloud whenever a button was pushed, or the toybox was shaken, tilted or spoken to.


Making it pretty is a job for another hackathon :-)