topamax once a day

Android + IOIO + Software Joystick Servos

Android and IOIO powered pan and tilt servo bracket controlled by software joystick.

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

Android + IOIO + Simple Digital Output
Android + IOIO + Simple Digital Input
Android + IOIO + Simple Analog Output
Android + IOIO + Simple Analog Input

Background on Android development, IOIO, and electronics:

IOIO for Android Beginners Guide
Android Developer’s Guide



Parts needed:

  • Android Device (1.6+, 2.1 for Bluetooth)
  • IOIO (available at Sparkfun)
  • 2x Hobby servo
  • 2x 10k ohm resistors
  • Breadboard
  • Power supply
  • Hook-up wire



Connect the red, power lines of the servos to +5v, the black ground lines to GND, and the yellow signal lines to the desired output pins, number 3 and 6 in the example below.  Other pins can be used as long as they support peripheral output (for PWM, marked with the letter ‘p’ on the back of the IOIO) AND are 5V tolerant (marked with a black circle around the pin). This leaves pins 3-7, and 10-14 as the only potentials.  Also, connect the same signal lines to +5V, with a 10k ohm resistor in series.  This allows use of the pins in 5V open drain mode, required since the IOIO operates with 3.3V. Here is a diagram of the completed circuit (created with Fritzing):



Get the source

With the circuit assembled, the next step is to get the demo application on the Android device. You can either download the pre-built .apk or checkout the source from Github:

git clone git://

If you are building from source, you will also need to import the IOIO Library project, and optionally the IOIO Bluetooth library projects, both available here:

git clone git://


Install, connect, profit!

Finally, upload the app to the Android device (or browse to this page on the device and download the apk above). Connect the device to the IOIO, and start up the app.


  • Timo

    Hi Michael,

    I noticed that although you set your pins 3 and 6 for open drain mode in the circuit, you don’t seem to enable that in the code? Is there a reason for that, or did you just forget? You could do that by changing

    panPwmOutput = ioio_.openPwmOutput(PAN_PIN, PWM_FREQ);
    tiltPwmOutput = ioio_.openPwmOutput(TILT_PIN, PWM_FREQ);


    panPwmOutput = ioio_.openPwmOutput(new DigitalOutput.Spec(PAN_PIN, Mode.OPEN_DRAIN), PWM_FREQ);
    tiltPwmOutput = ioio_.openPwmOutput(new DigitalOutput.Spec(TILT_PIN, Mode.OPEN_DRAIN), PWM_FREQ);


    • Hi Timo,

      That is indeed a mistake! I had updated the code but I guess I forgot to push it back to the git repo. The changes should be reflected there now… Thanks for pointing out the error!

      • Dan Sy

        i got an error in the code, but when i replace the code with the old one, the error is removed,

        the error is the digitaloutput cannot be resolve to a type and the mode cannot be resolved to a variable

  • Pingback: IOIO controller replacement for an RC truck « Vijai's Blog()

  • kenly

    Hi michael

    What code actually works, thanks.