Categories
Specials
Live Chat
My status

CES www.picasion.com
CES online Store.Apk
MAUSO

USB Host Shield for Arduino UNO MEGA 2560 Support Google Android ADK USB HUB

USB Host Shield for Arduino UNO MEGA 2560 Support Google Android ADK USB HUB
Product Code: USB Host Shield
Availability: In Stock
Price: USD 8.00
Qty:     - OR -   Add to Wish List
Add to Compare

Description

  • USB Host Shield for Arduino UNO MEGA 2560.
  • Support the Google Android ADK.
  • Compatible with Arduino Uno 328.
  • Compatible with Arduino Diecimila / Duemilanove 328.
  • Compatible with Arduino Mega 1280.
  • ›See more product details.

 

USB Host Shield Support Google Android ADK & UNO MEGA Duemilanove
2560 Arduino
Description:
1.Support the Google Android ADK, supporting Android phone: G1,
Nexus One, Nexus S, Motorola Droid X.
(Mobile systems need to upgrade to Android 2.3.4, tablet PCs
need to upgrade to Android 3.1).
2.Provides APK package, and compiled source files ADK Compatible
with Arduino.
3.Compatible with following hardware.
Arduino Uno 328.
Arduino Diecimila / Duemilanove 328.
Arduino Mega 2560 (recommended).
Arduino Mega 1280.
4.After achieving the Arduino USB HOST function, can communicate
with other USB devices, and support USB HUB function.
Reference webpage:
http://www.circuitsathome.com/category/mcu/arduino
Libary: https://github.com/felis/USB_Host_Shield_2.0
How to estabish ADK hardware
Platform:http://www.circuitsathome.com/mcu/building-google-adk-hardware-from-standard-components
Package Includes:
1 * USB Host Shield Support Google Android ADK & UNO MEGA
Duemilanove 2560 Arduino

Getting Started

First, make sure you have setup the development environments for Arduino and Android:

Arduino IDE
Android SDK

 

Hardware

Parts needed:

  • Android Device (1.6+)
  • 3x LED Lights
  • 3x 330 ohms resistors
  • Breadboard
  • Power supply
  • Hook-up wire
  • Android ADK Board*
  • – OR –
  • Arduino compatible and USB Host shield

*Supported boards include:

Google ADK boardFreeduino ADK board Seeed Studio ADK board, and DIY Drones ADK board

 

Assembly

Connect the 330 ohm resistors in series with the anodes of the LEDs to the desired digital output pins, and the cathodes of the LEDs to ground. The example uses digital pins 2, 3, and 4, but can be used with any IO pin that doesn’t interfere with the SPI communication with the USB Host Board. For most boards, these are pins 10 – 14. The resistors, in this case, are being used to prevent current overdraw to the LEDs. Here is a diagram of the completed circuit (created with Fritzing):

 

Software

Arduino Firmware

Next, upload the Arduino sketch to the microcontroller. The sketch uses the Microbridgeimplementation by Niels Brouwers. Microbridge uses Android Debug Bridge (ABD) forwarding over TCP, rather than the official Google Android ADK. You can checkout the source for the Arduino sketch from Github, or just copy and paste the following into the Arduino IDE.

 
 
  #include <SPI.h>
  #include <Adb.h>
   
  #define LEDcount 3
   
  Connection * connection;
   
  long lastTime;
   
  //Array of state of LEDs
  uint8_t LEDState[LEDcount];
   
  // Event handler for shell connection; called whenever data sent from Android to Microcontroller
  void adbEventHandler(Connection * connection, adb_eventType event, uint16_t length, uint8_t * data)
  {
  // In this example Data packets contain three bytes: one for the state of each LED
  if (event == ADB_CONNECTION_RECEIVE)
  {
  int i;
  for (i = 0; i < LEDcount; i++)
  {
  if(LEDState[i] != data[i])
  {
  digitalWrite(i+2, data[i]); // Change the state of LED
  Serial.println(data[i],DEC); // Output debugging to serial
  LEDState[i] = data[i]; // Store the State of LED
  }
  }
  }
  }
   
  void setup()
  {
  int i;
  for (i = 0; i < LEDcount; i++)
  {
  pinMode(i+2,OUTPUT); // Set pins as output
  LEDState[i] = 0; // Init state to 0
  }
  // Init serial port for debugging
  Serial.begin(57600);
   
  // Init the ADB subsystem.
  ADB::init();
   
  // Open an ADB stream to the phone's shell. Auto-reconnect. Use any unused port number eg:4568

Write a review

Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below:



Powered By OpenCart
Cambodia Electronic Source © 2024