STATUS
CircuitPython does not support USB Host yet, but the basis API and partial implementation.
The idea is for CircuitPython to rely on TinyUSB, the same way it does for USB Client activities.
Some hardware that run CircuitPython are designed with USB Host in mind such as:
- https://circuitpython.org/board/espressif_esp32s3_usb_otg_n8/
- https://circuitpython.org/board/teensy41/
For better understanding of the status of USB Host in CP, please check those two tickets:
But at least they can be used with Arduino until proper support is available.
The most promising hardware that is largely available and low cost is to do it on RP 2040 board such as the Pico from Raspberry Pi:
The discussion on this possibility take place in this issue:
There was an impressive demo using PIO on the RP2040 to support USB Host with minimum additional hardware:
The goal is to integrate that in TinyUSB and be able to use that from CP.
INTEREST
The persone or team most interested with USB Host is Bill Binko founder of ATmakers.
In Assistive Technology, it is frequently needed to create custom device that help communicate with computer, emulating a keyboard or a mouse. But sometimes devices do exist, but talk a legacy USB protocol or need modification. The most flexible way to interface and reuse those device is by creating USB Filter. That is a device with a USB Host interface and a USB Device interface where USB HID can be used. This explain the particular interest in that kind of feature in CircuitPython.
ALTERNATIVE
Some very old assistive device might have a PS2 interface to generate mouse/keyboard input to old computer. It is supported by CircuitPython https://gist.github.com/dglaude/67585e5be7f59e0f080afbe1f8a25ba9
But that solution is not helping to read from USB Device...
Waiting for native USB support, a coprocessor can be used. The Trinket M0 with special software and a USB OTG adaptor is a very low cost and powerfull such coprocessor:
Github user gdsports made a lot of ready to use firmware and demo of the possibilities:
usb_host has been available since a bit of time already and is not even where current work on 9.0 is happening.
The current prefered hardware is still this: https://circuitpython.org/board/adafruit_feather_rp2040_usb_host/
But development was also done on IMX hardware.
Best is to check the support matrix: https://docs.circuitpython.org/en/latest/shared-bindings/support_matrix.html?filter=usb_host
The future is also a USB Host Feather that LadyAda is working on.
It seems to be based on the same microcontroler/hardware that is frequently used in Arduino USB Host project.
The support is needed in TinyUSB for this to be added to CircuirPython, but that work is funded by Adafruit so it is or will be there.
On the practical level, you can already do this in CP:
So at API level, maybe everything needed is present and there are a few library already available (some that I lightly tested).
I guess that with 9.0 availability, there will be more eyeballs on that feature from CP and more example coming, some nice learn guide, ...
I had one project to turn on and off a Teddy Ruxpin by turning on and off the USB port, but I was blocked by this issue: adafruit/circuitpython#8471
The next step was to modify the Teddy Ruxpin file system to change the bear behaviour based on external information available from the microcontroler (proximity sensor, light sensor, ...).