Go Down

Topic: USB Host Shield 2.0 (Read 13441 times) previous topic - next topic



The old forum thread about this shield is here -> http://arduino.cc/forum/index.php/topic,38137.0.html

The new shield is compatible with Megas and easier to use; I'm working on the next big revision of the library with hub support.




I recently got this USB shield. I've downloaded the USB libraries from https://github.com/felis/USB_Host_Shield_2.0
I intend to use it to interface with a sensor which has a USB interface and use the Arduino to send the data over USB to an Android phone.

I'm a bit of a newbie when it comes to building in new libraries for the Arduino.
Could you point me to anything on how to integrate the required software for the USB shield ?

Best Regards,


USB hubs have been supported for quite some time so it is possible to plug both your sensor and Android phone to the shield via a hub. Android phone (ADK) is supported in he code; it is also possible to connect a phone via Bluetooth using cheap BT dongle. Check this category for more info ->  https://www.circuitsathome.com/category/mcu/arduino/usb-shield


Can you point me to any basic sketch example - I have the USB shield plugged into my Arduino as shown in the first figure. A sensor is plugged into the USB port from the shield - how do I address the USB port on the shield ?

I dropped the USB_Host_Shield libraries into my arduino\libraries directory (...\arduino-1.0.1-windows\arduino-1.0.1\libraries\USB_Host_Shield).


You don't need to worry about addressing. This sketch can be used to check if everything is put together correctly-> https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/USB_desc


When I run the USB_Desc sketch I get:

"OSC did not start"

See the following photos


The Arduino board you're using is Mega ADK, you can't use this shield with it. The board has USB host built in and I heard it's possible to use it with my code. Check the USB Host 2.0 forks on gitHub.


It looks like you integrated this into the main branch ? (saw this in pull request 6:  https://github.com/felis/USB_Host_Shield_2.0/pull/6)



Could be - I'm not paying much attention to this particular board.


Oct 26, 2012, 06:27 am Last Edit: Oct 26, 2012, 06:29 am by DonQuixote Reason: 1
Right, I'm using USB Host Shield with Arduino Uno. I'm very new with Arduino - please forgive me in advance for silly questions.

The shield is connected and red power LED is ON.
1) When I plug in a USB device, e.g. IPOD or USB memory stick nothing happens. I connected a 9 V external power supply - still nothing happens when USB devices are connected.

2) I installed the USB Host Shield 2.0 library and tried to compile example USB_desc.pde. I get error compiling with the following,
Code: [Select]
In file included from /data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.cpp:18:0:
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.h:109:22: error: '__FlashStringHelper' does not name a type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.h:109:42: error: ISO C++ forbids declaration of 'parameter' with no type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.h:115:24: error: '__FlashStringHelper' does not name a type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.h:115:44: error: ISO C++ forbids declaration of 'parameter' with no type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.cpp:725:23: error: '__FlashStringHelper' does not name a type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.cpp:725:44: error: ISO C++ forbids declaration of 'ifsh' with no type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.cpp:762:25: error: '__FlashStringHelper' does not name a type
/data/tinkering/Arduino/sketchbook/libraries/USB_Host_Shield/SPP.cpp:762:46: error: ISO C++ forbids declaration of 'ifsh' with no type

I am attaching my ~/.arduino/preferences.txt    What else can I do?


What version of Arduino IDE are you using?


Aha! of course the version from ubuntu repos is horribly outdated. I have upgraded to Arduino IDE 1.0.1 and verification is successful.

FYI I am using this USB host shield http://www.robotshop.com/ca/productinfo.aspx?pc=RB-Dfr-104&lang=en-US

I suceeded to query a usb device using [install dir]/sketchbook/libraries/USB_Host_Shield/examples/USB_desc/USB_desc.pde
and query a USB hub and attached devices using [install dir]/sketchbook/libraries/USB_Host_Shield/examples/hub_demo/hub_demo.pde

The typical workflow is: verify sketch --> upload sketch --> open serial monitor --> attach USB device --> (it sends device data)

Probably this is obvious, but it wasn't when I was starting out.

Thanks so much for your great contribution!


Hi, I am trying to connect a Arduino to a Android mobile app using a USB Host shield.
I am using a Arduino Uno and a Sparkfun Host Shield.
This setup is working:

When I processess the usb_des sketch example in Arduino I got this printout:


Device descriptor:
Descriptor Length:   12
Descriptor type:   01
USB version:      0200
Device class:      00
Device Subclass:   00
Device Protocol:   00
Max.packet size:   40
Vendor  ID:      0FCE
Product ID:      5167
Revision ID:      0226
Mfg.string index:   01
Prod.string index:   02
Serial number index:   03
Number of conf.:   01

Configuration descriptor:
Total length:      0043
Num.intf:      02
Conf.value:      01
Conf.string:      00
Attr.:         80
Max.pwr:      FA
Unknown descriptor:
Length:      05
Type:      09
Contents:   0300020904

Interface descriptor:
Intf.number:      00
Alt.:         00
Endpoints:      03
Intf. Class:      06
Intf. Subclass:      01
Intf. Protocol:      01
Intf.string:      00

Endpoint descriptor:
Endpoint address:   85
Attr.:         02
Max.pkt size:      0040
Polling interval:   00

Endpoint descriptor:
Endpoint address:   05
Attr.:         02
Max.pkt size:      0040
Polling interval:   00

Endpoint descriptor:
Endpoint address:   86
Attr.:         03
Max.pkt size:      0040
Polling interval:   05

Interface descriptor:
Intf.number:      01
Alt.:         00
Endpoints:      02
Intf. Class:      FF
Intf. Subclass:      42
Intf. Protocol:      01
Intf.string:      00

Endpoint descriptor:
Endpoint address:   87
Attr.:         02
Max.pkt size:      0040
Polling interval:   00

Endpoint descriptor:
Endpoint address:   06
Attr.:         02
Max.pkt size:      0040
Polling interval:   00


I have problems connecting to the Android phone.
I have downloaded the ArduinoTerminalSrc into the Eclipse with Android SDK installed but I get compiling errors in Eclipse....

Go Up