# Arduino USB host that works with any device.

#### Bod

Joined Sep 18, 2016
249
I don't know if this is the best forum. It is 'general electronics' but at the same time, I am using an Arduino.

I have been trying to interface a USB with an Arduino. Doing some research, I found I needed a USB host - makes sense. I was looking around to find a good USB host board. I know there are shields but decent ones are fairly expensive. I came across this (http://www.hobbytronics.co.uk/usb-host-board-v2?utm_source=google&utm_medium=googleshopping&utm_campaign=googlebase&gclid=EAIaIQobChMIsZ3b9r_e4QIVBrXtCh0-uQ7aEAkYAiABEgKeVPD_BwE) but on the website it wants me to select a software option. However, for my project, I don't just want the USB host only to work with a sinlge type of device. Just like a computer, I want it to be able to have any device connected to it.
Is there a USB host out there (preferably that works with Arduino) that will allow me to just plug in any USB device, whether it be a mouse, keyboard, flash drive, MIDI keyboard etc?

Thanks,
Bod

#### djsfantasi

Joined Apr 11, 2010
5,909
As far as I can tell, the software option is for the host itself. The host needs to know what device to which it’s going to connect to.

Many USB Hosts like this must have software for one particular device because unlike a computer, it had limited memory which precludes being able to connect to any USB device.

You may be able to still find what you’re looking for. Good luck.

#### Bod

Joined Sep 18, 2016
249

I keep seeing items like this (https://www.amazon.co.uk/HiLetgo®-Development-Compatible-Interface-Arduino/dp/B0797MTDKZ/ref=asc_df_B0797MTDKZ/?tag=googshopuk-21&linkCode=df0&hvadid=310855475891&hvpos=1o3&hvnetw=g&hvrand=5047698832928644130&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9046080&hvtargid=pla-633282640488&psc=1) which look similar to the one I first linked but don't give the option of selecting software. Is this because they are a shield of a device and use the devices memory?

I don't know if it is worth getting the Arduino Due because it has a lot more processing power and can be used as a host itself or just finding a host schematic and building one myself with more memory.

Bod.

#### John P

Joined Oct 14, 2008
1,785
I'm skeptical about whether this can work. When you plug a USB device into a computer, it goes off and looks for a driver, based on what the connected device says it needs. What would the equivalent procedure ever be for an Arduino?

A Raspberry Pi has USB ports, but I don't know how it deals with drivers, if it needs them. Would you consider stepping up to that?

#### djsfantasi

Joined Apr 11, 2010
5,909

I keep seeing items like this (https://www.amazon.co.uk/HiLetgo®-Development-Compatible-Interface-Arduino/dp/B0797MTDKZ/ref=asc_df_B0797MTDKZ/?tag=googshopuk-21&linkCode=df0&hvadid=310855475891&hvpos=1o3&hvnetw=g&hvrand=5047698832928644130&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9046080&hvtargid=pla-633282640488&psc=1) which look similar to the one I first linked but don't give the option of selecting software. Is this because they are a shield of a device and use the devices memory?

I don't know if it is worth getting the Arduino Due because it has a lot more processing power and can be used as a host itself or just finding a host schematic and building one myself with more memory.

Bod.
I couldn’t find in that shields specifications which devices it supports.

Warning: this is a guess! You’d have to code all the functions on the Arduino. The other device has coded the USB driver functions for you. But is limited to one at a time.

When you connect a USB device to your computer, the host and device negotiate to determine the speed, current requirements and device class. Then, depending on the class, it loads a specific device driver.

It’s that device driver that’s the rub. Is it on the Arduino? Or the USB host shield? Or do you have to code the device driver yourself?

I don’t have the answer for you. Perhaps it easy and included in the Arduino’s firmware or the Arduino language. But I believe that you want to answer those questions before making a purchase.

Or if you can afford it, just buy everything and see if it works.

xox

#### djsfantasi

Joined Apr 11, 2010
5,909
Here is a reference to what John and I are talking about.

#### Papabravo

Joined Feb 24, 2006
12,765
I can tell you that your quest is likely to end in frustration. Since the host does not know what kinds of devices will be plugged in it has to provide for a fairly wide universe of alternatives. It would not surprise me if it were to require more memory than most Arduino devices have. I suggest the RPi devices since they have already solved this problem by provide copious amounts of memory as a standard feature. In adition, that memory is RAM, not flash.

#### djsfantasi

Joined Apr 11, 2010
5,909
I can tell you that your quest is likely to end in frustration. Since the host does not know what kinds of devices will be plugged in it has to provide for a fairly wide universe of alternatives. It would not surprise me if it were to require more memory than most Arduino devices have. I suggest the RPi devices since they have already solved this problem by provide copious amounts of memory as a standard feature. In adition, that memory is RAM, not flash.
Totally agree! The memory and functions are typically provided by libraries in Arduino’s C. And in this case, there may be specific libraries for specific device classes. Thus eliminating the possibility of universality.

There is a HID library, HID-Project library plus libraries for keyboards, mice, joystick, et.al.

#### Bod

Joined Sep 18, 2016
249
Thanks all,

From what I have gathered from all of your great info is that using an Arduino with a USB host wont end well. It was suggested I used a RPi which I think is the route I will take (also beacuse I want to use a RPi).
I think including the code for all the drivers or the files for the drivers or even using internet so it can download them is just too much for what I thought would be a fairly simple project.

Thanks again,
Bod.

#### Papabravo

Joined Feb 24, 2006
12,765
Thanks all,

From what I have gathered from all of your great info is that using an Arduino with a USB host wont end well. It was suggested I used a RPi which I think is the route I will take (also beacuse I want to use a RPi).
I think including the code for all the drivers or the files for the drivers or even using internet so it can download them is just too much for what I thought would be a fairly simple project.

Thanks again,
Bod.
As a side note, and because I suffered through it, getting a USB device to work with Windows was a long and frustrating process. The device was supposed to look like a mass storage device. We had no USB protocol Analyzer. $4500.00 was too much for the bean counters. The only debugging tool we had was the painstaking examination of a corrupted Windows registry to see how far the negotiation process had proceeded before it choked. Then the registry had to be scrubbed so we could revise the firmware and try again. After 4 weeks of this nonsense I convinced management to let me get an analyzer on a 30-day eval basis, and during that time I found one for$495. I bought it with my own funds just in case. There is no SUBSTITUTE for the right tool. Needles to say progress was rapid after procurement of the tools.

#### visionofast

Joined Oct 17, 2018
68
here you can find a good reference to know software USB classes before getting through hardware implementations.
you have to know the suitable class for your device before. for example HID is for mouse,keyboard and joystick and MSC is for storage device like flash disks.
http://www.keil.com/pack/doc/mw/USB/html/_u_s_b__device.html