All post of ElecFreaksHack Hack

USB Host Shiled – Build Cheapest ADK

By October 8, 2011 2 Comments
USB-Host

If you are interested in Google’ ADK(Android Open Accessory Development Kit), but Feeling ADK Developer Mage2560 is too expensive. The USB host Shield is you best choice.  It’s compatible with almost Arduinos – not only UNO and Duemilanove, but also big Mega and Mega 2560 work with Standard variant of this shield out of the box. No more SPI re-wiring and code modifications – just solder included stackable connectors (2×3 ICSP connector’s female side should be facing down), plug and play!

We recommend assemble with our Freaduino v1.0 with ATMega328(100% Arduino compatible).

What’s the USB Host Shield could do ??

USB Host Shield is an add-on board for Arduino development platform and contains all of the digital logic and analog circuitry necessary to implement a full-speed USB peripheral/host controller with your Arduino. This means you could use your Arduino to interface with and control any USB slave device – thumbdrives, digital cameras, bluetooth dongles, keyboards, mice, joysticks, MIDI, and much more!

A simple demo of Control LED with Android and USB Host

Step one: Material preparation. There are a Android of v2.3.4 or above(we used Nexus S), USB Host Shield, Arduino main board(we used Freaduino v1.0 with ATMega328(100% Arduino compatible), a 5mm Blue LED and a Power Supply.

 

 

 Step two: The ADK package contains the firmware for the ADK board and hardware design files for the ADK board and shield. Need you put “AndroidAccessory” and “USB_Host_Shield” library to x\arduino-0022\libraries\.

Note the USB_Host_Shile library in adk_release_0512.zip just suit for Mage2560, If you use such as Arduino Duemilanove or UNO, you need the modified library for it. Get the USB-Host-Shield-Library from USB Host Shield Library 1.0 or USB Host Shield Library 2.0. Here we just used the v1.0 library for test. And then install the APP of DemoKit to Android, the patth is “..\ADK_release_0512\app\bin\DemoKitLaunch.apk”. Then connect the material.

 

 

 Step three: Connect the Android phone to USB=Host, the DemoKit will skip to the menu as below, and then check the “OUT” button

 

 

 Step four: By the first of Slider Button to control the LED.

 

 

 

The following code was created by stripping down demokit.pde sample ADK sketch from non-essential code. It’s just for test the USB Host whether work all right and control a LED.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>

#define  LED      8

AndroidAccessory acc("Google, Inc.",
         "DemoKit",
         "DemoKit Arduino Board",
         "1.0",
         "http://www.android.com",
         "0000000012345678");

void setup()
{
  Serial.begin(115200);
  Serial.print("\r\nStart");

  acc.powerOn();

        pinMode(LED, OUTPUT);
        digitalWrite(LED, 0);
}

void loop()
{
        byte msg[3];

  if (acc.isConnected()) {
                Serial.print("Accessory connected. ");
    int len = acc.read(msg, sizeof(msg), 1);
                Serial.print("Message length: ");
                Serial.println(len, DEC);

                if (len > 0) {
      // assumes only one command per packet
      if (msg[0] == 0x2) {
        if (msg[1] == 0x0)
          analogWrite(LED, msg[2]);
                        }
            }
        }

  delay(100);
}
VN:F [1.9.13_1145]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: -1 (from 1 vote)
USB Host Shiled - Build Cheapest ADK , 10.0 out of 10 based on 1 rating
robi

Author robi

ElecFreaks - Community for electronics enthusiasts, provide all you need.

More posts by robi

Join the discussion 2 Comments

  • Shop with us for your e cig vaporizer accessories, check out the many options we have available for your product. You can find the best ejuice in our online shop and we are considered a premium ejuice retailer.When buying E-cigarettes and Dry Tobacco Vaporizers people always need accessories for their products. We carry everything from exclusive cases, lanyards for e cigs, needle nose droppers, glass screens, and more. Needle nose drippers work when filling your ejuice tanks. Its the easy way to keep things clean when filling your tank. Many people today who use conventional cigarettes already see the advantages that come with switching to e cig vaporizer models. We offer many drip tips and drip gaurds for e cig vaporizers. Check out the drip gaurd e cig reviews on the internet or on our site. Once in awhile your usb plug adapter or battery charger cables and connectors go bad. We have the perfect replacement for your product. If you already have all of the accessories which you need, try investing in our basic E-Boge or E-Vape vaporizer kit. We also carry New York Vape’s e cig batteries cheap as well as our e cig batteries interchangeable. Use our dual coil cartomizers triple hole technology with your ejuice tank that allow you to vape our home brewed E-juices. Our many Ejuice flavors makes us a premium ejuice retailer. We look forward to serving you with excellent customer service now and in the future.

    [Reply]

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  • Fiona says:

    Do you have a spam issue on this website; I also am a blogger, and I was
    wondering your situation; many of us have developed
    some nice procedures and we are looking to exchange solutions with other
    folks, be sure to shoot me an e-mail if interested.

    [Reply]

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply