Arduino (non-DUE) as a USB Host?


My situation is this: I want to have a device to be charged plug into a USB-Type A socket, and query it for VendorID and DeviceID.

The idea is this: The charger will keep a log of files in a microSD card onboard, logging details of every charge. In order to know which device is which, if it has been seen or new, I figure nothing better than deviceID & vendorID.

I'm not doing any other communication with the device-just charging it. I'm hoping I can hit up D+ & D- and fake the device into thinking I'm a real host just long enough to give me it's unique identifiers.

I see a bit with the MAX3-421E chip, but do I really have to go that far (cost, SMD, etc.) just to ask for these 2 pieces of information?

I'm driving this all with an ESP8266, but as I've seen AVR-only libraries out there, I can easily tuck away an ATTiny to do the job if needed.

Any thoughts?

have a look at USBHost

USB host mini boards with MAX3421E chip are pretty cheap. Search Ebay, aliexpress, etc. for "usb host mini board". I do not know of any bit bang implementation of USB host.

The USB Host Shield library supports ESP8266 and ESP32.

Another option is the SAMD21 supports USB host mode so a cheap SAMD21 board such as an Adafruit Trinket M0 might work. Connect the Trinket M0 to the ESP8266 via UART to transfer the VID/PID. A USB OTG to host adaptor or cable is required.

Here is an example project of a Trinket M0 running in USB host mode.

have a look at USBHost

I did, which is why my subject is as it is... From that page:
"Compatible with Arduino Due only"

Much of the information on the Due USB Host page also applies to Zero and MKR. Boards based on the SAMD21 chip such as Zero and MKR support USB OTG. Plugging in a USB OTG to host cable or adaptor should expose USB host capability.