Introduction This is one of a series of tutorials about using the Arduino Mega ADK microcontroller with Android devices There already exists a Basic4android library for the IOIO microcontroller that exposes its I/O capabilities to an Android application program so allowing the program to control external devices. IOIO however is itself not programmable by the user and so is limited to applications where the host device program merely wants to directly access the I/O capabilities of the microcontroller. There exists a popular class of microcontrollers called Arduino. These devices are intelligent and programmable in their own right. The official Arduino website at Arduino - HomePage is the best place to start investigating this. In particular there is one device, the Arduino Mega ADK that is designed to be used with Android devices and it is on the use of this device that we will be focussing. There is a description of it here Arduino - ArduinoBoardADK. Near the bottom of that page is a link for connecting the Arduino to a Windows computer “For installation follow the same procedure on how install an UNO board on your computer.” Ignore that link as the instructions are no longer correct and an updated inf file that works for Windows 8 as well as earlier versions is now supplied with the IDE. We will look at the IDE in the second of these tutorials and connect the Arduino to our PC in the third. Android devices and USB Any Android device with a USB port can act as a slave device. This means that it can be connected to a host device, such as a PC, where it appears as a memory device, or for later versions of Android, a media device. Such slave devices cannot connect to other slave devices such as keyboards, mice, memory sticks and RS232 adaptors. Newer Android devices support host as well as slave operation and are switched into this mode by connecting an “On The Go” (OTG) or “Camera” cable to the Android device. Such a cable has a grounded connector not present on a normal cable that causes the device to switch to host mode. Android devices capable of host mode can normally identify and use keyboards, mice and memory sticks when connected with an OTG cable and do not pass such devices on to the USB programming APIs so such devices are not available for use by application programs. However unknown devices, like RS232 adaptors are usually passed on to the USB Host APIs so that programs can take control of them. There do however seem to be some Android devices that fail to pass any device to the APIs; presumably this is a bug or software omission on those devices. If you have a Android 3.1 or later rooted device you could try what is detailed in this forum post to enable host mode. http://www.basic4ppc.com/forum/addi...03-usb-rs232-adaptor-driver-5.html#post121049 Later versions of Android also support a slave mode of operation called Android Open Accessory Mode. Android Open Accessory support is included in Android 3.1 (API Level 12) and higher, and supported through an Add-On Library in Android 2.3.4 (API Level 10) and higher. Accessories that implement this are host mode devices and the Arduino Mega ADK is one such device. A brief description may be found here Build Accessories for Android | Android Open Source and here USB Accessory | Android Developers There are two versions of the Android Open Access protocol. We are concerned with version 1, described here. Android Open Accessory Protocol 1.0 | Android Open Source This set of tutorials is based on this web page Accessory Development Kit 2011 Guide | Android Developers Arduino Mega ADK The Arduino Mega ADK, referred to from now on as just the Arduino, has two USB connections, one host and one slave. The slave mode connector connects to a PC and emulates an RS232 port on the PC and through this port the Arduino IDE can download programs to the Arduino and communicate with programs running on the Arduino. The host port connects to an Android device and allows programs on the Android device to communicate with programs running on the Arduino. To follow the tutorial you will need an Arduino Mega ADK and two USB cables. A standard A-B cable to connect the Arduino to your computer and whichever cable you use to connect your Android device to your computer which we will use to connect the Android device to the Arduino. It is also possible that you might need a power supply for the Arduino if your computer USB port cannot supply enough current to both run the Arduino and charge your Android device. This is because the Android device sees the Arduino as a host and so will try to charge from it. In this case if your device is chargeable from a source other than its USB port connecting that charger might be enough to make things work. Possible power issues are addressed in the fourth tutorial in this series. The official Arduino Mega ADK is available world-wide from many distributors. The tutorial on the web page above assumes that the Arduino has a special Android Demo Shield plugged in to it. However, as well as being listed as discontinued by the few distributors that I could find who once sold it, it is an unnecessary expense so we will make do with only the Arduino and its single on-board LED. Hey, if you can wink a LED you can do anything! Tutorials In addition to this introductory tutorial there are other tutorials. They are: 1. This one! 2. Installing the Arduino IDE and compiling your first program. Installation 3. Connecting the Arduino Mega ADK to your computer and running programs on it. Programming 4. Connecting the Arduino Mega ADK to your Android device and writing both an Arduino and a Basic4android program to communicate with each other. Consummation 5. Some commentary on the two programs in tutorial 4. Coda Possibly also, if there is sufficient interest in the Arduino: 6. Advanced topics about programming both the Arduino and the Android device. and/or 7. A collection of FAQs based upon the experience of users. The next tutorial will be number two above where we will install the Arduino IDE and ensure that we can compile a program that includes the Arduino libraries that are needed to talk to an Android device over USB using the Android Accessory protocol.