T-Dongle-ESP32S2
T-Dongle-ESP32S2 copied to clipboard
Example using the OTG female port for USB keyboard?
Hi, is there an example of how to hook up a USB keyboard to the USB OTG female port using Arduino?
You can see the example in the example by installing the ESP32's library.
All of the USB examples, including the Keyboard ones, are for programming the male USB connector to show up as a HID device on the computer that it's plugged in to, but none of them demonstrate using the USB female OTG port.
I join the question. I've been looking for information about it for a few days.
Here is an example of USB host usage of ESP-IDF. https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/cdc/cdc_acm_host
Do you have an Arduino example (that's a esp-idf example)? Or an example of using a keyboard HID?
https://github.com/chegewara/EspTinyUSB
The female port on this board uses the same physical pins as the male connector. This means that you cannot use the host port (the female one) at the same time as the male one connected e.g. to the PC.
One can use (built-in) DIP switches to isolate D+/D- signals of the 'male' connector from the ESP32-S2, so both USB ports can be used at the same time:
- male - to supply power
- female - to provide USB-Host function
This is an example of the USB-Host use case: https://github.com/lyusupov/SoftRF/wiki/WebTop-USB
That's correct. But that means you can only use the male port for power supply then. Data lines are disconnected and you cannot use it as a COM port to the PC.
But the GPIO43 and GPIO44 on the groove are actually UART0 TxD and RxD and it should be possible to use that with a USB TTL serial converter to upload a new sketch and have a serial console.
Great stuff. Thanks. I downloaded the WebTop-USB SW and it works nicely. To reproduce your results: Any chance to show the related USB code to read external devices?
@weissm look into 'examples' area of ESP-IDF and/or WebTop
I am looking for a device were I can connect a Barcode reader, apply some business rules to the read barcode and send this result to a second usb port that acts like a keyboard interface? Any ideas? So the read barcode is transferred to the right format expected by the software.