When the Teensy 4.0 development board hit the market in late 2019 it blew the doors off the place. Sporting a blazing fast 600 MHz ARM processor, 2 megabytes of flash memory, and over 40 I/O pins, at only an inch and a half long it packs a serious punch in a (Teensy) tiny package.

One of the awesome features of this board is its built-in USB host capability. This allows the microcontroller to talk to other USB devices such as human interface devices (mice, keyboards, joysticks), MIDI controllers, and even other development boards over USB serial. While some previous boards such as the Teensy 3.6 had this feature, this is the first Teensy board to include USB host functionality in a small format package.

To take advantage of this awesome new feature, I decided to design a minimalist USB host shield for the Teensy 4.0.

Schematic

While the board includes USB host circuitry built into the microcontroller, it does not include the supporting electronics to make the host port stable. Namely, it is missing the current limiter that prevents a connected USB device from overloading the upstream port or browning out the microcontroller.

The USB specification says that devices can have a maximum input capacitance of 10 µF. That includes both the Teensy 4.0 itself and any attached device on the host port. Some devices with significant power draw may also exceed the inrush current specification of 50 µC. Exceeding these specifications puts more strain on the upstream USB port powering the Teensy. In some cases, hot-plugging a USB device to the Teensy’s host port may even cause the Teensy to brownout and reset.

To solve these problems, the design adds a current limit switch with a soft start feature. This slowly ramps up the current for the Teensy’s host port, and allows the use of a large (100 µF) capacitor to handle smaller surges. The current limit switch also allows devices to be “hot plugged”, meaning connected and disconnected while the microcontroller is running. As a bonus, the specific IC I used also provides some electrostatic discharge (ESD) protection on the USB data pins.

For good measure I also added a small ferrite inductor to form an LC filter and smooth the power, plus a 500 mA polyfuse to protect the Teensy in case of a short.

PCB Design

The goal for the PCB was to design a host circuit that’s as physically small as possible – just large enough for the Teensy itself and the USB-A port to connect to downstream devices. Compared to some more comprehensive “breakout boards”, I wanted a design that I could realistically throw inside a case as part of a prototype.

The resulting design is about as small as possible at 2.0 x 0.7″. There’s just enough room for the Teensy 4.0 board and a horizontal USB-A port. As the Teensy 4.0 does not come with castellated edges, the space under the necessary header pins provides a perfect location to place the SMD parts and save a little space. The components are slim enough to fit underneath the board even when using plain header pins.

When assembled with 0.1″ female headers, the data pins (D+/D-) for the USB host port use 12 mm tall pogo pins from RTLCS to connect to the SMD pads on the underside of the board. This makes it possible to add or remove the Teensy from the shield without any additional soldering or connectors other than the standard headers. When the shield is used without female headers, thin magnet wire can be used to connect the data pads to the shield.

To make this slightly more useful I also added two rows of pin headers on the inside in parallel with the headers on the Teensy. A pair of additional male headers can be soldered on to allow the shield to connect to a breadboard for prototyping.

Finally, I added two M3 holes (3.2 mm) to the board to use with alignment pins when the shield is installed in a case. The lower hole is hidden underneath the USB-A port, but with female headers on the board the upper hole has enough headroom underneath the Teensy 4.0 to add a bolt.

Configuration and Programming

Connected USB devices can be interfaced with using the USBHost_t36 library. So far I’ve tested the shield with a Logitech mouse, a MIDI keyboard, and a handful of controllers (PS3, PS4, Xbox 360, Xbox One, etc.). All performed great and without issue.

The shield has no digital logic and thus no special configuration is required when programming. It’s entirely plug and play with any existing Teensy 4 USB host programs.

Future Upgrades

While the design is solid there is always room for improvement. After finishing v1.0.0 I realized that it would be better if the edge of the board near the USB-A port was set back so the assembled shield could be cleanly integrated into an enclosure. That change has already been made and published as version 1.1.0.

For future revisions it would be great to integrate a USB hub so that the shield could use two stacked USB ports. This would provide a convenient way to use multiple USB devices with the Teensy, plus aesthetically it would make the assembly look more “balanced” against the tall Teensy stack when using female headers. In theory it would also be possible to provide some solder jumpers to make the same PCB compatible with two port (hub) and single port (no hub) configurations.

Download

Want one of these boards? The design is open source! The original KiCAD design files are hosted on GitHub, along with Gerbers and the bill of materials on the releases page.


5 Comments

Bruce Boyes · March 19, 2022 at 4:47 pm

Looks really useful. One case might be controlling and logging to uSD to make a standalone intelligent data acquisition system or embedded controller from a simple USB logger like DATAQ DI-1100 or 2008. Thanks for open sourcing this!

Andrei Shylo · April 7, 2022 at 12:57 am

It looks the TI chip is out of stock in most places. Is there by chance a substitute you could suggest? I’m planning to mill out the board so could do some adjustments on the packaging on my own.

    Dave · April 7, 2022 at 9:47 am

    I don’t have any suggestions on a substitute, sorry. I’m afraid that the chip shortage makes part sourcing a nightmare.

Tristan · October 29, 2023 at 8:49 pm

Nice work. Is this something that could also be necessary/useful to protect/improve stability of usb hosting on teensy 4.1?

    Dave · October 30, 2023 at 12:38 am

    The Teensy 4.1 already has similar hardware onboard. I designed this for the 4.0 because I wanted the same feature in a smaller package.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Would you like to know more?