Select Page

DESCRIPCIÓN

Esta placa sirve para darle conexión USB a tus proyectos. Esta basada en el chip MAX3421E. Utiliza conexión spi para conectar el arduino con este chip (D10-13). Todos los demás pines quedan libres. Tiene una salida hembra de conexión usb común y corriente para conectar cualquier dispositivo y entrega 5V por esta. El USB opera en 2.0 high/low speed. Es compatible con arduino Uno y Duemilanove pero si puede adaptar para usar con cualquier microcontrolador que disponga interfaz SPI.

Los siguientes son algunos de los dispositivos que soporta este shield:

  • Human input device (HID)
  • USB to serial converters, including CDC ACM, Prolific PL2303 and FTDI FT232
  • Google ADK v.1
  • PTP with Canon EOS and Powershot extensions, as well as Nikon DSLR cameras
  • Bluetooth RFCOMM and HID (Sony PS3. Nintendo)
  • Xbox360 controller over wired USB as well as via a wirelss receiver
  • Mass Storage Class – USB flash drives, memory card readers, external hard drives/CD-ROMs, smartphones, etc.

Arduino_Shield_USBHost_01

USB-Host Arduino_Shield_USBHost_02

CARACTERÍSTICAS TÉCNICAS

  • Shield basado en el chip MAX3421E
  • Soporta voltajes de 5V y 3.3V
  • Interfaz SPI (D10 – D13)
  • Compatible con Arduino Uno y Duemilanove
  • Soporta cualquier dispositivo usb esclavo
  • Conexion USB Hembra
  • USB 2.0 high/low speed. (Full-Speed 12Mbps Peripheral, Full-/Low-Speed 12Mbps/1.5Mbps Host)

 

LINKS

PROYECTOS

http://www.elecfreaks.com/1917.html

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, a 5mm Blue LED and a Power Supply.

USB-Host-01.jpg

Step two: The ADK packagecontains the firmware for the ADK board and hardware design files for the ADK board and shield. Need you put «AndroidAccessory» and «USB_Host_Shield1» library to x\arduino-0022\libraries\.

Note the USB_Host_Shile library in adk_release_0512.zip just suit for 328, If you use such as Arduino Mega1280 or 2560, you need the modified library for it, because of SPI pin difference. 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.

USB-Host-02.jpg

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

USB-Host-03.jpg

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

USB-Host-04.jpg

CÓDIGO DE PROGRAMACIÓN

Includes important code snippet. Demo code like :

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.

#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);
}