Tuesday, August 19, 2014

An I/O Source For Platforms That Don’t Have One

[Today's post is by Nick Appelmans, a member of the Humboldt Microcontrollers Group]

Many times I comment that we have more processing power in our phones than the astronauts who traveled to the moon had at their disposal. Often, I follow this up with some derogatory remark about how little we actually use this capability. One area that stands out is controlling physical devices or “physical computing.” I hope this review will inspire you to tap into the resources that sit idle in your pocket and help you to move away from pixel pushing and into the exciting world of input/output.
IOIO board

This blog has previously featured a story on a Kickstarter that produces a device that turns your Android phone into a robot controller. Back in 2011, this feat was accomplished by Ytai Ben-Tsvi, a Google developer, and coworkers working on their 20% time to bring input/output to an Android device using open source hardware and firmware. The IOIO (pronounced “yoyo”) was born and SparkFun picked it up helping to troubleshoot, design the PCB and deal with production. Subsequently in early 2013, a second version was developed, the IOIO OTG (on the go), and several companies help to produce and distribute it (still using open source and selling for $30). The “on the go” designation is more than just a marketing ploy but refers to the fact that the board can now act as a USB device as well as a USB host (more on this later). To date, there is a robust community of developers with an impressive list of completed projects (as of this publication, 181 pins on Pinterest). In this post, I’d like to cover some of the features and describe the process of developing an Android application. Finally, I’ll share some favorite projects that I discovered.
IOIO connected to Android smartphone

The heart of the IOIO is a PIC24F which has lots of ports to provide I/O pins of various flavors (46 in total) operating at 3.3V logic. About half of these pins can be run in ‘open drain’ configuration allowing 5V logic to be implemented or to be used in a bus. These pins can source or sink maximally 20 mA of current and aren't meant to drive motors but only to connect to a driver circuit with power provided by an additional source. Sixteen pins can be used for analog input (0 - 3.3V) with a relatively low sample rate (1KHz). However, the MCU can support 500KHz total for all pins and for the enterprising firmware coder, this could be changed (Ytai expressed an interest to improve sample rate for those wishing to work with audio signals in his blog yet I couldn't find that this has been accomplished). Incidentally, Ytai has done a remarkable job of responding to blog comments and forum questions and this as well as the great design features have contributed to forming the robust community at the ioio-users google group. For more information on the specs of these pins and the board in general, check out the wiki here. So, by connecting these pins to various sensors a whole lot of information can be processed by the Android app.
Self-balancing IOIO robot

How do you develop an Android app to control the IOIO? Well, as I said earlier the OTG aspect of the IOIO OTG means that the board can act as a USB host and the Android phone or tablet as the USB device or the other way around for cases where developers want to control I/O ports with a PC. Those wishing to take advantage of PC control of IOIO should look at the wiki info on that topic here.

Android development requires setting up a Java programming environment as described here and including the appropriate SDK for the device you will program for. This is a weak link for folks just starting to develop in Android as there is no clear hand-holding tutorial going from A to Z and the closest one is found on the SparkFun site here which doesn't detail setting up for the current configuration of the IOIO OTG. This version uses Android Open Accessory in lieu of Android Debug Bridge. See the wiki here to use AOA IOIOLibAccessory instead of the IOIOLib that the SparkFun tutorial recommends. This link also covers setting up your AndroidManifest.xml too. It’s time to move on to writing code for the IOIO once you've got your HelloAndroid app running on your phone or tablet. Uploading the HelloIOIO took me a while to straighten out the various file links, and AOA vs ADB approaches.
IOIO cellular wall printer

What’s been done with the IOIO board that caught my attention? Well, since I mentioned the Android robot blog post, I’d be remiss for not including a link to a simple balancing robot here. Here’s a nice surveillance robot. I’m most excited for art that you can control with the IOIO; here’s a link for an android controlled pixel board. I’m picturing a gigantic mural that android users could connect to and create a communal dynamic art piece. Another project is wearable tech; you could easily use a phone to control the color of your outfit like this color picker. If you've ever wanted to write giant messages on your wall from your phone, this cellular wall printer is a great way to do that using the IOIO. And my personal favorite, the ioio breathalyzer.

That’s it. I hope that you are motivated to check out the great work that Ytai and colleagues have accomplished and that you might even consider incorporating the IOIO into your next project.

**********

No comments:

Post a Comment