AndroidArduinoMeetup

From Noisebridge
Revision as of 23:48, 6 June 2011 by SpammerHellDontDelete (talk | contribs) (changing download link for android sdk)
Jump to navigation Jump to search

On June 5th, 2011, about 40 people (or more) gathered at Noisebridge to put our collective heads together to get our Android phones going with Arduino.

Google officially added Arduino support to the Android OS so that hardware development is easy on Android phones.

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


Since Arduino support is only available on new versions of Android OS, a lot of people at the meetup (including me) 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 one's Android phone, followed by a a workshop of actually doing it. I got my phone rooted, installed the latest Android OS (CyanogenMod), and got my phone to control the Google ADK hardware! I document my procedure, below, so others may benefit from my experience.

A bunch of other people at the meetup already had phones with Android OS that was ready for hardware. They gathered at the electronics lab area, and they got their phones connected with Google ADK, standard Arduinos, and other Arduino clones (with USB Host shield).



I have a new (8 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 2.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 attempted to document the steps I went through, so that others can have an easier time of it.
The steps will probably be similar if you have another type of Android phone.


Here is the documentation:


This entire process took me 3 hours.


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


Here are some other resources (which I did not use, but may be helpful):
wiki.cyanogen.com
forms.cyanogen.com
xda-developers.com

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




Steps I took to get Cyanogen on my G2:

Basically, follow the instructions here:
http://wiki.cyanogenmod.com/index.php?title=TMobile_G2:_Rooting
I am mostly just giving helpful notes, below, and not reproducing the entire procedure.



The first step is to backup you phone.

The next step is to get temporary root access.
The first thing here is to get ADB running. One way to do this is by installing the Android SDK on your computer. Since the wireless 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:
http://developer.android.com/sdk/index.html
installer_r11-windows.exe


But to be able to install the Android SDK, it is necessary to have Java Development Kit running on your computer (JRE is not good enough).
Downlowd and install JDK on my computer:
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html
jdk-6u25-windows-i586.exe


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, hit BACK, and then hit NEXT again, and it will go OK from there.



Then I followed the instructions in this Android SDK guide on how to install the Android SDK on my computer:
http://wiki.cyanogenmod.com/index.php?title=Howto:_Install_the_Android_SDK

As part of installing the Android SDK -- when I connected my phone to my computer, after installing everything, ADB driver was not installed correctly. So, as in the guide's instructions, I had to continue with further instructions 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 (which has the bonus of unlocking the phone).
I had to use gfree v0.02, since the first gfree suggested (v0.04) gave me the error about failing to power cycle the eMMC (gfree_02 worked fine).


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


Continue with intructions for Install a Custom Recovery Image.


Continue with instructions for Flashing a Radio.


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:
http://download.cyanogenmod.com/?device=vision
cm_cision_full-98.zip

Because of 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 transer them to the phone. The package I downloaded and transferred to my phone:
CyanogenMod 7

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

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

Using ROM Manager, install cm_vision_full-98.zip After reboot, it ignored instructions we gave it about backups, so when we get a screen full of orange text (Clockwork Flash Recovery), and 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 do not go well at this point, I will have a bricked phone. If things go well, I should get 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.
- Move 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.


There is a visually oriented programming language for very easily creating your own Android apps -- called App Inventor. Here is a fun intro to it:
http://appinventor.googlelabs.com/about/
I haven't used it, but I will...



Mitch.
















Here is the original announcement:



A couple of weeks ago Google announced the ability for Android to connect with Arduino to be used as a cheap, easy-to-use hardware development platform. Google then created 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
and
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 to see how to make it all 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