From Noisebridge
(Difference between revisions)
Jump to: navigation, search
Line 148: Line 148:
Since many of us are relatively clueless on how to hack Android phones, or how to connect them to Arduino to do cool things, a bunch of us are getting together next Sunday to put our collective heads together to see how to make Arduino work on our Android phones.
Since many of us are relatively clueless on how to hack Android phones or how to connect them to Arduino to do cool things, a bunch of us are getting together next Sunday to put our collective heads together and make Arduino work on our Android phones.

Revision as of 22:15, 2 November 2011


On June 5th, 2011, an enthusiastic group of more than 40 people gathered here at NoiseBridge for a new Android-Arduino Meetup. Pooling our collective technical know-how , we successfully managed to make our Android phones communicate with Arduino hardware.

And our meetup was written up on the MAKE Magazine blog!:
Using the Android Open Accessory API without a Nexus

Google recently (and officially) added Arduino support to new versions of the Android OS so that hardware development on Android phones is easy.

Arduino hardware that will work with Android phones includes:
- the Google ADK (Android Development Kit)
- a standard Arduino
- any Arduino clone with a USB Host shield

G2 phone controlling Google's ADK hardware, including two motors

First, since Arduino support is only available on new versions of the Android OS, a lot of people, myself included, needed to root their phones to get a new version of Android OS on them. We met at one side of the room, where Rubin gave an overview of the process of rooting an Android phone, followed by a hands-on workshop. I had my phone rooted, installed the latest Android OS (CyanogenMod), and then got my phone to control the Google ADK hardware! I document my procedure below so others may benefit from my experience.

Note: By constrast, a number of other people at the meetup already had phones with versions of the Android OS compatible with Arduino hardware. These people gathered at the electronics lab area and had their phones connected with Google ADK, standard Arduinos, and other Arduino clones (with USB Host shield).

My phone is a new, eight-day-old T-Mobile G2 phone (also known as HTC Vision). It came with a version of Android OS (v2.2) that does not support Arduino hardware (need v2.3.4 or later). So, with the help of Rubin and others, I rooted my phone, and installed the latest version of Cyanogenmod (a fork of the official Android OS).

I document the steps I took so that others will have an easier time of it. Your process will probably be similar even if you have a different type of Android phone.


This entire process took me 3 hours, but it will take you less time if you have a more recent version of Android as explained above.

The procedure is mostly given at:
T-Mobile G2 Rooting
I will not reproduce everything here, but I'll provide a few notes that are very helpful to know.

Here are some other additional, useful resources:

IRC -- freenode: #cyanogenmod
IRC -- freenode: #noisebridge

Steps I took to get Cyanogen on my G2:

Basically, follow the instructions here:
Again, I am mostly just giving helpful notes below, not reproducing the entire procedure.

The first step is to backup you phone.

The next step is to get temporary root access.
The main thing here is to get ADB running. One way to do this is by installing the Android SDK on your computer. Since wireless access at Noisebridge was overloaded with so many people using it at once, and since Miloh had the foresight to download the Android SDK for Windows, MacOS, and Linux, I downloaded the Windows version (yes, I use Windows) from Miloh’s account on Pony:

But to be able to install the Android SDK, it is necessary to have the Java Development Kit running on your computer (the JRE alone is not sufficient). Download and install JDK on your computer:

Then double-click to install the Android SDK, BUT THERE IS A BUG in the installer: When it says that JDK is needed and it can’t be found, press BACK, and then press NEXT again, and it will proceed fine from there.

Then I followed the instructions in this Android SDK guide on how to install the Android SDK on my computer:

As part of installing the Android SDK, when I connected my phone to my computer, after installing everything, the ADB driver was not installed correctly. So, per the guide's instructions, I had to continue with further steps to update the ADB driver. This worked fine for me.

(Back to the instructions for G2 Rooting.)

Continue to follow instructions to gain temporary root access on the phone.

Next we move on to gain permanent root access on the phone (with the added bonus of unlocking the phone!). Since the first gfree suggested (v0.04) gave me an error about failing to power cycle the eMMC, I had to use gfree v0.02. gfree v0.02 worked fine.

I did not flash the Engineering Hboot (stated as optional in the G2 Rooting instructions).

Continue with intructions for Installing a Custom Recovery Image.

Continue with instructions for Flashing a Radio.

Now continue with instructions for Flashing CyanogenMod:
After downloading the ROM Manager free version, it turns out that I couldn’t download the Cyanogenmod nightlies, which are the latest versions (need paid version or ROM Manager to get latest versions -- ugh), so I used the "second method" in the instructions, and downloaded the latest nightly on my computer, then transferred to G2:

Due to legal reasons, there are a bunch of free Google Android apps that are not allowed to come with CyanogenMod. You can download these (including Android Market) and transfer them to the phone. The package I downloaded and transferred to my phone:
CyanogenMod 7

NOTE: When transferring files to the phone, it is fine to transfer zipped files.

Unhook the phone and then go back to instructions using Second Version.

Using ROM Manager, install After reboot, it ignored instructions we gave it about backups, so when we get a screen full of orange text (Clockwork Flash Recovery), we did the following:
- Backup and restore (to backup entire OS) (takes awhile)
- Wipe data/factory reset
- Wipe cache partition
- Advanced: Wipe dalvik cache (not in instructions, but seemed worthwhile)
- Install from sdcard for cm_vision_full-98
- Install from sdcard for Google apps (g_apps)
- Reboot system

If things falter at this point, I will have a bricked phone. If things do go well, I should get the CyanogenMod logo animation boot screen. What will happen? . . .
SUCCESS!! -- Though it took a couple of minutes watching the static HTC screen, the CyanogenMod logo animation came up, and my phone works great!

Then I installed the Google ADK software on my G2.

Lilia compiled the ADK software for me.

Pro tip: when compiling the demo app under Eclipse, your build target (Project Properties -> Android -> Project Build Target) should be "Google APIs" API 10, which can be installed from the ADK/AVD manager -> Available packages -> Third party Add-ons -> Google Inc. -> Google APIs by Google Inc., Android API 10. This is NOT the same as the Android SDK 2.3.3 API 10. --lilia

When I connected the ADK hardware to my phone (via the USB cable), a screen appeared on my phone asking me if I want to connect.
SUCCESS!! I can now control the ADK hardware with my phone:
- Light up the three RGB LEDs any color I like.
- Power the three servo motors.
- Turn the two relays on and off.
- Read the temperature sensor.
- Read the joystick position.

I can't wait to play with this more!

Additional info: There is a visually-oriented programming language for easily creating your own Android apps called App Inventor. Here is a fun intro to it:
I haven't used it, but I will...


Here is the original announcement:

A couple of weeks ago Google announced Android interconnectivity with Arduino, paving the way for a cheap, easy-to-use hardware development platform. Google then created the ADK (Android Development Kit, based on Arduino), which is not cheap -- but they gave a bunch away for free at the Maker Faire last weekend.
info on Android website
info on Aruino's website

Since many of us are relatively clueless on how to hack Android phones or how to connect them to Arduino to do cool things, a bunch of us are getting together next Sunday to put our collective heads together and make Arduino work on our Android phones.

It is likely that a Google employee and Android developer will be joining us to help out.

When: Sunday, 5-June-2011, 3pm
Where: Noisebridge 2169 Mission St., 3rd floor
What: get our Android phones to play with Arduino (including the Google ADK)
Who: anyone (regardless of skill level) who cares to join in the fun

Personal tools