I/O, I/O, It’s Out The Port We Go…

Android devices are great things. I’ve been enjoying my Epic 4G ever since I got it (on release day) last August. There are lots of apps for it — and even a modern dialect of BASIC. I’m continually finding out new things to do with it, from playing Augmented Reality games to enjoying interesting music-meets-the-visual-arts applications, to going for a quick virtual flight.

I’ve even recently started learning Android development. Even though Java is necessarily involved in this process, it’s been fun. One thing has been missing, though — the ability to connect with embedded devices. Embedded system design is a big part of what I do, and I missed the ability to tie applications to external microcontroller-powered devices.

The IOIO board for Android (available from SparkFun) fills this niche nicely. Once you’re set up for Android developing, the IOIO board and accompanying API allows Android devices to electronically interact with the outside world.

In Embedded-Geek-speak, it gives your Android devices GPIO ports.

The IOIO board -- GPIO ports for your Android!

The online documentation for the IOIO board is available here.

Here is a quick walkthrough of what it takes to get up and running with the IOIO board, starting from scratch. Much of this information was distilled from the excellent tutorial available on SparkFun’s site — if you’re already an experienced Android developer, you might want to start there instead, since they don’t bother to cover all of the necessary steps in gory detail. (They do link to everything you need, though.)

To make connecting to the board easier, you will probably want to solder some row connectors to it. I went with a DIP configuration: a 22-pin row down each side of the board. That will allow you to use it with a pair of 830-pin solderless breadboards. (You’ll want to either use a decent temperature-controlled soldering iron with a narrow tip to do this, or bribe a friend who’s good at soldering.) Solder the connectors so they connect to the bottom of the board and point downwards.

Software-wise, you will first need the Java JDK (about 70MB, for Windows).  This is not the same thing as the Java runtime environment (JRE), which I won’t link to here to avoid confusion. The JDK allows you to actually develop Java applications. Download and install it first. (Make sure you get the version you need for your system — although for some reason, I needed to install the 32-bit version even though I’m running 64-bit Windows 7. You may have to, as well. Go figure.)

Next, I strongly recommend downloading the (classic / Helios version of the) Eclipse IDE, available here. This will help organize development tasks and provide an integrated environment in which to work. There are other IDEs — possibly very good ones — but Eclipse is the one I’m most familiar with, and so I will base this walkthrough on it. (All of these tools are free, by the way.) Download and install Eclipse (again, get the version appropriate for your host OS.)

Unpack Eclipse into a directory where you want it to reside (maybe C:\eclipse for Windows systems, or perhaps on a folder on your desktop, if you plan on using it a lot. I left mine in a folder named eclipse on the desktop.) Eclipse is a portable app, which means that you don’t have to bother with actually installing it (and therefore, tying it to one particular system.) Once unpacked, you can run it directly.

Once you have Eclipse installed, download and unpack the Android SDK (or maybe run the installer exe, for Windows. This is what I did.) Again, put it somewhere safe — perhaps in its own directory off the drive root, perhaps somewhere else that makes sense to you. (You won’t need to access this yourself, although you will specify where the Android development plugin for Eclipse can find it, later.) Note: If you are running Windows 7 64-bit and you installed the 64-bit JDK, you might get a message saying the installer can’t find the JDK. The fix that I found for this was to install the 32-bit JDK, as well.

Once the Android SDK installer finishes, it will give you the option to run the SDK installation manager. Run this and download the whole set of tools (“accept all”). This may take a while, depending on how fast (or in my case, slow) your Internet connection is. (Verizon — where’s my FIOS, guys?)

The final step is to start up Eclipse and install the ADT Plugin. This is an automated installation done from inside Eclipse. Start Eclipse, click on Help, then Install New Software. Click the Add button, and provide this URL:   https://dl-ssl.google.com/android/eclipse/ (The installation guide recommends that you call it “ADT plugin.”)

Once the plugin finishes installing, you’re ready to start developing for Android. Now to set up for IOIO-specific development. Download the “HelloIOIO” example and import it into Eclipse. (Detailed instructions are available on the tutorial page, here.) Next, download the IOIOLib library file and unpack it into the same parent directory where you put the HelloIOIO directory. Click on Project –> Properties, select Android, then choose the appropriate API level for your target device (probably Android 2.x). Add Internet permissions (android.permission.INTERNET under Add -> Permissions), and you’re done.

Run make, and select your Android device as the target. The app won’t do anything interesting right away, since your Android is still tethered to the PC and not the IOIO board. Once the app is in place, disconnect the Android from the PC, power the IOIO board with 12V (they say 5-15V, but I’ve found at least 7V or so is needed), and connect the Android to the USB connector on the IOIO. It should start charging; if not, you may need to increase the charge current value using the potentiometer near the USB port on the IOIO board. Fully-clockwise seems to work reliably for me.

With the Android connected to the board, run the HelloIOIO app and press the button. If everything went well, you should be able to turn the LED on the board on and off. Congratulations — your Android smartphone now speaks TTL!

 

This entry was posted in Android, Coding, Digital, HOW-TO, Java, Toys. Bookmark the permalink.

Leave a Reply