If you're reading this article you're probably like me: I go through phases where I get so engrossed in a project (which most others would see as trivial), so focused on the goal that sleep and food are afterthoughts, I put my body through a gauntlet to appease some primitive urge of mine to CREATE.

Such was the beginnings of this project. I attended Google I/O 2011 and managed to get my hands on an Android ADK demo board. ADK is the Accessory Development Kit , an Arduino-based interface board whereby you can connect your compatible Android device (2.3.4 and any device from 3.1 onwards) to virtually any hardware and use the phone to control a device, or vice-versa.  It's called the Android Open Accessory platform, and it's totally cool.

To introduce the concept to the Google’s keynote speech they produced a regular ball maze toy , familiar to many, which was controlled by a Motorola Xoom tablet.  This Instructable is kind of two instructables in one: first, I'll be illustrating the steps required to set up the ADK from scratch and then I'll be reproducing Google's ball maze on a Nexus One phone to demonstrate a simple use of the ADK board (I'll keep the massive bowling-ball version for another Instructable). 

So continuing with my story: I grew up with a ball maze, my parents had one as far back as I can remember. A little while after I got home from Google I/O I found the maze at my parents’ house and shortly thereafter I discovered I had everything I needed to make my very own Googley maze controlled by my Nexus One.

[Lights on, cue primitive one-tracked mind]

The goal was set: I had one night to make this from scratch, hardware and software. I'd never written a real-world Android app before (not that this is very real-world yet...), but I was convinced that it couldn't be too hard. I worked from 7pm to about 5am, though I probably could have done it in 2-4 hours if I had an Instructable like this to start with - being my first ever Android project, much of that time was reading!

Only the Nexus One (Gingerbread 2.3.4) has been tested with the code I'm supplying, but it should work with little to no modifications on a stock up-to-date Nexus S and possibly also Android 3.1 tablets.  As of writing, I am unaware of any other supported devices or Android versions.

So dig through grandma’s game closet for that old ball maze, grab your Nexus, break out your Google ADK board if you went to Google I/O (or get a compatible one from the suppliers listed here ) and start building!

The idea is relatively simple: monitor the phone’s accelerometer, and translate the three-dimensional acceleration vector (ie. which way is "down") into a coordinates on a two-dimensional plane - one dimension for each servo or axis of rotation on the maze.  This is mapped to two absolute positions between 0-255 for positioning the servo arms. These values are passed to the ADK board which acts as the servo controller and controls the tilt on the maze. 

In other words, you can now play the ball maze game by using your phone as a remote controller!

Step 1: Materials and Tools

- A ball maze / labyrinth game
- Google’s ADK Demo board or compatible ADK board with 2 servo outputs
- Two small servos (eg. mini servos found in small RC cars/helicopters)
- Google Nexus One or Nexus S with Gingerbread 2.3.4 (not tested on Nexus S)
- Short cable with female 3x2 or larger box connector (an internal USB panel patch cable works well)
- Male box connector pins - either: one 3x2 or two 3x1 (for connecting to servo sockets)
- 0.5mm aluminium or other pliable sheet metal (for servo brackets)
- Small springs or springy metal (eg. I used stainless steel strips found in some wiper blades)
- A small block of wood (For mounting the "inner" servo to the ring)
- Thin stiff wire, eg. paperclip wire (for servo lever arm fixtures)
- Assorted small screws (to secure servo brackets)
- Small tacks, nails or a staplegun (to secure springs in place)
- Cable ties
- A few drops of oil or grease, particularly if your maze is 30+ years old like mine :)

Required tools:
- Drill and drill bits (I used 1mm, 6mm bits)
- 1-2 pairs of small needle-nosed pliers
- Wire clippers
- Screwdrivers
- Soldering iron
- Sharp knife / craft knife

Other useful tools:
- Drill press
- Small hand-held rotary drill/grinder tool (Dremel or similar)
- Diamond-tipped engraving bit or drill bit (for drilling holes in stainless steel spring strips)
- Bench grinder
- Small hammer / tack hammer

