AndroidArduinoMeetup: Difference between revisions

From Noisebridge
Jump to navigation Jump to search
No edit summary
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
On June 5th, 2011, an ethusiastic group of more than 40 people gathered here at NoiseBridge for a first-time Android-Adruino Meetup. Pooling our collective technical know-how , we successfully managed to make our Android phones communicate with Arduino hardware.<br>
<br>
<br>
Our meetup was written up on the MAKE Magazine blog:<br>
== Intro ==
<br>
On June 5th, 2011, an enthusiastic group of more than forty 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.<br>
<br>
''And'' our meetup was written up on the MAKE Magazine blog!:<br>
[http://blog.makezine.com/archive/2011/06/using-the-android-open-accessory-api-without-a-nexus.html Using the Android Open Accessory API without a Nexus]<br>
[http://blog.makezine.com/archive/2011/06/using-the-android-open-accessory-api-without-a-nexus.html Using the Android Open Accessory API without a Nexus]<br>
<br>
<br>
Google officially added Arduino support to new versions of the Android OS so that hardware development is easy on Android phones.<br>
Google recently (and officially) added Arduino support to new versions of the Android OS so that hardware development on Android phones is now easy.<br>
<br>
<br>
Arduino hardware that will work with Android phones includes:<br>
Arduino hardware that will work with Android phones includes:<br>
- the Google ADK (Android Development Kit)<br>
- the Google ADK (Android Development Kit)<br>
- a standard Arduino<br>
- a standard Arduino<br>
- any Arduino clone with a USB Host shield).<br>
- any Arduino clone with a USB Host shield<br>
<br>
<br>
[[Image:ADKphoto.jpg|thumb|right|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 [[User:Rubin110|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.<br>
<br>
<br>
[[Image:ADKphoto.jpg|thumb|right|G2 phone controlling Google's ADK hardware]]
Note: By contrast, a number of other people at the meetup already had phones with versions of the Android OS compatible with Arduino hardwareThese 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).
Since Arduino support is ''only available on new versions'' of the 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 themWe met at one side of the room, where [[User:Rubin110|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.''<br>
<br>
<br>
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).<br>
<br>
<br>
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 [[User:Rubin110|Rubin]] and others, I rooted my phone, and installed the latest version of Cyanogenmod (a fork of the official Android OS).<br>
<br>
<br>
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.<br>
<br>
<br>
I have a new (8 day old) T-Mobile G2 phone (also known as ''HTC Vision'').<br>
 
It came with a version of Android OS (v2.2) that does not support Arduino hardware (need 2.3.4 or later).<br>
== Documentation ==
So, with the help of [[User:Rubin110|Rubin]] and others, I rooted my phone, and installed the latest version of Cyanogenmod (a fork of the official Android OS).<br>
<br>
I attempted to document the steps I went through, so that others can have an easier time of it.<br>
The steps will probably be similar if you have another type of Android phone.<br>
<br>
<br>
'''Here is the documentation:<br>'''<br>
<br>
This entire process took me 3 hours.<br>
<br>
<br>
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.<br>
<br>
<br>
The procedure is mostly given at:<br>
The procedure is mostly given at:<br>
[http://wiki.cyanogenmod.com/index.php?title=TMobile_G2:_Rooting T-Mobile G2 Rooting]<br>
[http://wiki.cyanogenmod.com/index.php?title=TMobile_G2:_Rooting T-Mobile G2 Rooting]<br>
I will not reproduce everything here, but there are a few notes that I'll give that  are very helpful to know.<br>
I will not reproduce everything here, but I'll provide a few notes that are very helpful to know.<br>
<br>
<br>
<br>
Here are some other resources (which I did not use, but may be helpful):<br>
Here are some other additional, useful resources:<br>
wiki.cyanogen.com<br>
wiki.cyanogen.com<br>
forms.cyanogen.com<br>
forms.cyanogen.com<br>
Line 44: Line 40:
IRC -- freenode:  #cyanogenmod<br>
IRC -- freenode:  #cyanogenmod<br>
IRC -- freenode:  #noisebridge<br>
IRC -- freenode:  #noisebridge<br>
<br>
<br>
<br>
<br>
<br>
'''Steps I took to get Cyanogen on my G2:'''<br>
'''Steps I took to get Cyanogen on my G2:'''<br>
Line 52: Line 45:
Basically, follow the instructions here:<br>
Basically, follow the instructions here:<br>
http://wiki.cyanogenmod.com/index.php?title=TMobile_G2:_Rooting<br>
http://wiki.cyanogenmod.com/index.php?title=TMobile_G2:_Rooting<br>
I am mostly just giving helpful notes, below, and not reproducing the entire procedure.<br>
Again, I am mostly just giving helpful notes below, not reproducing the entire procedure.<br>
<br>
<br>
<br>
<br>
<br>
The first step is to backup you phone.
''The first step is to backup you phone.''
<br>
<br>
<br>
<br>
The next step is to get temporary root access.<br>
The next step is to get temporary root access.<br>
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:<br>
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:<br>
http://developer.android.com/sdk/index.html<br>
http://developer.android.com/sdk/index.html<br>
''installer_r11-windows.exe''<br>
''installer_r11-windows.exe''<br>
<br>
<br>
<br>
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:<br>
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).<br>
Downlowd and install JDK on my computer:<br>
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html<br>
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html<br>
''jdk-6u25-windows-i586.exe''<br>
''jdk-6u25-windows-i586.exe''<br>
<br>
<br>
<br>
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.<br>
Then double-click to install the Android SDK, BUT THERE IS A BUG in the installer:<br>
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.<br>
<br>
<br>
<br>
Then I followed the instructions in this Android SDK guide on how to install the Android SDK on my computer:<br>
Then I followed the instructions in this Android SDK guide on how to install the Android SDK on my computer:<br>
http://wiki.cyanogenmod.com/index.php?title=Howto:_Install_the_Android_SDK<br>
http://wiki.cyanogenmod.com/index.php?title=Howto:_Install_the_Android_SDK<br>
<br>
<br>
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.<br>
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.<br>
<br>
<br>
<br>
Back to the instructions for G2 Rooting.<br>
(Back to the instructions for G2 Rooting.)<br>
<br>
<br>
Continue to follow instructions to gain temporary root access on the phone.<br>
Continue to follow instructions to gain temporary root access on the phone.<br>
<br>
<br>
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.<br>
<br>
<br>
Next we move on to gain permanent root access on the phone (which has the bonus of unlocking the phone).<br>
I did not flash the Engineering Hboot (stated as optional in the G2 Rooting instructions).<br>
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).<br>
<br>
<br>
I did not flash the Engineering Hboot (which is stated as optional in the G2 Rooting instructions).<br>
<br>
<br>
Continue with intructions for Install a Custom Recovery Image.<br>
<br>
<br>
Continue with intructions for Installing a Custom Recovery Image.<br>
<br>
<br>
Continue with instructions for Flashing a Radio.<br>
Continue with instructions for Flashing a Radio.<br>
<br>
<br>
<br>
Now continue with instructions for Flashing CyanogenMod:<br>
Continue with instructions for Flashing CyanogenMod:<br>
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:<br>
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:<br>
http://download.cyanogenmod.com/?device=vision<br>
http://download.cyanogenmod.com/?device=vision<br>
''cm_cision_full-98.zip''<br>
''cm_cision_full-98.zip''<br>
<br>
<br>
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:<br>
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:<br>
''CyanogenMod 7''<br>
''CyanogenMod 7''<br>
<br>
<br>
NOTE:  When transferring files to phone, it is fine to transfer the zipped files.<br>
Note:  When transferring files to the phone, it is fine to transfer zipped files.<br>
<br>
<br>
Unhook phone, and then go back to instructions using Second Version.<br>
Unhook the phone and then go back to instructions using Second Version.<br>
<br>
<br>
Using ROM Manager, install cm_vision_full-98.zip
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:<br>
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:<br>
- Backup and restore (to backup entire OS) (takes awhile)<br>
- Backup and restore (to backup entire OS) (takes a while)<br>
- Wipe data/factory reset<br>
- Wipe data/factory reset<br>
- Wipe cache partition<br>
- Wipe cache partition<br>
Line 121: Line 101:
- Reboot system<br>
- Reboot system<br>
<br>
<br>
<br>
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? . . . <br>
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? . . . <br>
SUCCESS!!  --  Though it took a couple of minutes watching the static HTC screen, the CyanogenMod logo animation came up, and my phone works great!<br>
SUCCESS!!  --  Though it took a couple of minutes watching the static HTC screen, the CyanogenMod logo animation came up, and my phone works great!<br>
<br>
<br>
<br>
'''Then I installed the Google ADK software on my G2.'''<br>
'''Then I installed the Google ADK software on my G2.'''<br>
Line 135: Line 113:
SUCCESS!!  I can now control the ADK hardware with my phone:<br>
SUCCESS!!  I can now control the ADK hardware with my phone:<br>
- Light up the three RGB LEDs any color I like.<br>
- Light up the three RGB LEDs any color I like.<br>
- Move the three servo motors.<br>
- Power the three servo motors.<br>
- Turn the two relays on and off.<br>
- Turn the two relays on and off.<br>
- Read the temperature sensor.<br>
- Read the temperature sensor.<br>
- Read the joystick position.<br>
- Read the joystick position.<br>
<br>
<br>
I can't wait to play with this more.<br>
I can't wait to play with this more!<br>
<br>
<br>
<br>
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:<br>
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:<br>
[http://appinventor.googlelabs.com/about/ http://appinventor.googlelabs.com/about/]<br>
[http://appinventor.googlelabs.com/about/ http://appinventor.googlelabs.com/about/]<br>
I haven't used it, but I will...<br>
I haven't used it, but I will...<br>
<br>
<br>
<br>
<br>
<br>
[[User:Malman23|Mitch]].<br>
[[User:Malman23|Mitch]].<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Line 174: Line 142:




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.<br>  
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.<br>  
[http://developer.android.com/guide/topics/usb/adk.html info on Android website]<br>
[http://developer.android.com/guide/topics/usb/adk.html info on Android website]<br>
and<br>
and<br>
Line 180: 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 it all 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.


   
   

Latest revision as of 23:10, 3 November 2011


Intro[edit]


On June 5th, 2011, an enthusiastic group of more than forty 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 now 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 contrast, 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.

Documentation[edit]


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:
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
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:
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 the Java Development Kit running on your computer (the JRE alone is not sufficient). Download and install JDK on your 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, 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:
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, 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:
http://download.cyanogenmod.com/?device=vision
cm_cision_full-98.zip

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 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), we did the following:
- Backup and restore (to backup entire OS) (takes a while)
- 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:
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 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
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 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