USB Host Shield is an inexpensive ( $25 for the full-sized board and $20 for the Mini variant ), add-on board, for the Arduino development platform.
The shield provides a USB Host interface, allowing full and low-speed communication with USB devices – keyboards, mice, joysticks, MIDI, digital cameras, Bluetooth, and many others. In the USB Shield section of this site, you can find many articles describing projects and code examples written for this shield.
On this page, I’m giving a detailed description of the USB Host Shield Hardware manual guide. I start by explaining the board’s connectors, pads, and jumpers, as well as differences between shield variants.
Finally, I demonstrate ways to adapt USB Host Shield to non-typical Arduino boards and less-common power configurations.
This document covers both full-size and Mini shield variants. At the time of writing, the current revision of the full-size USB Host Shield is 2.0 and the current Mini shield is 1.1. Older revisions of the shield will be described later.
Related Article: USB Powered Monitor
USB Host Shield Hardware Board Layout
USB Host shields are available in two form factors – full size and Mini. Full size shield is designed to fit on top of “Standard” Arduinos, such as Uno, Duemilanove, Mega 1280/2560, and compatible clones.
A full-size shield has been designed for ease of use; it has plenty of empty space, features extra pads, solder jumpers, and extensive silkscreen markings, simplifying board modification and troubleshooting.
Full size shield is recommended for basic prototyping and simple projects. Mini shield main advantages are low size, weight, and cost. Ideally, it should be used together with an Arduino Pro Mini 3.3V board.
It can be mated with other Arduino and non-Arduino MCU boards, but it takes more work. Small size, dense part placement, and lack of silkscreen markings make this board more suitable for advanced projects, as well as semi-permanent and permanent installations when basic functionality and wiring are already confirmed on the larger prototype.
Generally, modification and troubleshooting of the Mini shield board are more difficult. Full-size shield USB Host Shield 2.0 exists in 2 configurations – “Standard” and “3.3V”. The layout of the Standard board is depicted on the right.
The board contains a Maxim MAX3421E USB host controller, 12MHz crystal, level shifters, resistors, capacitors, a Reset button, and USB A-type connector.
There are also a number of solder pads and jumpers, which are marked with red arrows. I start my explanation with an arrow close to the Reset button and move counter-clockwise.
- Power Select 2 solder jumpers marked “5V” and “3.3V”. They are used for different power configurations. The configuration is shown, when both jumpers are closed, and is suitable for official Arduinos, such as UNO, Duemilanove, Mega and Mega 2560. See the Power Options section for a detailed explanation.
- Power pins are used to connect to the power pins of the Arduino board. RESET, 3.3V, 5V and GROUND signals from this connector are used.
- Analog pins are not used by the shield. They are provided to simplify mounting and provide pass-through for shields mounted atop of USB Host Shield in a stack.
- GPIN pins. Eight 3.3V general-purpose digital input pins of MAX3421E. They are used primarily to interface with buttons, rotary encoders, and such. GPIN pins can also be programmed as a source of MAX3421E interrupt. An example of GPIN use can be seen in the digital camera controller project.
- ICSP connector is used by the shield to send/receive data using the SPI interface. SCK, MOSI, MISO and RESET signals from this connector are used.
- GPOUT pins are eight 3.3V general-purpose digital output pins of MAX3421E. They can be used for many purposes; I use them to drive HD44780-compatible character LCD, as can be seen in the digital camera controller circuit, as well as this keyboard example. Max_LCD library which is part of the standard USB Host library software package uses some the GPOUT pins.
- Digital I/O pins 0-7, like already mentioned analog pins, are not used by the shield and are provided only for convenience.
- Digital I/O pins 8-13. In this group, the shield in its default configuration uses pins 9 and 10 for INT and SS interface signals. However, standard-sized Arduino boards, such as Duemilanove and UNO have SPI signals routed to pins 11-13 in addition to ICSP connector, therefore shields using pins 11-13 combined with standard-sized Arduinos will interfere with SPI. INT and SS signals can be re-assigned to other pins (see below); SPI signals can not.
- MAX3421E interface pads are used to make shield modifications easier. Pads for SS and INT signals are routed to Arduino pins 10 and 9 via solder jumpers. In case the pin is taken by another shield an re-routing is necessary, a trace is cut and the corresponding pad is connected with another suitable Arduino I/O ping with a wire. To undo the operation, a wire is removed and the jumper is closed. See interface modifications section for more information.GPX pin is not used and is available on a separate pad to facilitate further expansion. It can be used as a second interrupt pin of MAX3421E.
- VBUS power pad. This pad is used in advanced power configurations, as described in the Power Options section.
USB Host Shield 3.3V Differences
Notice that digital and analog pins have parallel rows of pads next to them. They are simply extra pads which are wired to corresponding Arduino pins.
An example of using one of these pads is given in the Interface modification section below. 3.3 V variant of the shield comes pre-configured to work with 3.3V-only Arduino variants, such as Sparkfun’s Arduino Pro 3.3V board. The 3.3V setup is generally less power-hungry than 5V and in many cases can be run directly from a single-cell LiPo battery.
Therefore. 3.3V shield is most suitable for portable projects interfacing primarily with self-powered USB devices, such as digital cameras. Differences between 3.3V and Standard variants of the shield are shown on the picture to the right (click on it to make it bigger).
After much testing it has been determined that the standard shield works with 3.3V-only Arduino boards just fine so I stopped manufacturing 3.3V shield.[/EDIT] Because the default VBUS power configuration is set to 3.3V, this shield is less suitable for bus-powered devices which by spec should be powered by 5V.
Surprisingly, many of them work from 3.3V just fine. Also, if 5V VBUS is desired, possible modification is described in the Power Options section. It is worth noting that both variants of the shield are built on the same PCB, therefore it is possible to make one variant from another by adding/removing parts.
Mini shield The Mini is a 3.3V-only device; it is designed to mate with Arduino Pro Mini. This arrangement makes interconnections easy and keeps the serial/programming connector of Arduino accessible.
Needless to say, the pinout of the Mini shield is identical to Arduino Pro Mini. The picture on the right shows all board pins, pads, and jumpers. If Arduino schematics different name of the pin, this name is given in parentheses. I start in the lower left corner of the image and move counter-clockwise.
The layout of USB Host Mini
- SS, MOSI, MISO, and SCK are SPI signals. SS can be re-wired to a different pin, if necessary – a jumper and extra pad are provided on the top side of the board. The other three SPI signals can be shared between peripherals.
- 3.3V. Power pin of the shield. Do not supply 5V to this pin – MAX3421E won’t be able to detect devices on VBUS and may also be damaged!
- GND Ground return. There are two GND pins on the shield, for proper operation both need to be connected to the MCU board.
- RAW This is Arduino Pro Mini LDO input pin. This pin is not used by Mini shield, however, it can be used to provide 5V to VBUS (see next section for details).
- GPIN and GPOUT are general-purpose input and output pins, which can be used for various purposes. The numbers to the right of the name show bit layout, for example, ‘GPIN 3210’ means that in a row pointed by an arrow the far left of 4 pads corresponds to GPIN3 and the far right is GPIN0. See the full-size shield pin description above for more information about these pins.
- RESET. Arduino RESET pin. Pulling it low resets MAX3421E into the initial power-on state.
- GND. Second ground return. There are two GND pins on the shield, for proper operation both need to be connected to the MCU board.
- SS and INT pads and jumpers are provided to aid in board modification, similarly to a full-size shield – if default SS (D10) and/or INT (D9) pins are occupied and need to be re-wired, a trace inside the corresponding jumper can be cut and pad used to solder a wire. See the ‘Interface modifications’ section for an example.
- GPX is currently not used. It is broken out into a pad in case someone needs it.
- INT. MAX3421E interrupt pin. If necessary, INT can be re-wired from this pin using an extra pad and jumper, as explained above.
- VBUS pad and jumper can be used to provide 5V to VBUS. By default, VBUS is connected to 3.3V; certain USB devices may have issues with this.
Full size shield ships with power/interface pins unpopulated and bundled with a pair of 1×6 and 1×8 plus one 2×3 stackable male/female header which should have to be soldered to the shield prior to use.
8-pin headers need to be soldered to digital pin pads, 6-pin headers come to power and analog pads, and the 2×3 header is used to populate the 2×3 connector and has to be sodered female side down in order to be compatible with official Arduinos.
As you can see on the title picture, using stackable headers is optional. For my projects, I prefer using plain break-away headers on the sides. Standard headers are much easier to source (and I sell them too), that’s why I’m including less common stackable ones.
Also, if you are like to be able to have access to ICSP pins while the shield is mounted, for example, to be able to connect AVR Dragon or another programmer/debugger, do not cut off the male tails of the 2×3 connector after soldering.
Mounting the shield on top of Arduino board provides the shortest signal path and better noise immunity and stability. It is also very restrictive and inflexible; if you’d like to be able to access every point in a circuit, it is possible to arrange boards side-by-side connecting them with pieces of wire.
Word of caution: do not try to route SPI signals through a breadboard! Breadboards have huge stray capacitance and the SPI interface is fast – mixing the two would result in a circuit that is quite unstable if not outright faulty. Default arrangement of Mini shield has already been noted in “Board Layout” section.
A boost converter mounted on USB Host Shield
MAX3421E is a 3.3V device and USB is 3.3V bus. Therefore, it is essential to always have 3.3V supplied to the shield during operation. USB-specified VBUS voltage is 5V; since all bus-powered devices are designed to be powered from 5V, some of them won’t work reliably or even at all from 3.3V.
This is especially true for low-speed devices, like keyboards and mice – I’ve tested plenty of them and so far found none which would function satisfactorily when VBUS is at 3.3V. Considering this, a shield that has 5V VBUS has its USB bus done ‘by spec’ and gives its owner the least grief.
“Official” Arduinos, as well as many clones, provide both 3.3V and 5V to the power connector; the “Standard” shield in default configuration handles VBUS ‘by spec’ and is preferable for general development.
On the other hand, 3.3V systems consume less power and can be run directly from a single LiPo; they are much better suited for portable applications. Additionally, self-powered devices, such as digital cameras don’t really care about VBUS – they have their own power source.
In many cases, it is possible to have perfectly functioning 3.3V-only USB system. For this purpose, the “3.3V” shield variant has been developed. It runs off of single 3.3V supply, provides 3.3V to VBUS and mates perfectly with Sparkfun’s Arduino Pro 3.3V board.
I have tested this configuration with many different self-powered devices and most of them worked just fine. However, there are times when we have a 3.3V-only circuit and need to provide 5V to VBUS.
In this case, it is possible to mount external boost converter to generate 5V from 3.3V. The picture on the right demonstrates one way; a TPS61200-based booster is soldered to the board in the following manner: input to 3.3V, output to VBUS, and ground (on the other side of the DC-DC converter board) to ground.
Note that bothVBUS power selector jumpers are open. (Disclaimer: This booster is my design and Sparkfun pays me royalties from sales, therefore both this paragraph and the accompanying picture shall be treated as a shameless plug.)
USB Host Mini with 5V VBUS
If a 5V-only Arduino board is used, 5V to 3.3V conversion is necessary. It is usually done with LDO; I don’t currently have pictures but basically, all you need is to have a 5V power selector jumper closed, 3.3V jumper open, VBUS powered from 5V, the input of LDO connected to VBUS pad, and output of LDO connected to 3.3V pad on the circuit side of 3.3V jumper.
Mini shield lacks the flexibility of its full-size brother; however, here is one simple way to get 5V to VBUS using Arduino Pro Mini’s 3.3V onboard LDO.
Power the board with 5V on the RAW pin, cut the trace inside the VBUS jumper, provide 5V from RAW to VBUS and get 3.3V from Arduino to the shield in the usual manner via 3.3V pin.
While making this mod be extra careful and don’t short the VBUS pad to the USB connector shield. Also, this mod is easier to make when the Arduino board is placed beneath the shield. The picture on the left shows the necessary wiring.
Rerouting SS signal
There are situations when default pin assignment of USB Host Shield conflicts with other board. In this case it is desirable to be able to move conflicting pin to some other place.
SPI signals – SCK, MISO, and MOSI, can be shared between slave devices and usually don’t require relocation. Two other signals – SS and INT, can be placed to any vacant pin. After modifying the board, the software shall be made aware of the change.
We start with the hardware. The picture on the left shows the shield modified to work with BlackWidow 1.0 Arduino board. The wireless module of BlackWidow uses pin 10, therefore we will be moving pin 10 of the shield to pin 7, which is not used for anything.
First of all, a trace inside the SS jumper needs to be cut in order to disconnect the SS signal from pin 10. After this is done, we need to run a wire from the SS pad to a new pin. Next, we need to modify the code. If you are using the current (2.0) revision of the library, open UsbCore.h and find a line that reads:
|typedef MAX3421e<P10, P9> MAX3421E|
At the time of writing the line, the number is 27. Pins are set inside the angle brackets, first is SS, and second is INT. To move SS from pin 10 to pin 7 change P10 to P7, save and recompile. If you are still using the legacy library, the procedure is similar.
Open Max3421e_constants.h, find #define MAX_SS 10 on line 22 and change “10” to “7”. Save, recompile, and you are done. The mini shield can be modified in a similar fashion; there are no extra pads for Arduino pins, however, so wires need to be soldered directly to the existing ones.
If you still have rev.1 of USB Host Shield or bought a clone cloned from rev.1, the following section describes how to make it work with the current Arduino library.
Since the current library doesn’t initialize the MAX3421E reset line this line needs to be disconnected from Arduino and tied to high potential. It is even better to tie it to the Arduino RESET line so both can be reset using the RESET button.
The following picture shows the mod. First, a jumper resistor next to the RST pad needs to be removed. This can be done easily by heating both sides of the resistor simultaneously. After the jumper is removed, a wire needs to be run from the RST pad to the RESET button, as pictured. This completes the mod.
This is all for now. As I already said, this page will be expanded to cover other shields and modifications. If you’d like to have anything added/corrected/removed, please let me know.
FAQs About USB Host Shield Hardware
What pins does USB Host Shield use?
This is on Uno digital pins 10, 11, 12, and 13 and Mega digital pins 10, 50, 51, and 52. Pin 10 on both boards is used to select the MAX3421E. Pins 7, 8, and 9 are reserved for GPX, INT, and RES. Your board’s warranty information can be found here.
What is a USB Host Shield?
The USB Host Shield includes all of the digital logic and analog circuitry required to build a full-speed USB peripheral/host controller with your Arduino. This means you can use your Arduino to communicate with and control any USB slave device, including thumb drives, digital cameras, Bluetooth dongles, and much more!
Can Arduino be a USB host?
The USB host library turns an Arduino Due board into a USB host, allowing it to communicate with USB peripherals such as mice and keyboards. USB host does not support devices connected via USB hubs. This includes keyboards with an internal hub.