9

I'm looking to connect various USB-devices to an Arduino Uno (specifically, a gamepad and a webcam, but I'm interested in the general case). Is this possible without using the USB host shield, since the Uno has a USB port and USB-to-serial converter? I could use the shield, but I'm curious if/why it's neccessary.

The Sparkfun website states that:

The SparkFun USB Host Shield contains all of the digital logic and analog circuitry necessary to implement a full-speed USB peripheral/host controller with your Arduino.

Does the Arduino not already contain this, just needing the proper software (although obviously it's easier to use the already written library for the Host Shield). Or are there hardware limitations?

According to Can a Ethernet USB Dongle be instead of ethernet shield for arduino? (Majenko's answer), it can, in theory, be done with the Due, but not with the Uno. In that case, is this because the Uno uses the ATmega16U2 instead of the FTDI FT232RL for USB communication?

  • I don't think it is impossible, USB is some kind serial bus with specific protocols, i.e. device tagging splitting devices to specific time ranges (some similar protocols like one wire). I think the only limitation is speed, therefore syncing all the USB specific commands and data is the thing that causes trouble, – General Chaos Jan 8 '19 at 13:44
  • @GeneralChaos You're right, it's not "impossble" - but it is highly impractical. There is a software implementation of a USB device (VUSB) which doesn't need any special hardware. It's iffy at best and barely works at the best of times. There is no reason why you couldn't write a host equivalent - however, it could never work at anything more than the 1.5MHz of USB 1.0 "Low Speed", so could never talk to anything other than a simple keyboard or mouse. Things like ethernet or webcams are completely impossible without Host or OTG hardware, which the Due has built in to the main chip. – Majenko Jan 8 '19 at 15:04
16

First things first you need to learn the basics of how USB works.

In USB there are two main "things": Hosts and Devices.

You have one Host (usually your computer) and many Devices (such as Arduinos, Printers, Scanners, Webcams, WiFi dongles, etc).

Being a host involves knowing about what devices you are going to have attached to you and how to communicate with them. Being a device means just communicating with the host in your own way.

As you can see it is a far more complex job being a host than being a device.

Arduinos are devices. The small USB interface chips they use are very low powered and can only be a device, never a host.

If you want to plug a device into something it has to be a host (note: I am purposely ignoring hubs here).

The Arduino Due uses a far more powerful chip, and that is capable of being a host (using what is known as On-The-Go mode).

To do it with anything less powerful than a Due you require additional hardware that is specifically designed to be a USB host - and that is where the USB host shield comes in. It has a chip that is designed specially to be a USB host so you can plug a device in to it.

None of the chips on the Uno are designed to be a host. They just don't have the power.

| improve this answer | |
4

No. USB strictly distinguishes between host and device roles. A few chips have functional blocks capable of performing either role, but the 8u2/16u2 are not examples of this.

Typical USB serial converters like the FT232, CP210x, CH340, PL2303, etc are also strictly devices and incapable of being hosts

There are inexpensive host-capable MCUs like the Kinetis KL25Z, but to use them in their cheapest form you would need a different software approach (for example mbed rather than Arduino) and a lot more personal effort. The Teensy-LC is related, but you pay more for the Arduino code loading helper on it than for the MCU that runs your program itself.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.