topamax once a day

Android + Arduino + USB Host + Combination Lock

A simple combination lock with Android and Arduino.  The fancy wheel scroller is based on the android-wheel widget from yuri kanivets.

For additional background information on interfacing Android with the real world, check out my other introductory tutorials:

Simple Digital Input
Simple Digital Output
Simple Analog Input
Simple Analog Output



Parts needed:

  • Android Device (1.6+)
  • Hobby servo
  • Breadboard
  • Power supply
  • Hook-up wire
  • Android ADK Board*
  • – OR –
  • Arduino compatible and USB Host shield

*Supported boards include:

Google ADK boardFreeduino ADK board Seeed Studio ADK board, and DIY Drones ADK board



Simply connect the black line to ground, the red line to +5v, and the yellow signal line to Arduino pin 5 (or other PWM capable pin, usually marked with a ~ symbol). Here is a diagram of the completed circuit (created with Fritzing):



Arduino Firmware

Next, upload the Arduino sketch to the microcontroller. The sketch uses the Microbridge implementation by Niels Brouwers. Microbridge uses Android Debug Bridge (ABD) forwarding over TCP, rather than the official Google Android ADK. You can checkout the source for the Arduino sketch from Github, or just copy and paste the following into the Arduino IDE.


Android App

Finally, install the Android Demo application onto the device. You can either download the pre-built .apkor checkout the source from Github:

git clone git://

Finally upload the app to the device (or browse to this page on the device and download the apk above). Connect the Android device to the USB Host board/shield, and start up the app.


  • mikevanderpool

    If you are using an mega ADK do you need a shield still? I followed the instructions but hooked up directly to Mega ADK but can not control the servo with the app. Dumb question but maybe its bc you need a shield???? Sorry I am a noob thanks for all the wonderful tutorials they are ROCKSTAR!