Note to the lazy
If you really don't want to compile and install the apps to your phone (which I highly recommend, you'll see why later), you can download the APK files from this Instructable.  You must ensure that the Settings > Applications > Unknown sources option is selected, copy the APK files to your device, then use a program like ApkInstaller to install them.  If you get an error, check your Android version is either 2.3.4 or 3.1 or greater.
<p>good work!</p>
nice project,im just curious if there's a way that you could control it through wireless connection
AFAIK they are going to support bluetooth connections between phone and ADK board soon but it is not implemented yet. Not sure about wifi though.
Hi pcdevltd,<br><br>It is really Great project ,,,, I see you are appropriate one to tell me about good and small idea for subject on university,,, We can use on it jest Arduino and any sensor to built a nice application which wight 20% from final mark ,,, so please if you have an ides from your experience which smart and good tell me ,, it is really important ,,,<br><br>Than you,,,
Coming up with ideas is one of the best parts of making any project - but I can't help you on that sorry - it depends on what hardware, software and other limitations you have, and also depends on what your university course expects you to do (When I was at university I learned that the &quot;right&quot; answer is most often the one that satisfies the lecturer/professor's expectations, not necessarily the one that you think is best, sadly). Good luck and post a link here when you are done!
BTW is there a code in here for the arduino or is it all the codes are for the android phone. Good day to you pcdev
I have not included the Arduino code, I was simply using the supplied DemoKit firmware (see this link, also posted in the instructable: http://developer.android.com/guide/topics/usb/adk.html#getting-started) The step titled &quot;Installing the firmware to the ADK board&quot; loads the ADK board with the demokit &quot;sketch&quot; (firmware). For this project I have not modified the firmware, but as I mentioned to Maheera if you are not using the Google ADK board then you will almost certainly have to update this code as well. I can't help with regular Arduino boards, I only have experience with the Google ADK board. Good luck!
i think arduino mega 2560 is compatible with the google adk board..thanks for this great project you have atleast i wont start from scratch..keep up the good work :)
Not directly compatible, see links I just posted above.
thanks for the links
too bad i cant install the demokit with my samsung galaxy s 2(2.3.5)..im currently working for the wired one to run successfully before going to a wireless one
Thanks for the comments everyone! Don't forget to come back and vote for me in the three competitions - Toy, Microcontroller and Make it Move - thanks for your support!
Here's a video of the massive one at Google I/O you mentioned, using a bowling ball! Great job.<br><iframe frameborder="0" height="349" src="http://www.youtube.com/embed/JboYN5fz2P4" width="560"></iframe>
Thanks, yes the article also links to a video of it - it was a very cool demonstration of the Android Open Accessory platform, and a very Googley thing to do. I really look forward to seeing what other people build with it, the possibilities really are endless.
awesome job!
I've seen Paul's setup in person and it does work--but you still need to have the reflexes needed to run the maze. I never made it past the first hole. The puzzle tilts in slightly jittery steps, but it is very responsive to tilting the phone.
Thanks John! Yes, it is a little jittery. Reasons include: springs may be a bit soft (could probably be shortened to firm them up), there is no software damping which would make a huge difference, and the maze surface is not completely flat particularly near the start, the most travelled part (from 30 years of use!). To be honest, it's not the type of game you play for an hour at a time like you might on the original, but I've made it to hole 12, so it is definitely playable.
Super-awesome. I've been waiting for the trickle of ADK projects to begin. You set the bar really, really high. Nice work.
Paul, this is awesome! Thank you so much for sharing this wonderful project!

About This Instructable




Bio: I'm a Kiwi, a maker and a Dad of four kids with a passion for good design, wood craft, technology, and laser cutters.
More by SparkItUp:The Ultimate Guide to Laser-cut Box Generators Slow Dance - A Fusion of Art and Magic Android Christmas Lights Controller 
Add instructable to: