skip navigational linksPJRC
Shopping Cart Checkout Shipping Cost Download Website
Home MP3 Player 8051 Tools All Projects PJRC Store Site Map
You are here: Teensy Teensyduino Libraries USBHostShield

PJRC Store
Teensy 3.1, $19.80
Teensy 2.0, $16.00
Teensy++ 2.0, $24.00
USB Cable, $4.00
Teensy
Main Page
Teensy 3.1
Getting Started
How-To Tips
Code Library
Projects
Teensyduino
Reference

USB Host Shield Library

The USB Host Shield, by Oleg Mazurov, allows you to connect other USB devices.

Download: USBHostShield2.zip, Version 2.0 (works with Teensy)
USBHostShield1.zip, Version 1.0 (modified for Teensy)

Only one version should be copied to your Arduino libraries folder.

Hardware Requirements

The USB Host Shield for Arduino Pro Mini can be used with Teensy running at 3.3 volts.

Teensy MUST be modifed for 3.3 volts.


The USB Host Shield for Arduino Pro Mini connections to Teensy or Teensy++ are:

Host ShieldTeensy 2.0Teensy++ 1.0Teensy++ 2.0
INTPin 9Pin 9Pin 9
SSPin 10Pin 10Pin 10
MOSIPin 2Pin 22Pin 22
MISOPin 3Pin 23Pin 23
SCKPin 1Pin 21Pin 21
GPX(no connection)
RAW(no connection)
RESETVccVccVcc
3.3VVccVccVcc
GNDGNDGNDGND

The SS pin on Teensy is not used, but must remain in output mode.


More hardware details are described below.

Board Test Program

The board test program will check if your USB Host Shield is connected correctly. You can open if from the menu, File > Examples > USBHostShield1 > board_test.


Using USB Devices

TODO: a section should describe how to actually use common devices, like keyboards...

USB Host Capacitance

When a USB device is plugged in, it requires current to charge its on-board capacitors on the power line. This sudden transfer of charge must come from the capacitors in the USB host. The USB host shield and Teensy USB board have limited capacitance. Without extra capacitance, hot plugging a USB device will reboot Teensy, due to a momentary drop in voltage.

The USB specification states USB devices may have a maximum of 10µF directly across their power lines. Any more is supposed to be isolated from the USB power line with a current limiting device. However, this specification is often ignored. Arduino, for example, has a 47µF capacitor.

The USB specification requires USB hosts to have at least 120µF capacitance attached to their power lines. Most USB hosts, especially PC and Macintosh computers, have much more.

One simple solution is to add 100µF or more to the +3.3 volt power line. The MCP1825 regulator on Teensy will help limit the current surge flowing into this capacitor when plugged into a PC, and this capacitor will help provide the current needed when a USB device is plugged into the host shield.

USB Host Power Voltage

The USB Host Shield connects its 3.3 volt power line to the USB power on its connector. The USB specification requires at least 4.4 volts USB power from low power HUBs and 4.75 volts from high power PC and HUBs. Some USB devices can operate with only 3.3 volts, but others require at least 4.4 volts, and some power hungry devices might even require 4.75 volts.

The USB Host Shield has an option to provide separate USB host power. The first step is to cut the USB host power jumper, which separates the USB host power from the 3.3 volt power.


A wire can be soldered to the USB host power pad. Because this pad is so close to the connector, it's a good idea to solder on the bottom side, without extending the wire all the way through the hole.


A 5 volt power supply should be used. However, the USB power provided to Teensy is a convenient source of 5 volts. It's readily available on the 5V pad on the bottom side, which was separated from the power line while adding the MCP1825 voltage regulator.


The final result is a single 5 volt wire running between the bottom side of both boards. All the other connections are available on the normal pins.


Using the USB power, to run Teensy, the USB Host Shield, and another USB device is convenient, but not ideal. The total power may exceed the allowed limits (and the amount of power Teensy reported to the PC). This solution also lacks 120µF; capacitance near the host shield.

Ideally, a proper 5 volt power supply with far more than 120µF capacitance should be used for USB host power.

Hardware Pictures

Teensy 2.0Teensy++ 2.0

More Information